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

Commit 765dea01 authored by Felipe Leme's avatar Felipe Leme
Browse files

Fixed initial user on UserVisibilityMediator.

Otherwise, the system user never finishes booting as when
WindowManager calls isUserVisible(0), it will return false.

Fixes: 258696493
Test: it boots!
Test: atest UserVisibilityMediatorSUSDTest atest UserVisibilityMediatorMUMDTest

Change-Id: I316e1469977e7a04389d7e0cfab0ff88d3b42481
parent 11791dcd
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@
package com.android.server.pm;

import static android.content.pm.UserInfo.NO_PROFILE_GROUP_ID;
import static android.os.UserHandle.USER_CURRENT;
import static android.os.UserHandle.USER_NULL;
import static android.os.UserHandle.USER_SYSTEM;
import static android.view.Display.DEFAULT_DISPLAY;

import android.annotation.IntDef;
@@ -54,10 +54,9 @@ public final class UserVisibilityMediator implements Dumpable {

    private static final String PREFIX_START_USER_RESULT = "START_USER_";

    // NOTE: it's set as USER_CURRENT instead of USER_NULL because NO_PROFILE_GROUP_ID has the same
    // falue of USER_NULL, which would complicate some checks (especially on unit tests)
    // TODO(b/242195409): might need to change this if boot logic is refactored for HSUM devices
    @VisibleForTesting
    static final int INITIAL_CURRENT_USER_ID = USER_CURRENT;
    static final int INITIAL_CURRENT_USER_ID = USER_SYSTEM;

    public static final int START_USER_RESULT_SUCCESS_VISIBLE = 1;
    public static final int START_USER_RESULT_SUCCESS_INVISIBLE = 2;
@@ -126,7 +125,8 @@ public final class UserVisibilityMediator implements Dumpable {
                }
                if (foreground) {
                    Slogf.w(TAG, "startUser(%d, %d, %b, %d) failed: cannot start profile user in "
                            + "foreground");
                            + "foreground", userId, actualProfileGroupId, foreground,
                            displayId);
                    return START_USER_RESULT_FAILURE;
                } else {
                    boolean isParentRunning = mStartedProfileGroupIds