diff --git a/core/tests/coretests/src/android/os/EnvironmentTest.java b/core/tests/coretests/src/android/os/EnvironmentTest.java index c0325caf14258..8e63a0fe3364b 100644 --- a/core/tests/coretests/src/android/os/EnvironmentTest.java +++ b/core/tests/coretests/src/android/os/EnvironmentTest.java @@ -47,29 +47,6 @@ public class EnvironmentTest { return InstrumentationRegistry.getContext(); } - /** - * Sets {@code mode} for the given {@code ops} and the given {@code uid}. - * - *
This method drops shell permission identity. - */ - private static void setAppOpsModeForUid(int uid, int mode, String... ops) { - if (ops == null) { - return; - } - InstrumentationRegistry.getInstrumentation() - .getUiAutomation() - .adoptShellPermissionIdentity(); - try { - for (String op : ops) { - getContext().getSystemService(AppOpsManager.class).setUidMode(op, uid, mode); - } - } finally { - InstrumentationRegistry.getInstrumentation() - .getUiAutomation() - .dropShellPermissionIdentity(); - } - } - @Before public void setUp() throws Exception { dir = getContext().getDir("testing", Context.MODE_PRIVATE); @@ -127,17 +104,4 @@ public class EnvironmentTest { Environment.buildPath(dir, "Taxes.pdf").createNewFile(); assertEquals(HAS_OTHER, classifyExternalStorageDirectory(dir)); } - - @Test - public void testIsExternalStorageManager() throws Exception { - assertFalse(Environment.isExternalStorageManager()); - try { - setAppOpsModeForUid(Process.myUid(), AppOpsManager.MODE_ALLOWED, - AppOpsManager.OPSTR_MANAGE_EXTERNAL_STORAGE); - assertTrue(Environment.isExternalStorageManager()); - } finally { - setAppOpsModeForUid(Process.myUid(), AppOpsManager.MODE_DEFAULT, - AppOpsManager.OPSTR_MANAGE_EXTERNAL_STORAGE); - } - } }