Loading core/java/android/content/pm/UserInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.os.UserManager; */ public class UserInfo implements Parcelable { /** 8 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x000000FF; /** 16 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x0000FFFF; /** * *************************** NOTE *************************** Loading Loading @@ -87,6 +87,11 @@ public class UserInfo implements Parcelable { */ public static final int FLAG_EPHEMERAL = 0x00000100; /** * User is for demo purposes only and can be removed at any time. */ public static final int FLAG_DEMO = 0x00000200; public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL; public int id; Loading Loading @@ -153,6 +158,10 @@ public class UserInfo implements Parcelable { return (flags & FLAG_INITIALIZED) == FLAG_INITIALIZED; } public boolean isDemo() { return (flags & FLAG_DEMO) == FLAG_DEMO; } /** * Returns true if the user is a split system user. * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, Loading core/java/android/os/UserManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -1972,6 +1972,10 @@ public class UserManager { if (!supportsMultipleUsers()) { return false; } // If Demo Mode is on, don't show user switcher if (isDeviceInDemoMode(mContext)) { return false; } List<UserInfo> users = getUsers(true); if (users == null) { return false; Loading @@ -1987,6 +1991,14 @@ public class UserManager { return switchableUserCount > 1 || guestEnabled; } /** * @hide */ public static boolean isDeviceInDemoMode(Context context) { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVICE_DEMO_MODE, 0) > 0; } /** * Returns a serial number on this device for a given userHandle. User handles can be recycled * when deleting and creating users, but serial numbers are not reused until the device is wiped. Loading core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -8537,6 +8537,15 @@ public final class Settings { */ public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed"; /** * Whether this device is currently in retail demo mode. If true, device * usage is severely limited. * <p> * Type: int (0 for false, 1 for true) * @hide */ public static final String DEVICE_DEMO_MODE = "device_demo_mode"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2481,4 +2481,7 @@ <string-array translatable="false" name="config_defaultPinnerServiceFiles"> </string-array> <!-- Component that is the default launcher when demo mode is enabled. --> <string name="config_demoModeLauncherComponent"></string> </resources> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1104,6 +1104,7 @@ <java-symbol type="string" name="lockscreen_transport_pause_description" /> <java-symbol type="string" name="config_ethernet_tcp_buffers" /> <java-symbol type="string" name="config_wifi_tcp_buffers" /> <java-symbol type="string" name="config_demoModeLauncherComponent" /> <java-symbol type="plurals" name="bugreport_countdown" /> <java-symbol type="plurals" name="duration_hours" /> Loading Loading
core/java/android/content/pm/UserInfo.java +11 −2 Original line number Diff line number Diff line Loading @@ -28,8 +28,8 @@ import android.os.UserManager; */ public class UserInfo implements Parcelable { /** 8 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x000000FF; /** 16 bits for user type */ public static final int FLAG_MASK_USER_TYPE = 0x0000FFFF; /** * *************************** NOTE *************************** Loading Loading @@ -87,6 +87,11 @@ public class UserInfo implements Parcelable { */ public static final int FLAG_EPHEMERAL = 0x00000100; /** * User is for demo purposes only and can be removed at any time. */ public static final int FLAG_DEMO = 0x00000200; public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL; public int id; Loading Loading @@ -153,6 +158,10 @@ public class UserInfo implements Parcelable { return (flags & FLAG_INITIALIZED) == FLAG_INITIALIZED; } public boolean isDemo() { return (flags & FLAG_DEMO) == FLAG_DEMO; } /** * Returns true if the user is a split system user. * <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled, Loading
core/java/android/os/UserManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -1972,6 +1972,10 @@ public class UserManager { if (!supportsMultipleUsers()) { return false; } // If Demo Mode is on, don't show user switcher if (isDeviceInDemoMode(mContext)) { return false; } List<UserInfo> users = getUsers(true); if (users == null) { return false; Loading @@ -1987,6 +1991,14 @@ public class UserManager { return switchableUserCount > 1 || guestEnabled; } /** * @hide */ public static boolean isDeviceInDemoMode(Context context) { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVICE_DEMO_MODE, 0) > 0; } /** * Returns a serial number on this device for a given userHandle. User handles can be recycled * when deleting and creating users, but serial numbers are not reused until the device is wiped. Loading
core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -8537,6 +8537,15 @@ public final class Settings { */ public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed"; /** * Whether this device is currently in retail demo mode. If true, device * usage is severely limited. * <p> * Type: int (0 for false, 1 for true) * @hide */ public static final String DEVICE_DEMO_MODE = "device_demo_mode"; /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2481,4 +2481,7 @@ <string-array translatable="false" name="config_defaultPinnerServiceFiles"> </string-array> <!-- Component that is the default launcher when demo mode is enabled. --> <string name="config_demoModeLauncherComponent"></string> </resources>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1104,6 +1104,7 @@ <java-symbol type="string" name="lockscreen_transport_pause_description" /> <java-symbol type="string" name="config_ethernet_tcp_buffers" /> <java-symbol type="string" name="config_wifi_tcp_buffers" /> <java-symbol type="string" name="config_demoModeLauncherComponent" /> <java-symbol type="plurals" name="bugreport_countdown" /> <java-symbol type="plurals" name="duration_hours" /> Loading