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

Commit 4bebf694 authored by David Lin's avatar David Lin Committed by Android (Google) Code Review
Browse files

Merge "Check for the package stoppped state first before checking the flag." into 24D1-dev

parents f1e7f12d e4a7c34b
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -4451,8 +4451,17 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
        final boolean clearPendingIntentsForStoppedApp = (android.content.pm.Flags.stayStopped()
                && packageStateStopped);
        boolean clearPendingIntentsForStoppedApp = false;
        try {
            clearPendingIntentsForStoppedApp = (packageStateStopped
                    && android.content.pm.Flags.stayStopped());
        } catch (IllegalStateException e) {
            // It's unlikely for a package to be force-stopped early in the boot cycle. So, if we
            // check for 'packageStateStopped' which should evaluate to 'false', then this should
            // ensure we are not accessing the flag early in the boot cycle. As an additional
            // safety measure, catch the exception and ignore to avoid causing a device restart.
            clearPendingIntentsForStoppedApp = false;
        }
        if (packageName == null || uninstalling || clearPendingIntentsForStoppedApp) {
            didSomething |= mPendingIntentController.removePendingIntentsForPackage(
                    packageName, userId, appId, doit);