summaryrefslogtreecommitdiff
path: root/tests/PlatformCompatGating
diff options
context:
space:
mode:
authorAndrei-Valentin Onea <andreionea@google.com>2020-01-30 21:38:35 +0000
committerAndrei-Valentin Onea <andreionea@google.com>2020-01-30 21:38:35 +0000
commite222d5a8700d7228e1da2fbdae046dddf3d58a39 (patch)
tree10e892c79a5e553a0959181160878a0ffca384ee /tests/PlatformCompatGating
parent855abe626de8178f5957a7218e1e6dc5b2cc71c6 (diff)
Revert "Add permissions for using PlatformCompat methods"
Revert "Make platform_compat discoverable everywhere" Revert "Add new permissions to test" Revert submission 1210143-platformcompat-permissions Reason for revert: http://b/142942524 Reverted Changes: I3601b12d5: Add new permissions to test I65d425aac: Make platform_compat discoverable everywhere I1c8cbb656: Add permissions for using PlatformCompat methods Change-Id: Idbb616f918fac40b063c3b4f95f73e12a94d6016
Diffstat (limited to 'tests/PlatformCompatGating')
-rw-r--r--tests/PlatformCompatGating/Android.bp1
-rw-r--r--tests/PlatformCompatGating/test-rules/src/android/compat/testing/PlatformCompatChangeRule.java7
2 files changed, 1 insertions, 7 deletions
diff --git a/tests/PlatformCompatGating/Android.bp b/tests/PlatformCompatGating/Android.bp
index 609896ea9e95..5e9ef8efc402 100644
--- a/tests/PlatformCompatGating/Android.bp
+++ b/tests/PlatformCompatGating/Android.bp
@@ -18,6 +18,7 @@ android_test {
name: "PlatformCompatGating",
// Only compile source java files in this apk.
srcs: ["src/**/*.java"],
+ certificate: "platform",
libs: [
"android.test.runner",
"android.test.base",
diff --git a/tests/PlatformCompatGating/test-rules/src/android/compat/testing/PlatformCompatChangeRule.java b/tests/PlatformCompatGating/test-rules/src/android/compat/testing/PlatformCompatChangeRule.java
index c00aa2ac25b3..932ec643d478 100644
--- a/tests/PlatformCompatGating/test-rules/src/android/compat/testing/PlatformCompatChangeRule.java
+++ b/tests/PlatformCompatGating/test-rules/src/android/compat/testing/PlatformCompatChangeRule.java
@@ -16,9 +16,7 @@
package android.compat.testing;
-import android.Manifest;
import android.app.Instrumentation;
-import android.app.UiAutomation;
import android.compat.Compatibility;
import android.compat.Compatibility.ChangeConfig;
import android.content.Context;
@@ -85,16 +83,12 @@ public class PlatformCompatChangeRule extends CoreCompatChangeRule {
@Override
public void evaluate() throws Throwable {
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
- UiAutomation uiAutomation = instrumentation.getUiAutomation();
String packageName = instrumentation.getTargetContext().getPackageName();
IPlatformCompat platformCompat = IPlatformCompat.Stub
.asInterface(ServiceManager.getService(Context.PLATFORM_COMPAT_SERVICE));
if (platformCompat == null) {
throw new IllegalStateException("Could not get IPlatformCompat service!");
}
- uiAutomation.adoptShellPermissionIdentity(
- Manifest.permission.READ_COMPAT_CHANGE_CONFIG,
- Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG);
Compatibility.setOverrides(mConfig);
try {
platformCompat.setOverridesForTest(new CompatibilityChangeConfig(mConfig),
@@ -107,7 +101,6 @@ public class PlatformCompatChangeRule extends CoreCompatChangeRule {
} catch (RemoteException e) {
throw new RuntimeException("Could not call IPlatformCompat binder method!", e);
} finally {
- uiAutomation.dropShellPermissionIdentity();
Compatibility.clearOverrides();
}
}