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

Commit d0e7192e authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Add safeguard for package not having state

When calling wasPackageEverLaunched(), there's always a chance
that it can throw IllegalArgumentException. Catch it and assume
false.

Fixes: 365098435
Bug: 362198191
Bug: 353651949

Test: flash and reboot
Flag: EXEMPT bugfix
Change-Id: I31f8a4341df9f9d480dd24d0cbaed04e48b8efd2
parent 5456c742
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -3397,12 +3397,16 @@ public final class ProcessList {
        final boolean wasStopped = info.isStopped();
        // Check if we should mark the processrecord for first launch after force-stopping
        if (wasStopped) {
            boolean wasEverLaunched;
            boolean wasEverLaunched = false;
            if (android.app.Flags.useAppInfoNotLaunched()) {
                wasEverLaunched = !info.isNotLaunched();
            } else {
                try {
                    wasEverLaunched = mService.getPackageManagerInternal()
                            .wasPackageEverLaunched(r.getApplicationInfo().packageName, r.userId);
                } catch (IllegalArgumentException e) {
                    // Package doesn't have state yet, assume not launched
                }
            }
            // Check if the hosting record is for an activity or not. Since the stopped
            // state tracking is handled differently to avoid WM calling back into AM,