Search code examples
androidrootandroid-source

Changing Android Device Admin Settings


If you go into your android device to Settings-> Security, under the Device Administration section there are some settings for Verify Apps.

While working on AOSP, I am trying to get some testing software to work. So part of that requires I enable and disable this feature. I already have code to disable some other features, they look like this:

    //Allow mock locations
    Settings.Secure.putInt(getContentResolver(),
            Settings.Secure.ALLOW_MOCK_LOCATION, 
            1);

    //Stay on while plugged in
    Settings.Global.putInt(getContentResolver(),
            Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 
            BatteryManager.BATTERY_PLUGGED_USB);

Note* I am running as root so I can change these settings. So to clarify, my question is how to change the settings Verify Apps, where is that located?


Solution

  • You're looking for Settings.Global.PACKAGE_VERIFIER_ENABLE. It doesn't seem to be up on the documentation site, but you can see it in the source.

    Definition:

    android.provider.Settings.java

    Example usage by the default settings app:

    com.android.settings.SecuritySettings.java