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

Commit 5a66a030 authored by Adam Bookatz's avatar Adam Bookatz
Browse files

Let UserController mock OTAs

The system property "persist.pm.mock-upgrade" simulates an OTA
in certain contexts in the PackageManager. It would be convenient
if UserController also obeys it (to test things like ManagedProvisioning
responding correctly to OTAs).

Bug: 143200798
Test: Manual test of adb root; adb shell setprop persist.pm.mock-upgrade 1
Change-Id: I9326f70eb1864b356a1ff33e36bfeae7f6ad0ce6
parent 285e4fe0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
@@ -549,7 +550,8 @@ class UserController implements Handler.Callback {
        // purposefully block sending BOOT_COMPLETED until after all
        // PRE_BOOT receivers are finished to avoid ANR'ing apps
        final UserInfo info = getUserInfo(userId);
        if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
        if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)
                || SystemProperties.getBoolean("persist.pm.mock-upgrade", false)) {
            // Suppress double notifications for managed profiles that
            // were unlocked automatically as part of their parent user
            // being unlocked.