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

Commit b439aba1 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Address exception thrown by PackageManager for newly installed app" into main

parents f497595f c8dfa7d8
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -3279,13 +3279,18 @@ public final class ProcessList {

        // Check if we should mark the processrecord for first launch after force-stopping
        if ((r.getApplicationInfo().flags & ApplicationInfo.FLAG_STOPPED) != 0) {
            try {
                final boolean wasPackageEverLaunched = mService.getPackageManagerInternal()
                        .wasPackageEverLaunched(r.getApplicationInfo().packageName, r.userId);
                // If the package was launched in the past but is currently stopped, only then it
            // should be considered as stopped after use. Do not mark it if it's the first launch.
                // should be considered as stopped after use. Do not mark it if it's the
                // first launch.
                if (wasPackageEverLaunched) {
                    r.setWasForceStopped(true);
                }
            } catch (IllegalArgumentException e) {
                // App doesn't have state yet, so wasn't forcestopped
            }
        }

        if (!isolated && !isSdkSandbox