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

Commit d606be25 authored by Christopher Tate's avatar Christopher Tate Committed by Android (Google) Code Review
Browse files

Merge "Don't crash when component enable/disable broadcasts race with uninstall" into klp-dev

parents 24305da7 06e5fed1
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -1167,12 +1167,20 @@ public class NotificationManagerService extends INotificationManager.Stub
                    }
                    if (packageChanged) {
                        // We cancel notifications for packages which have just been disabled
                        try {
                            final int enabled = mContext.getPackageManager()
                                    .getApplicationEnabledSetting(pkgName);
                            if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                                    || enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
                                cancelNotifications = false;
                            }
                        } catch (IllegalArgumentException e) {
                            // Package doesn't exist; probably racing with uninstall.
                            // cancelNotifications is already true, so nothing to do here.
                            if (DBG) {
                                Slog.i(TAG, "Exception trying to look up app enabled setting", e);
                            }
                        }
                    }
                    pkgList = new String[]{pkgName};
                }