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

Commit 93316910 authored by Jackal Guo's avatar Jackal Guo Committed by Android (Google) Code Review
Browse files

Merge "Remove orphaned cached result"

parents 25b0b6c7 dd01ec61
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -10351,6 +10351,7 @@ public class PackageManagerService extends IPackageManager.Stub
                mInstaller.rmPackageDir(codePath.getAbsolutePath());
                if (codePathParent.getName().startsWith(RANDOM_DIR_PREFIX)) {
                    mInstaller.rmPackageDir(codePathParent.getAbsolutePath());
                    removeCachedResult(codePathParent);
                }
            } catch (InstallerException e) {
                Slog.w(TAG, "Failed to remove code path", e);
@@ -10360,6 +10361,16 @@ public class PackageManagerService extends IPackageManager.Stub
        }
    }
    private void removeCachedResult(@NonNull File codePath) {
        if (mCacheDir == null) {
            return;
        }
        final PackageCacher cacher = new PackageCacher(mCacheDir);
        // Find and delete the cached result belong to the given codePath.
        cacher.cleanCachedResult(codePath);
    }
    private int[] resolveUserIds(int userId) {
        return (userId == UserHandle.USER_ALL) ? mUserManager.getUserIds() : new int[] { userId };
    }