Merge "Read build flag to determine user model." into pi-dev
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java b/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
index 44e7b07..3eb7913 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
+++ b/packages/SettingsLib/src/com/android/settingslib/users/UserManagerHelper.java
@@ -25,6 +25,7 @@
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
@@ -42,6 +43,7 @@
@Deprecated
public final class UserManagerHelper {
private static final String TAG = "UserManagerHelper";
+ private static final String HEADLESS_SYSTEM_USER = "android.car.systemuser.headless";
private final Context mContext;
private final UserManager mUserManager;
private final ActivityManager mActivityManager;
@@ -77,6 +79,15 @@
}
/**
+ * Returns {@code true} if the system is in the headless user 0 model.
+ *
+ * @return {@boolean true} if headless system user.
+ */
+ public boolean isHeadlessSystemUser() {
+ return SystemProperties.getBoolean(HEADLESS_SYSTEM_USER, false);
+ }
+
+ /**
* Gets UserInfo for the foreground user.
*
* Concept of foreground user is relevant for the multi-user deployment. Foreground user
@@ -169,6 +180,9 @@
* Gets all the users on the system that are not currently being removed.
*/
public List<UserInfo> getAllUsers() {
+ if (isHeadlessSystemUser()) {
+ return getAllUsersExcludesSystemUser();
+ }
return mUserManager.getUsers(true /* excludeDying */);
}