diff options
| author | 2021-11-30 03:53:34 +0000 | |
|---|---|---|
| committer | 2021-12-01 11:33:49 +0000 | |
| commit | 041914377d405e8d9fc337e7d78dd6738c93a7e8 (patch) | |
| tree | e2d3666fcf62c6ace8ee002ede86603612aeb13e | |
| parent | 22862fce98a81d3fda52aa3dda62156dda768db4 (diff) | |
Adding new user restrictions - DISALLOW_WIFI_DIRECT, DISALLOW_ADD_WIFI_CONFIG
Bug: 197558754
Test: atest UserRestrictionsTest
Change-Id: I9e626834afc238aa0c24f6aff25a7834d3faf9fa
| -rw-r--r-- | core/api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/os/UserManager.java | 39 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/UserRestrictionsUtils.java | 13 |
3 files changed, 50 insertions, 4 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index c0d313d17633..39d301ed1959 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -32352,6 +32352,7 @@ package android.os { field public static final String ALLOW_PARENT_PROFILE_APP_LINKING = "allow_parent_profile_app_linking"; field @Deprecated public static final String DISALLOW_ADD_MANAGED_PROFILE = "no_add_managed_profile"; field public static final String DISALLOW_ADD_USER = "no_add_user"; + field public static final String DISALLOW_ADD_WIFI_CONFIG = "no_add_wifi_config"; field public static final String DISALLOW_ADJUST_VOLUME = "no_adjust_volume"; field public static final String DISALLOW_AIRPLANE_MODE = "no_airplane_mode"; field public static final String DISALLOW_AMBIENT_DISPLAY = "no_ambient_display"; @@ -32407,6 +32408,7 @@ package android.os { field public static final String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone"; field public static final String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer"; field public static final String DISALLOW_USER_SWITCH = "no_user_switch"; + field public static final String DISALLOW_WIFI_DIRECT = "no_wifi_direct"; field public static final String DISALLOW_WIFI_TETHERING = "no_wifi_tethering"; field public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps"; field public static final String KEY_RESTRICTIONS_PENDING = "restrictions_pending"; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index bc6dbd8c098f..29d4d78c125d 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -327,6 +327,43 @@ public class UserManager { "no_sharing_admin_configured_wifi"; /** + * Specifies if a user is disallowed from using Wi-Fi Direct. + * + * <p>This restriction can only be set by a device owner, + * a profile owner of an organization-owned managed profile on the parent profile. + * When it is set by any of these owners, it prevents all users from using + * Wi-Fi Direct. + * + * <p>The default value is <code>false</code>. + * + * <p>Key for user restrictions. + * <p>Type: Boolean + * @see DevicePolicyManager#addUserRestriction(ComponentName, String) + * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_WIFI_DIRECT = "no_wifi_direct"; + + /** + * Specifies if a user is disallowed from adding a new Wi-Fi configuration. + * + * <p>This restriction can only be set by a device owner, + * a profile owner of an organization-owned managed profile on the parent profile. + * When it is set by any of these owners, it prevents all users from adding + * a new Wi-Fi configuration. This does not limit the owner and carrier's ability + * to add a new configuration. + * + * <p>The default value is <code>false</code>. + * + * <p>Key for user restrictions. + * <p>Type: Boolean + * @see DevicePolicyManager#addUserRestriction(ComponentName, String) + * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_ADD_WIFI_CONFIG = "no_add_wifi_config"; + + /** * Specifies if a user is disallowed from changing the device * language. The default value is <code>false</code>. * @@ -1500,6 +1537,8 @@ public class UserManager { DISALLOW_CHANGE_WIFI_STATE, DISALLOW_WIFI_TETHERING, DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI, + DISALLOW_WIFI_DIRECT, + DISALLOW_ADD_WIFI_CONFIG, }) @Retention(RetentionPolicy.SOURCE) public @interface UserRestrictionKey {} diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index 328a55f72976..0f3b4bcfac56 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -143,8 +143,9 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_CAMERA_TOGGLE, UserManager.DISALLOW_CHANGE_WIFI_STATE, UserManager.DISALLOW_WIFI_TETHERING, - UserManager.DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI - + UserManager.DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI, + UserManager.DISALLOW_WIFI_DIRECT, + UserManager.DISALLOW_ADD_WIFI_CONFIG }); public static final Set<String> DEPRECATED_USER_RESTRICTIONS = Sets.newArraySet( @@ -190,7 +191,9 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_MICROPHONE_TOGGLE, UserManager.DISALLOW_CAMERA_TOGGLE, UserManager.DISALLOW_CHANGE_WIFI_STATE, - UserManager.DISALLOW_WIFI_TETHERING + UserManager.DISALLOW_WIFI_TETHERING, + UserManager.DISALLOW_WIFI_DIRECT, + UserManager.DISALLOW_ADD_WIFI_CONFIG ); /** @@ -227,7 +230,9 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_CONFIG_DATE_TIME, UserManager.DISALLOW_CONFIG_PRIVATE_DNS, UserManager.DISALLOW_CHANGE_WIFI_STATE, - UserManager.DISALLOW_WIFI_TETHERING + UserManager.DISALLOW_WIFI_TETHERING, + UserManager.DISALLOW_WIFI_DIRECT, + UserManager.DISALLOW_ADD_WIFI_CONFIG ); /** |