Delete android.os.EnvironmentTest#testIsExternalStorageManager

This test is broken because the app op change restarts the test process.
It's already tested in CTS and seems to be accidentally left over here.

Change-Id: If72b0c3f8928d8a912f54a69a1ceeb27a8ed404f
This commit is contained in:
Winson Chiu
2022-11-29 22:22:06 +00:00
parent 82f575484c
commit b1dfdd2f20

View File

@@ -47,29 +47,6 @@ public class EnvironmentTest {
return InstrumentationRegistry.getContext();
}
/**
* Sets {@code mode} for the given {@code ops} and the given {@code uid}.
*
* <p>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);
}
}
}