Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
After building Android, ensure that you can change the aconfig flag's value.
To change an aconfig flag value at runtime:
Ensure your device is running and connected to your development machine.
Check to see the flag's current setting:
adbshellaflagslist|greppackage.flagname
If the flag is enabled and your code is executing, continue with step 4 to
disable the flag. If the flag is disabled, skip to step 6 to enable your code.
Disable your code. From the command line, run:
adb shell aflags disable your.full.flag.name
For example, to disable the append_injected_content flag, run:
Check the status your code either by attempting to execute it on the device
or by rerunning the aflags list command again:
adbshellaflagslist|greppackage.flagname
If your code was enabled, it should be disabled. Conversely, if your code was
disabled, it should be enabled.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[null,null,["Last updated 2025-08-29 UTC."],[],[],null,["# Change a flag's value at runtime\n\nAfter building Android, ensure that you can change the aconfig flag's value.\n| **Note:** Only the value for an aconfig read-write flag can be changed at runtime.\n\nTo change an aconfig flag value at runtime:\n\n1. Ensure your device is running and connected to your development machine.\n2. Check to see the flag's current setting:\n\n adb shell aflags list | grep package.flagname\n\n3. If the flag is enabled and your code is executing, continue with step 4 to\n disable the flag. If the flag is disabled, skip to step 6 to enable your code.\n\n4. Disable your code. From the command line, run:\n\n adb shell aflags disable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, to disable the `append_injected_content` flag, run: \n\n adb shell aflags disable com.example.android.aconfig.demo.flags.append_injected_content\n\n5. Skip to step 7.\n\n6. Enable your code. From the command line, run:\n\n adb shell aflags enable \u003cvar translate=\"no\"\u003eyour.full.flag.name\u003c/var\u003e\n\n For example, enable the `append_injected_content` flag, run: \n\n adb shell aflags enable com.example.android.aconfig.demo.flags.append_injected_content\n\n7. Reboot the device:\n\n adb reboot\n\n8. Check the status your code either by attempting to execute it on the device\n or by rerunning the `aflags list` command again:\n\n adb shell aflags list | grep package.flagname\n\n If your code was enabled, it should be disabled. Conversely, if your code was\n disabled, it should be enabled."]]