Add logging to detect flags set by tests
Android 16 limits the adb shell user to only modifying DeviceConfig
flags that have been allowlisted, either explicitly or through an
allowlisted namespace. However, there are a number of tests that
adopt the shell permission identity to modify flags as required
for the test; if these flags are not allowlisted, then these tests
will fail. Since only the shell user and tests have the
WRITE_ALLOWLISTED_DEVICE_CONFIG permission, this commit forces
the allowlist path to be followed when a DeviceConfig flag
modification is requested with the allowlist permission; if the
flag is not allowlisted, the flag will be logged to ensure it is
added to the allowlist to prevent test breakage once this feature
is enforced. This commit also adds a new WritableNamespaces class
that will contain the set of namespaces that have been approved
for modification.
Bug: 364083026
Flag: android.security.protect_device_config_flags
Test: Manually verified test with flag not in allowlist logged the
flag but did not fail the test.
Change-Id: Ifefe9d47ab73c3e202a027ce37df58592f0a7de4
2 files changed