Adding new user restrictions - DISALLOW_WIFI_DIRECT, DISALLOW_ADD_WIFI_CONFIG

Bug: 197558754
Test: atest UserRestrictionsTest
Change-Id: I9e626834afc238aa0c24f6aff25a7834d3faf9fa
This commit is contained in:
Stephanie Bak
2021-11-30 03:53:34 +00:00
parent 22862fce98
commit 041914377d
3 changed files with 50 additions and 4 deletions

View File

@@ -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";

View File

@@ -326,6 +326,43 @@ public class UserManager {
public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI =
"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 {}

View File

@@ -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
);
/**