Skip to content

Commit c3a5db4

Browse files
author
Rubin Xu
committed
Add support for restrictions on sensor toggles
Add support for DISALLOW_CAMERA_TOGGLE and DISALLOW_MICROPHONE_TOGGLE. Bug: 184927615 Test: manual Change-Id: I8bd1b0d7424155bc890304d9b9ed82f514c96aeb
1 parent 6aae82b commit c3a5db4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/UserRestriction.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static android.os.UserManager.DISALLOW_AUTOFILL;
1111
import static android.os.UserManager.DISALLOW_BLUETOOTH;
1212
import static android.os.UserManager.DISALLOW_BLUETOOTH_SHARING;
13+
import static android.os.UserManager.DISALLOW_CAMERA_TOGGLE;
1314
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
1415
import static android.os.UserManager.DISALLOW_CONFIG_BRIGHTNESS;
1516
import static android.os.UserManager.DISALLOW_CONFIG_CELL_BROADCASTS;
@@ -34,6 +35,7 @@
3435
import static android.os.UserManager.DISALLOW_INSTALL_APPS;
3536
import static android.os.UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES;
3637
import static android.os.UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY;
38+
import static android.os.UserManager.DISALLOW_MICROPHONE_TOGGLE;
3739
import static android.os.UserManager.DISALLOW_MODIFY_ACCOUNTS;
3840
import static android.os.UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA;
3941
import static android.os.UserManager.DISALLOW_NETWORK_RESET;
@@ -56,6 +58,7 @@
5658
import static android.os.UserManager.DISALLOW_USER_SWITCH;
5759
import static android.os.UserManager.ENSURE_VERIFY_APPS;
5860

61+
import android.os.UserManager;
5962
import com.afwsamples.testdpc.R;
6063

6164
public class UserRestriction {
@@ -206,6 +209,10 @@ public UserRestriction(String key, int titleResId) {
206209
new UserRestriction(
207210
DISALLOW_CONFIG_PRIVATE_DNS,
208211
R.string.disallow_config_private_dns),
212+
new UserRestriction(DISALLOW_MICROPHONE_TOGGLE,
213+
R.string.disallow_microphone_toggle),
214+
new UserRestriction(DISALLOW_CAMERA_TOGGLE,
215+
R.string.disallow_camera_toggle),
209216
};
210217

211218
/**
@@ -256,7 +263,7 @@ public UserRestriction(String key, int titleResId) {
256263
new UserRestriction(DISALLOW_OUTGOING_CALLS,
257264
R.string.disallow_outgoing_calls),
258265
new UserRestriction(DISALLOW_UNMUTE_MICROPHONE,
259-
R.string.disallow_unmute_microphone),
266+
R.string.disallow_unmute_microphone)
260267
};
261268

262269
/**
@@ -293,7 +300,9 @@ public UserRestriction(String key, int titleResId) {
293300
* User restrictions that cannot be set by profile owners. Applied to all users.
294301
*/
295302
public static final String[] DEVICE_OWNER_ONLY_RESTRICTIONS = {
296-
DISALLOW_USER_SWITCH
303+
DISALLOW_USER_SWITCH,
304+
DISALLOW_MICROPHONE_TOGGLE,
305+
DISALLOW_CAMERA_TOGGLE,
297306
};
298307

299308
/**

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@
493493
<string name="disallow_uninstall_apps">Disallow uninstall apps</string>
494494
<string name="disallow_unmute_microphone">Disallow unmute microphone</string>
495495
<string name="disallow_usb_file_transfer">Disallow usb file transfer</string>
496+
<string name="disallow_microphone_toggle">Disallow microphone toggle</string>
497+
<string name="disallow_camera_toggle">Disallow camera toggle</string>
496498
<string name="ensure_verify_apps">Ensure verify apps</string>
497499
<string name="disallow_autofill">Disallow autofill</string>
498500
<string name="disallow_unified_password">Require separate challenge</string>

0 commit comments

Comments
 (0)