From 1fa1bd94bc2a355e63877cf3699657a6148adc9d Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Thu, 28 Jan 2021 11:43:44 -0800 Subject: [PATCH] Exposed UserManager.isHeadlessSystemUserMode() as public API. Test: atest android.multiuser.cts.UserManagerTest#testIsHeadlessSystemUserMode Test: atest CtsMultiUserTestCases # for extra verification Bug: 173541467 Change-Id: I006f5f40ec7775d6e9ffe675ce96f5f0122b3a92 --- core/api/current.txt | 1 + core/java/android/os/UserManager.java | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index f49ce1fd48a5b..3ce8cb06f868b 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -31423,6 +31423,7 @@ package android.os { method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public android.os.Bundle getUserRestrictions(android.os.UserHandle); method public boolean hasUserRestriction(String); method public boolean isDemoUser(); + method public static boolean isHeadlessSystemUserMode(); method public boolean isManagedProfile(); method public boolean isQuietModeEnabled(android.os.UserHandle); method public boolean isSystemUser(); diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 77183ac21d094..ea1ce37283650 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -1694,10 +1694,13 @@ public class UserManager { } /** - * @hide - * @return Whether the device is running in a headless system user mode. It means the headless - * user (system user) runs system services and system UI, but is not associated with any real - * person. Secondary users can be created to be associated with real person. + * Checks whether the device is running in a headless system user mode. + * + *

Headless system user mode means the {@link #isSystemUser() system user} runs system + * services and some system UI, but it is not associated with any real person and additional + * users must be created to be associated with real persons. + * + * @return whether the device is running in a headless system user mode. */ public static boolean isHeadlessSystemUserMode() { return RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER;