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

Commit 4b799bc1 authored by Jeongsik Mun's avatar Jeongsik Mun Committed by Todd Kennedy
Browse files

Add missing synchronized block for PackageUsage

mPackageUsage should be locked by mLock.

Bug: 171863889
Test: compile & verify basic functions working
Change-Id: Ic86f54fb0a7a447112936780412999897059e0fd
parent 1d2102b5
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1738,6 +1738,7 @@ public class PackageManagerService extends IPackageManager.Stub
    final @Nullable String mOverlayConfigSignaturePackage;
    final @Nullable String mRecentsPackage;
    @GuardedBy("mLock")
    private final PackageUsage mPackageUsage = new PackageUsage();
    private final CompilerStats mCompilerStats = new CompilerStats();
@@ -10630,13 +10631,14 @@ public class PackageManagerService extends IPackageManager.Stub
    }
    public void shutdown() {
        mPackageUsage.writeNow(mSettings.mPackages);
        mCompilerStats.writeNow();
        mDexManager.writePackageDexUsageNow();
        PackageWatchdog.getInstance(mContext).writeNow();
        // This is the last chance to write out pending restriction settings
        synchronized (mLock) {
            mPackageUsage.writeNow(mSettings.mPackages);
            // This is the last chance to write out pending restriction settings
            if (mHandler.hasMessages(WRITE_PACKAGE_RESTRICTIONS)) {
                mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
                for (int userId : mDirtyUsers) {
@@ -26032,8 +26034,10 @@ public class PackageManagerService extends IPackageManager.Stub
    }
    boolean isHistoricalPackageUsageAvailable() {
        synchronized (mLock) {
            return mPackageUsage.isHistoricalPackageUsageAvailable();
        }
    }
    /**
     * Return a <b>copy</b> of the collection of packages known to the package manager.