From a9772f360202b05858fa199088bfe94697a3f623 Mon Sep 17 00:00:00 2001 From: yuemingw Date: Mon, 23 Oct 2017 18:34:35 +0100 Subject: Add DISALLOW_CONFIG_DATE_TIME user restriction. Test: cts test for bug 67627542 in following cl Bug: 67497909 Follow design doc: https://docs.google.com/document/d/1NV93mr2CT157S_haru1QbKo9HLeP9iPM9eMiGfVmfCM/edit# Change-Id: Iee3c2fbf88b4958dde81330c2e4d60dfce09197f --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/java/android/os/UserManager.java | 17 +++++++++++++++++ .../com/android/server/pm/UserRestrictionsUtils.java | 2 ++ 5 files changed, 22 insertions(+) diff --git a/api/current.txt b/api/current.txt index 8b3c74088df5..d25f268cd92f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -31917,6 +31917,7 @@ package android.os { field public static final java.lang.String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth"; field public static final java.lang.String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts"; field public static final java.lang.String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials"; + field public static final java.lang.String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time"; field public static final java.lang.String DISALLOW_CONFIG_MOBILE_NETWORKS = "no_config_mobile_networks"; field public static final java.lang.String DISALLOW_CONFIG_TETHERING = "no_config_tethering"; field public static final java.lang.String DISALLOW_CONFIG_VPN = "no_config_vpn"; diff --git a/api/system-current.txt b/api/system-current.txt index ee23b6d92b71..8b7941c4b9b9 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -34766,6 +34766,7 @@ package android.os { field public static final java.lang.String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth"; field public static final java.lang.String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts"; field public static final java.lang.String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials"; + field public static final java.lang.String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time"; field public static final java.lang.String DISALLOW_CONFIG_MOBILE_NETWORKS = "no_config_mobile_networks"; field public static final java.lang.String DISALLOW_CONFIG_TETHERING = "no_config_tethering"; field public static final java.lang.String DISALLOW_CONFIG_VPN = "no_config_vpn"; diff --git a/api/test-current.txt b/api/test-current.txt index 9a241add0bdb..a904f089c845 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -32184,6 +32184,7 @@ package android.os { field public static final java.lang.String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth"; field public static final java.lang.String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts"; field public static final java.lang.String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials"; + field public static final java.lang.String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time"; field public static final java.lang.String DISALLOW_CONFIG_MOBILE_NETWORKS = "no_config_mobile_networks"; field public static final java.lang.String DISALLOW_CONFIG_TETHERING = "no_config_tethering"; field public static final java.lang.String DISALLOW_CONFIG_VPN = "no_config_vpn"; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 8c688713c9aa..c54b72d40387 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -318,6 +318,23 @@ public class UserManager { */ public static final String DISALLOW_CONFIG_VPN = "no_config_vpn"; + /** + * Specifies if date, time and timezone configuring is disallowed. + * + *

When restriction is set by device owners, it applies globally - i.e., it disables date, + * time and timezone setting on the entire device and all users will be affected. When it's set + * by profile owners, it's only applied to the managed user. + *

The default value is false. + * + *

This user restriction has no effect on managed profiles. + *

Key for user restrictions. + *

Type: Boolean + * @see DevicePolicyManager#addUserRestriction(ComponentName, String) + * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time"; + /** * Specifies if a user is disallowed from configuring Tethering * & portable hotspots. This can only be set by device owners and profile owners on the diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index c18a71d380e9..c86122f2507a 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -80,6 +80,7 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_REMOVE_MANAGED_PROFILE, UserManager.DISALLOW_DEBUGGING_FEATURES, UserManager.DISALLOW_CONFIG_VPN, + UserManager.DISALLOW_CONFIG_DATE_TIME, UserManager.DISALLOW_CONFIG_TETHERING, UserManager.DISALLOW_NETWORK_RESET, UserManager.DISALLOW_FACTORY_RESET, @@ -157,6 +158,7 @@ public class UserRestrictionsUtils { private static final Set GLOBAL_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_ADJUST_VOLUME, UserManager.DISALLOW_BLUETOOTH_SHARING, + UserManager.DISALLOW_CONFIG_DATE_TIME, UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS, UserManager.DISALLOW_RUN_IN_BACKGROUND, UserManager.DISALLOW_UNMUTE_MICROPHONE, -- cgit v1.2.3-59-g8ed1b