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

Commit 05d3f055 authored by Sumedh Sen's avatar Sumedh Sen
Browse files

Set system packages as stopped on user creation

When new users are created, apps preloaded on the system partition will be scanned with
an initial state of "stopped=true".

Packages can be added to an allowlist to skip setting them initially as
stopped.

Bug: 249514169
Test: atest CtsContentTestCases:SystemPackageDefaultStoppedStateTest
Change-Id: I48523c534f8e00e6953dbe774d7d68b2060c7809
parent f9a03e81
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -4430,6 +4430,15 @@ public final class Settings implements Watchable, Snappable {
                                ps.getPackageName()));
                                ps.getPackageName()));
                // Only system apps are initially installed.
                // Only system apps are initially installed.
                ps.setInstalled(shouldReallyInstall, userHandle);
                ps.setInstalled(shouldReallyInstall, userHandle);

                // Non-Apex system apps, that are not included in the allowlist in
                // initialNonStoppedSystemPackages, should be marked as stopped by default.
                final boolean shouldBeStopped = service.mShouldStopSystemPackagesByDefault
                        && ps.isSystem()
                        && !ps.isApex()
                        && !service.mInitialNonStoppedSystemPackages.contains(ps.getPackageName());
                ps.setStopped(shouldBeStopped, userHandle);

                // If userTypeInstallablePackages is the *only* reason why we're not installing,
                // If userTypeInstallablePackages is the *only* reason why we're not installing,
                // then uninstallReason is USER_TYPE. If there's a different reason, or if we
                // then uninstallReason is USER_TYPE. If there's a different reason, or if we
                // actually are installing, put UNKNOWN.
                // actually are installing, put UNKNOWN.