diff --git a/core/api/current.txt b/core/api/current.txt index 803b76aef16ed..3bb40b98eb050 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -32393,6 +32393,7 @@ package android.os { field public static final String DISALLOW_SET_WALLPAPER = "no_set_wallpaper"; field public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile"; field public static final String DISALLOW_SHARE_LOCATION = "no_share_location"; + field public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI = "no_sharing_admin_configured_wifi"; field public static final String DISALLOW_SMS = "no_sms"; field public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; field public static final String DISALLOW_UNIFIED_PASSWORD = "no_unified_password"; diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index e7e0c040c34e9..79553e0681ff1 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -307,6 +307,25 @@ public class UserManager { */ public static final String DISALLOW_WIFI_TETHERING = "no_wifi_tethering"; + /** + * Specifies if users are disallowed from sharing Wi-Fi for admin configured networks. + * + *

Device owner and profile owner can set this restriction. + * When it is set by any of these owners, it prevents all users from + * sharing Wi-Fi for networks configured by these owners. + * Other networks not configured by these owners are not affected. + * + *

The default value is false. + * + *

Key for user restrictions. + *

Type: Boolean + * @see DevicePolicyManager#addUserRestriction(ComponentName, String) + * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) + * @see #getUserRestrictions() + */ + public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI = + "no_sharing_admin_configured_wifi"; + /** * Specifies if a user is disallowed from changing the device * language. The default value is false. @@ -1478,6 +1497,9 @@ public class UserManager { DISALLOW_CAMERA_TOGGLE, KEY_RESTRICTIONS_PENDING, DISALLOW_BIOMETRIC, + DISALLOW_CHANGE_WIFI_STATE, + DISALLOW_WIFI_TETHERING, + DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI, }) @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 7f4237410ea91..328a55f729766 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -142,7 +142,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_SHARING_ADMIN_CONFIGURED_WIFI + }); public static final Set DEPRECATED_USER_RESTRICTIONS = Sets.newArraySet(