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

Commit 8860a8a3 authored by Mao Jinlong's avatar Mao Jinlong Committed by Gerrit - the friendly Code Review server
Browse files

Don't remove preferred activities when in power off alarm mode

When in power off alarm mode, only power off alarm apps are installed.
So some applications with preferred activity may not be installed. Don't
remove preferred activities when in power off alarm mode to avoid choosing
preferred activities again during next boot-up.

CRs-Fixed: 1063320
Change-Id: Ia383ce3ecc7fb5051c00211b007acd7123124a4c
parent a5865168
Loading
Loading
Loading
Loading
+30 −27
Original line number Diff line number Diff line
@@ -540,6 +540,7 @@ public class PackageManagerService extends IPackageManager.Stub {
    final String[] mSeparateProcesses;
    final boolean mIsUpgrade;
    final boolean mIsPreNUpgrade;
    final boolean mIsAlarmBoot;
    /** The location for ASEC container files on internal storage. */
    final String mAsecInternalPath;
@@ -2268,8 +2269,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        File setFile = new File(AlarmManager.POWER_OFF_ALARM_SET_FILE);
        File handleFile = new File(AlarmManager.POWER_OFF_ALARM_HANDLE_FILE);
        boolean isAlarmBoot = SystemProperties.getBoolean("ro.alarm_boot", false);
        if (isAlarmBoot) {
        mIsAlarmBoot = SystemProperties.getBoolean("ro.alarm_boot", false);
        if (mIsAlarmBoot) {
            mOnlyPowerOffAlarm = true;
        } else if (setFile.exists() && handleFile.exists()) {
            // if it is normal boot, check if power off alarm is handled. And set
@@ -18079,6 +18080,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
        int[] grantPermissionsUserIds = EMPTY_INT_ARRAY;
        synchronized (mPackages) {
            if (!mIsAlarmBoot) {
                // Verify that all of the preferred activity components actually
                // exist.  It is possible for applications to be updated and at
                // that point remove a previously declared activity component that
@@ -18107,6 +18109,7 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
                                mSettings.mPreferredActivities.keyAt(i));
                    }
                }
            }
            for (int userId : UserManagerService.getInstance().getUserIds()) {
                if (!mSettings.areDefaultRuntimePermissionsGrantedLPr(userId)) {