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

Commit ac7c8ae4 authored by Pavel Grafov's avatar Pavel Grafov
Browse files

Go via FgThread when starting the profiles during system boot.

Curently there is a race condition between unlocking the parent
user (spread across FgThread and mHandlerThread) and booting the
profile (happens on mHandlerThread). If the latter is too slow
and parent is still locked when the profile has reached
STATE_RUNNING_LOCKED, it won't proceed to unlock, which causes
the issue.

More complete RCA is on the first bug.

Bug:112830273
Bug:113128300
Test: atest UserControllerTest
Test: manual boot up with profile without passwords
Merged-In: I44dcbb431f97bd40ec00f417cd4b7e935a6b06bc
Change-Id: I44dcbb431f97bd40ec00f417cd4b7e935a6b06bc
parent 9a32a1dc
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -845,10 +845,16 @@ class UserController implements Handler.Callback {
    }

    void scheduleStartProfiles() {
        // Parent user transition to RUNNING_UNLOCKING happens on FgThread, so it is busy, there is
        // a chance the profile will reach RUNNING_LOCKED while parent is still locked, so no
        // attempt will be made to unlock the profile. If we go via FgThread, this will be executed
        // after the parent had chance to unlock fully.
        FgThread.getHandler().post(() -> {
            if (!mHandler.hasMessages(START_PROFILES_MSG)) {
                mHandler.sendMessageDelayed(mHandler.obtainMessage(START_PROFILES_MSG),
                        DateUtils.SECOND_IN_MILLIS);
            }
        });
    }

    void startProfiles() {