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

Commit da1aa8f7 authored by Eric Jeong's avatar Eric Jeong
Browse files

Add condition to check if a user can have profile user

- In Auto, headless system user is used, instead of split system user.
- When a profile user is being created based on a normal user, the normal
user should not be a system user if headless system user is enabled.
- We could consider defining isHeadlessSystemUser in UserManager.

Bug: 137195727
Test: Creating profile user in Android Auto should work in hawk_md
environment.

Change-Id: I47192d8f92320296d4220ded285a36b376e6d971
parent 52210e28
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -19,10 +19,11 @@ package android.content.pm;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;

import com.android.internal.os.RoSystemProperties;

/**
 * Per-user information.
 * @hide
@@ -232,7 +233,9 @@ public class UserInfo implements Parcelable {
        if (isManagedProfile() || isGuest() || isRestricted()) {
            return false;
        }
        if (UserManager.isSplitSystemUser()) {
        boolean splitOrHeadlessSystemUser = UserManager.isSplitSystemUser()
                || RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER;
        if (splitOrHeadlessSystemUser) {
            return id != UserHandle.USER_SYSTEM;
        } else {
            return id == UserHandle.USER_SYSTEM;