Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11ebdd6a authored by Kenny Root's avatar Kenny Root Committed by Android (Google) Code Review
Browse files

Merge "Erase OBB files when removing packages" into honeycomb

parents 553889a6 300c13a4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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) {
            }
+12 −3
Original line number Diff line number Diff line
@@ -4408,9 +4408,18 @@ 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) {