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

Commit 372cd201 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Check for the package stoppped state first before checking the flag." into main

parents 75ee1ea7 5d678dd9
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -4436,8 +4436,17 @@ public class ActivityManagerService extends IActivityManager.Stub
                        packageName, null, userId);
        }
        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) {
            final int cancelReason;
            if (packageName == null) {