commit | 442a1812217cc2724e711f2ad9712f1ef991071b | [log] [tgz] |
---|---|---|
author | Nicholas Sauer <nicksauer@google.com> | Thu Nov 19 10:05:46 2015 -0800 |
committer | Nicholas Sauer <nicksauer@google.com> | Thu Nov 19 12:57:40 2015 -0800 |
tree | 814b22bceab66c481406199c3abf63b2e0648c41 | |
parent | cb22094bb7891d939b27edaaca5b507e087f0fac [diff] |
Selectively delete files from the sdcard bug:25651013 Change-Id: Ie5186a2b6cfd1571f8a3cea78affab2a7540b4d1
diff --git a/hostsidetests/appsecurity/src/com/android/cts/appsecurity/ExternalStorageHostTest.java b/hostsidetests/appsecurity/src/com/android/cts/appsecurity/ExternalStorageHostTest.java index cb67c63..9c22bdc 100644 --- a/hostsidetests/appsecurity/src/com/android/cts/appsecurity/ExternalStorageHostTest.java +++ b/hostsidetests/appsecurity/src/com/android/cts/appsecurity/ExternalStorageHostTest.java
@@ -226,7 +226,9 @@ } private void wipePrimaryExternalStorage() throws DeviceNotAvailableException { - getDevice().executeShellCommand("rm -rf /sdcard/*"); + getDevice().executeShellCommand("rm -rf /sdcard/Android"); + getDevice().executeShellCommand("rm -rf /sdcard/DCIM"); + getDevice().executeShellCommand("rm -rf /sdcard/MUST_*"); } private int[] createUsersForTest() throws DeviceNotAvailableException {
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java index 5e6aa3e..3861ddf 100644 --- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java +++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/src/com/android/cts/writeexternalstorageapp/WriteExternalStorageTest.java
@@ -154,11 +154,10 @@ * storage. */ public void testPrimaryOtherPackageWriteAccess() throws Exception { - deleteContents(Environment.getExternalStorageDirectory()); - final File ourCache = getContext().getExternalCacheDir(); final File otherCache = new File(ourCache.getAbsolutePath() .replace(getContext().getPackageName(), PACKAGE_NONE)); + deleteContents(otherCache); assertTrue(otherCache.mkdirs()); assertDirReadWriteAccess(otherCache); @@ -237,8 +236,9 @@ * Verify that .nomedia is created correctly. */ public void testVerifyNoMediaCreated() throws Exception { - deleteContents(Environment.getExternalStorageDirectory()); - + for (File file : getAllPackageSpecificPaths(getContext())) { + deleteContents(file); + } final List<File> paths = getAllPackageSpecificPaths(getContext()); // Require that .nomedia was created somewhere above each dir