You’ll first need to install Tasker and AutoTools so we can automate this trick. Technically, any other automation app apart from Tasker can be used, but I’m only familiar with Tasker so you’ll have to make adjustments on your own if you prefer using a different app. AutoTools, though, is critical to this trick as this plug-in will allow us to control Secure Settings on our device.

As explained in my article on toggling Immersive Mode, we need to grant the WRITE_SECURE_SETTINGS permission to AutoTools. This is because the command for controlling the safe audio volume state is defined under the Settings.Global class, though the exact syntax for the command is hidden in AOSP (just like it was for Immersive Mode). If you’ve already granted the WRITE_SECURE_SETTINGS permission to AutoTools after having read my previous tutorial on Immersive Mode, then you can skip the next section. If not, then you’ll have to set it up.


Granting Secure Settings Permission to AutoTools

Under Android’s permission management system, applications define the permissions they want to be granted in the Manifest file. Users can then grant or deny permissions on installation (pre-Marshmallow) or on demand (Marshmallow+). However, there are certain permissions that applications cannot be granted even if they request it in the Manifest, such as WRITE_SECURE_SETTINGS. This is because granting any application a permission as powerful as this would give that app a ton of control over your device.

But there is one workaround that we can use to grant the WRITE_SECURE_SETTINGS permission to any app we want. By using ADB‘s package manager (pm) tool, we can grant any permission to any application we want (provided that application requests that permission in the Manifest file).

The first thing you’ll need to do is install the ADB binary onto your computer followed by the right driver for your device. Then, enable USB Debugging in Developer Options (go to Settings –> About Phone and tap on Build number 7 times if you haven’t already) and connect your phone to your computer. Finally, send the following command once you’ve opened up a terminal:

adb shell pm grant com.joaomgcd.autotools android.permission.WRITE_SECURE_SETTINGS

Now AutoTools will have the ability to change any Global, Secure, or System setting on your device. There are various ways you can play around with these settings, and the list of available settings in each category completely depends on your device and software build, but that discussion is for another time. In any case, we’ll move on show you how to use AutoTools to control the safe volume state.


Disabling Safe Audio Warning on Boot

Here’s the description of the profile for those of you who are familiar with Tasker. If you aren’t familiar with Tasker, read on for step-by-step instructions.

Open up Tasker so we can create a new profile. At the bottom right hand corner tap on the + icon to create a new profile. Add an new Event context and go to Tasker –> Monitor Start. We are using this Event context which triggers when Tasker starts up rather than the Event context which activates when the phone boots because the former is far more reliable than the latter.

In any case, press the back button as we will now create a Task associated with this profile. Name the Task anything as it doesn’t matter. Once you enter the Task creation screen, press on the + icon in the bottom middle of the screen to create a new Action. For the first action, go to Task –> Wait and have it wait for 30 seconds. This accounts for the “30 second after boot” rule used in Android to set the safe volume state.

Next, create a new Action and go to Plugin –> AutoTools –> Secure Settings. Press the pencil to open the configuration screen for AutoTools. Go to Custom Setting. For the Setting Type enter Global. For the Name enter audio_safe_volume_state. For the Input Type make it int. For the Value make it 2. Check to make sure you put everything correctly, the configuration should match the middle screenshot below. The command must be sent exactly as I’ve written or it will not have any affect.

Once you’re done, back out to the main menu of Tasker as we’ll need to create another profile. The one we just created accounts for when the safe volume state is set 30 seconds after boot, but for those of you who almost never reboot your device we’ll make another profile to periodically set this value.

Anschrift

Weihanger 23
82401 Rottenbuch

Tel.: +49 ( 8867 ) 9139833
Fax: +49 ( 8867 ) 200302
Mobil: +49 ( 171 ) 2469944
Email: infospamedvkellerde

Serverstandort Deutschland Serverstandort Bayern

Öffnungszeiten

Mo,Di,Do,Fr:
8:00 bis 12:00 Uhr
14:00 bis 17:00 Uhr

Mittwoch:
8:00 bis 12:00 Uhr