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

Commit a83500e5 authored by Tetsutoki Shiozawa's avatar Tetsutoki Shiozawa Committed by akihiro miura
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.

BUG: 73447744
Change-Id: I4fe76c1f003e51653304cfaeaa5129d84803ce1e
parent 1c81aa63
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -10206,6 +10206,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