diff options
author | Kenny Root <kroot@google.com> | 2011-01-18 14:03:15 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-18 14:03:15 -0800 |
commit | 11ebdd6a7991283986c4fb94ec5f0774cc11d6da (patch) | |
tree | 22999e6f80a6ed00d93b90a2b29dde9e4b7a6727 | |
parent | 553889a678c9bb2d67aaf5fc52b4585e8cebd6ab (diff) | |
parent | 300c13a48132f03d48462b9cd3ec41331a71a411 (diff) | |
download | frameworks_base-11ebdd6a7991283986c4fb94ec5f0774cc11d6da.zip frameworks_base-11ebdd6a7991283986c4fb94ec5f0774cc11d6da.tar.gz frameworks_base-11ebdd6a7991283986c4fb94ec5f0774cc11d6da.tar.bz2 |
Merge "Erase OBB files when removing packages" into honeycomb
-rw-r--r-- | packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java | 1 | ||||
-rw-r--r-- | services/java/com/android/server/PackageManagerService.java | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java index 2ec2226..21f77e3 100644 --- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java +++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java @@ -190,6 +190,7 @@ public class DefaultContainerService extends IntentService { while ((pkg=pm.nextPackageToClean(pkg)) != null) { eraseFiles(Environment.getExternalStorageAppDataDirectory(pkg)); eraseFiles(Environment.getExternalStorageAppMediaDirectory(pkg)); + eraseFiles(Environment.getExternalStorageAppObbDirectory(pkg)); } } catch (RemoteException e) { } diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java index 1eebd6a..059c0b8 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -4407,10 +4407,19 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + + /** + * Check if the external storage media is available. This is true if there + * is a mounted external storage medium or if the external storage is + * emulated. + */ + private boolean isExternalMediaAvailable() { + return mMediaMounted || Environment.isExternalStorageEmulated(); + } + public String nextPackageToClean(String lastPackage) { synchronized (mPackages) { - if (!mMediaMounted) { + if (!isExternalMediaAvailable()) { // If the external storage is no longer mounted at this point, // the caller may not have been able to delete all of this // packages files and can not delete any more. Bail. @@ -4430,7 +4439,7 @@ class PackageManagerService extends IPackageManager.Stub { void startCleaningPackages() { synchronized (mPackages) { - if (!mMediaMounted) { + if (!isExternalMediaAvailable()) { return; } if (mSettings.mPackagesToBeCleaned.size() <= 0) { |