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

Commit 26b0f359 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Finish unlocking user before touching apps.

Direct Boot unaware apps can end up calling back into the system,
racing with us pushing the user into the UNLOCKED state.  So make
sure we get the user actually UNLOCKED before telling apps that
we're unlocked.

Test: builds, boots
Bug: 73606555
Change-Id: I1501283f80a84d850364a5fc0e119893726618fa
parent 6b10cbd0
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -435,6 +435,14 @@ class UserController implements Handler.Callback {
        }
        mInjector.getUserManagerInternal().setUserState(userId, uss.state);
        uss.mUnlockProgress.finish();

        // Get unaware persistent apps running and start any unaware providers
        // in already-running apps that are partially aware
        if (userId == UserHandle.USER_SYSTEM) {
            mInjector.startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
        }
        mInjector.installEncryptionUnawareProviders(userId);

        // Dispatch unlocked to external apps
        final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
        unlockedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
@@ -1951,10 +1959,6 @@ class UserController implements Handler.Callback {
                FgThread.getHandler().post(() -> {
                    mInjector.loadUserRecents(userId);
                });
                if (userId == UserHandle.USER_SYSTEM) {
                    mInjector.startPersistentApps(PackageManager.MATCH_DIRECT_BOOT_UNAWARE);
                }
                mInjector.installEncryptionUnawareProviders(userId);
                finishUserUnlocked((UserState) msg.obj);
                break;
            case SYSTEM_USER_CURRENT_MSG: