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

Commit dbf0dbd8 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Retail mode flag and some clients for it" into nyc-mr1-dev

parents 8462d63c eb437d4d
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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 ***************************
@@ -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;
@@ -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,
+12 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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.
+9 −0
Original line number Diff line number Diff line
@@ -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.
+3 −0
Original line number Diff line number Diff line
@@ -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>
+1 −0
Original line number Diff line number Diff line
@@ -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