Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment