summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorEvan Severson <evanseverson@google.com>2021-04-20 21:49:35 -0700
committerRubin Xu <rubinxu@google.com>2021-05-18 23:22:38 +0100
commit6ab2d13922953916662e64f66de65e7eeb324f34 (patch)
tree42e8670f3ca7bc04f33b232cfaf4bdd2ad8c0d5b /core/java
parentbd5c79d216abcd92a0b233d425a7abe553432ab2 (diff)
Add device admin restrictions for mic/cam toggles
Introduces DISALLOW_CAMERA_TOGGLE and DISALLOW_MICROPHONE_TOGGLE which are Device Owner restrictions to prevent the user from turning off global camera & microphone access on a fully-managed device. Test: atest DeviceOwnerTest#testSensorToggleRestriction Test: atest UserRestrictionsTest Bug: 184927615 Change-Id: I500f1283689497812bd2df606e35abe6d9d91c61
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/UserManager.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 326012d7142a..224cd84bc777 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -1286,6 +1286,40 @@ public class UserManager {
"disallow_config_private_dns";
/**
+ * Specifies whether the microphone toggle is available to the user. If this restriction is set,
+ * the user will not be able to block microphone access via the system toggle. If microphone
+ * access is blocked when the restriction is added, it will be automatically re-enabled.
+ *
+ * This restriction can only be set by a device owner.
+ *
+ * <p>The default value is <code>false</code>.
+ *
+ * @see android.hardware.SensorPrivacyManager
+ * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+ * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_MICROPHONE_TOGGLE =
+ "disallow_microphone_toggle";
+
+ /**
+ * Specifies whether the camera toggle is available to the user. If this restriction is set,
+ * the user will not be able to block camera access via the system toggle. If camera
+ * access is blocked when the restriction is added, it will be automatically re-enabled.
+ *
+ * This restriction can only be set by a device owner.
+ *
+ * <p>The default value is <code>false</code>.
+ *
+ * @see android.hardware.SensorPrivacyManager
+ * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
+ * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
+ * @see #getUserRestrictions()
+ */
+ public static final String DISALLOW_CAMERA_TOGGLE =
+ "disallow_camera_toggle";
+
+ /**
* Application restriction key that is used to indicate the pending arrival
* of real restrictions for the app.
*
@@ -1376,6 +1410,8 @@ public class UserManager {
DISALLOW_SHARE_INTO_MANAGED_PROFILE,
DISALLOW_PRINTING,
DISALLOW_CONFIG_PRIVATE_DNS,
+ DISALLOW_MICROPHONE_TOGGLE,
+ DISALLOW_CAMERA_TOGGLE,
KEY_RESTRICTIONS_PENDING,
})
@Retention(RetentionPolicy.SOURCE)