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

Commit 1b7a2f88 authored by Tetsutoki Shiozawa's avatar Tetsutoki Shiozawa Committed by Suprabh Shukla
Browse files

Store package restriction settings at shutdown

Symptom:
Disabled package was re-enabled by restarting a device.

Root cause:
PMS postpones storing the package restriction settings in 10
seconds by design. When a package gets disabled right before
shutdown, PMS fails to store the last changes.

Solution:
Store package restriction settings at shutdown.

Test: Manually:
1. Run "pm suspend <package-name>"
2. Press power and reboot device within 10 seconds
3. Verify that <package-name> remains suspended

BUG: 73447744, 79209078
Change-Id: I4fe76c1f003e51653304cfaeaa5129d84803ce1e
Merged-In: I4fe76c1f003e51653304cfaeaa5129d84803ce1e
parent 2ba981c6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -9414,6 +9414,17 @@ public class PackageManagerService extends IPackageManager.Stub
        mPackageUsage.writeNow(mPackages);
        mCompilerStats.writeNow();
        mDexManager.writePackageDexUsageNow();
        // This is the last chance to write out pending restriction settings
        synchronized (mPackages) {
            if (mHandler.hasMessages(WRITE_PACKAGE_RESTRICTIONS)) {
                mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
                for (int userId : mDirtyUsers) {
                    mSettings.writePackageRestrictionsLPr(userId);
                }
                mDirtyUsers.clear();
            }
        }
    }
    @Override