android-test
android-test copied to clipboard
Clearing package data also revokes development permissions on API < 23
This matches the behavior on API 23 and newer.
Background
We have a custom androidTestUtil APK that backports UiConnection.executeShellCommand to Kitkat. It's AOSP-signed so it works in AVD, which has to be enough.
We use it to grant a library under test android.permission.WRITE_SECURE_SETTINGS. We also need to clean that up in the test.
Given that the instrumentation package and target package are the same, removing permission kills our instrumentation process. The solution is to revoke permissions from the orchestrator when testInstrumentationRunnerArguments["clearPackageData"] = "true".