summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stephanie Bak <dasol@google.com> 2021-12-08 19:23:07 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-12-08 19:23:07 +0000
commit47a5e94a41b2b1d1b494d50acfe2cf04c4dd36a3 (patch)
tree510f8f02b72eb690decc9c3f347945055f603c3f
parent9f3607350473640d870551815957352c2c9752a8 (diff)
parent041914377d405e8d9fc337e7d78dd6738c93a7e8 (diff)
Merge "Adding new user restrictions - DISALLOW_WIFI_DIRECT, DISALLOW_ADD_WIFI_CONFIG"
-rw-r--r--core/api/current.txt2
-rw-r--r--core/java/android/os/UserManager.java39
-rw-r--r--services/core/java/com/android/server/pm/UserRestrictionsUtils.java13
3 files changed, 50 insertions, 4 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 0a267d0ebc09..cc8b638d2e59 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -32503,6 +32503,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";
@@ -32558,6 +32559,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
);
/**