1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bedstead.nene.userrestrictions;
18 
19 /** User restrictions helper methods common to host and device. */
20 public final class CommonUserRestrictions {
21 
CommonUserRestrictions()22     private CommonUserRestrictions() {}
23 
24     /** See {@code android.os.UserManager#DISALLOW_CONFIG_WIFI} */
25     public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";
26 
27     /** See {@code android.os.UserManager#DISALLOW_CONFIG_LOCALE} */
28     public static final String DISALLOW_CONFIG_LOCALE = "no_config_locale";
29 
30     /** See {@code android.os.UserManager#DISALLOW_MODIFY_ACCOUNTS} */
31     public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
32 
33     /** See {@code android.os.UserManager#DISALLOW_INSTALL_APPS} */
34     public static final String DISALLOW_INSTALL_APPS = "no_install_apps";
35 
36     /** See {@code android.os.UserManager#DISALLOW_UNINSTALL_APPS} */
37     public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
38 
39     /** See {@code android.os.UserManager#DISALLOW_SHARE_LOCATION} */
40     public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
41 
42     /** See {@code android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES} */
43     public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources";
44 
45     /** See {@code android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY} */
46     public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY =
47             "no_install_unknown_sources_globally";
48 
49     /** See {@code android.os.UserManager#DISALLOW_CONFIG_BLUETOOTH} */
50     public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
51 
52     /** See {@code android.os.UserManager#DISALLOW_BLUETOOTH} */
53     public static final String DISALLOW_BLUETOOTH = "no_bluetooth";
54 
55     /** See {@code android.os.UserManager#DISALLOW_BLUETOOTH_SHARING} */
56     public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing";
57 
58     /** See {@code android.os.UserManager#DISALLOW_USB_FILE_TRANSFER} */
59     public static final String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer";
60 
61     /** See {@code android.os.UserManager#DISALLOW_CONFIG_CREDENTIALS} */
62     public static final String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials";
63 
64     /** See {@code android.os.UserManager#DISALLOW_REMOVE_USER} */
65     public static final String DISALLOW_REMOVE_USER = "no_remove_user";
66 
67     /** See {@code android.os.UserManager#DISALLOW_REMOVE_MANAGED_PROFILE} */
68     public static final String DISALLOW_REMOVE_MANAGED_PROFILE = "no_remove_managed_profile";
69 
70     /** See {@code android.os.UserManager#DISALLOW_DEBUGGING_FEATURES} */
71     public static final String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features";
72 
73     /** See {@code android.os.UserManager#DISALLOW_CONFIG_VPN} */
74     public static final String DISALLOW_CONFIG_VPN = "no_config_vpn";
75 
76     /** See {@code android.os.UserManager#DISALLOW_CONFIG_DATE_TIME} */
77     public static final String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time";
78 
79     /** See {@code android.os.UserManager#DISALLOW_CONFIG_TETHERING} */
80     public static final String DISALLOW_CONFIG_TETHERING = "no_config_tethering";
81 
82     /** See {@code android.os.UserManager#DISALLOW_NETWORK_RESET} */
83     public static final String DISALLOW_NETWORK_RESET = "no_network_reset";
84 
85     /** See {@code android.os.UserManager#DISALLOW_FACTORY_RESET} */
86     public static final String DISALLOW_FACTORY_RESET = "no_factory_reset";
87 
88     /** See {@code android.os.UserManager#DISALLOW_ADD_USER} */
89     public static final String DISALLOW_ADD_USER = "no_add_user";
90 
91     /** See {@code android.os.UserManager#DISALLOW_ADD_MANAGED_PROFILE} */
92     public static final String DISALLOW_ADD_MANAGED_PROFILE = "no_add_managed_profile";
93 
94     /** See {@code android.os.UserManager#DISALLOW_ADD_CLONE_PROFILE} */
95     public static final String DISALLOW_ADD_CLONE_PROFILE = "no_add_clone_profile";
96 
97     /** See {@code android.os.UserManager#DISALLOW_ADD_PRIVATE_PROFILE} */
98     public static final String DISALLOW_ADD_PRIVATE_PROFILE = "no_add_private_profile";
99 
100     /** See {@code android.os.UserManager#ENSURE_VERIFY_APPS} */
101     public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps";
102 
103     /** See {@code android.os.UserManager#DISALLOW_CONFIG_CELL_BROADCASTS} */
104     public static final String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts";
105 
106     /** See {@code android.os.UserManager#DISALLOW_CONFIG_MOBILE_NETWORKS} */
107     public static final String DISALLOW_CONFIG_MOBILE_NETWORKS = "no_config_mobile_networks";
108 
109     /** See {@code android.os.UserManager#DISALLOW_APPS_CONTROL} */
110     public static final String DISALLOW_APPS_CONTROL = "no_control_apps";
111 
112     /** See {@code android.os.UserManager#DISALLOW_MOUNT_PHYSICAL_MEDIA} */
113     public static final String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media";
114 
115     /** See {@code android.os.UserManager#DISALLOW_UNMUTE_MICROPHONE} */
116     public static final String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone";
117 
118     /** See {@code android.os.UserManager#DISALLOW_ADJUST_VOLUME} */
119     public static final String DISALLOW_ADJUST_VOLUME = "no_adjust_volume";
120 
121     /** See {@code android.os.UserManager#DISALLOW_OUTGOING_CALLS} */
122     public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls";
123 
124     /** See {@code android.os.UserManager#DISALLOW_SMS} */
125     public static final String DISALLOW_SMS = "no_sms";
126 
127     /** See {@code android.os.UserManager#DISALLOW_FUN} */
128     public static final String DISALLOW_FUN = "no_fun";
129 
130     /** See {@code android.os.UserManager#DISALLOW_CREATE_WINDOWS} */
131     public static final String DISALLOW_CREATE_WINDOWS = "no_create_windows";
132 
133     /** See {@code android.os.UserManager#DISALLOW_SYSTEM_ERROR_DIALOGS} */
134     public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs";
135 
136     /** See {@code android.os.UserManager#DISALLOW_CROSS_PROFILE_COPY_PASTE} */
137     public static final String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
138 
139     /** See {@code android.os.UserManager#DISALLOW_OUTGOING_BEAM} */
140     public static final String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam";
141 
142     /** See {@code android.os.UserManager#DISALLOW_WALLPAPER} */
143     public static final String DISALLOW_WALLPAPER = "no_wallpaper";
144 
145     /** See {@code android.os.UserManager#DISALLOW_SET_WALLPAPER} */
146     public static final String DISALLOW_SET_WALLPAPER = "no_set_wallpaper";
147 
148     /** See {@code android.os.UserManager#DISALLOW_SAFE_BOOT} */
149     public static final String DISALLOW_SAFE_BOOT = "no_safe_boot";
150 
151     /** See {@code android.os.UserManager#DISALLOW_RECORD_AUDIO} */
152     public static final String DISALLOW_RECORD_AUDIO = "no_record_audio";
153 
154     /** See {@code android.os.UserManager#DISALLOW_RUN_IN_BACKGROUND} */
155     public static final String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
156 
157     /** See {@code android.os.UserManager#DISALLOW_CAMERA} */
158     public static final String DISALLOW_CAMERA = "no_camera";
159 
160     /** See {@code android.os.UserManager#DISALLOW_UNMUTE_DEVICE} */
161     public static final String DISALLOW_UNMUTE_DEVICE = "disallow_unmute_device";
162 
163     /** See {@code android.os.UserManager#DISALLOW_DATA_ROAMING} */
164     public static final String DISALLOW_DATA_ROAMING = "no_data_roaming";
165 
166     /** See {@code android.os.UserManager#DISALLOW_SET_USER_ICON} */
167     public static final String DISALLOW_SET_USER_ICON = "no_set_user_icon";
168 
169     /** See {@code android.os.UserManager#DISALLOW_OEM_UNLOCK} */
170     public static final String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
171 
172     /** See {@code android.os.UserManager#DISALLOW_UNIFIED_PASSWORD} */
173     public static final String DISALLOW_UNIFIED_PASSWORD = "no_unified_password";
174 
175     /** See {@code android.os.UserManager#ALLOW_PARENT_PROFILE_APP_LINKING} */
176     public static final String ALLOW_PARENT_PROFILE_APP_LINKING =
177             "allow_parent_profile_app_linking";
178 
179     /** See {@code android.os.UserManager#DISALLOW_AUTOFILL} */
180     public static final String DISALLOW_AUTOFILL = "no_autofill";
181 
182     /** See {@code android.os.UserManager#DISALLOW_CONTENT_CAPTURE} */
183     public static final String DISALLOW_CONTENT_CAPTURE = "no_content_capture";
184 
185     /** See {@code android.os.UserManager#DISALLOW_CONTENT_SUGGESTIONS} */
186     public static final String DISALLOW_CONTENT_SUGGESTIONS = "no_content_suggestions";
187 
188     /** See {@code android.os.UserManager#DISALLOW_USER_SWITCH} */
189     public static final String DISALLOW_USER_SWITCH = "no_user_switch";
190 
191     /** See {@code android.os.UserManager#DISALLOW_SHARE_INTO_MANAGED_PROFILE} */
192     public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile";
193 
194     /** See {@code android.os.UserManager#DISALLOW_PRINTING} */
195     public static final String DISALLOW_PRINTING = "no_printing";
196 
197     /** See {@code android.os.UserManager#DISALLOW_CONFIG_PRIVATE_DNS} */
198     public static final String DISALLOW_CONFIG_PRIVATE_DNS =
199             "disallow_config_private_dns";
200 
201     /** See {@code android.os.UserManager#DISALLOW_MICROPHONE_TOGGLE} */
202     public static final String DISALLOW_MICROPHONE_TOGGLE =
203             "disallow_microphone_toggle";
204 
205     /** See {@code android.os.UserManager#DISALLOW_CAMERA_TOGGLE} */
206     public static final String DISALLOW_CAMERA_TOGGLE =
207             "disallow_camera_toggle";
208 
209     /** See {@code android.os.UserManager#DISALLOW_BIOMETRIC} */
210     public static final String DISALLOW_BIOMETRIC = "disallow_biometric";
211 
212     /** See {@code android.os.UserManager#DISALLOW_CHANGE_WIFI_STATE} */
213     public static final String DISALLOW_CHANGE_WIFI_STATE = "no_change_wifi_state";
214 
215     /** See {@code android.os.UserManager#DISALLOW_WIFI_TETHERING} */
216     public static final String DISALLOW_WIFI_TETHERING = "no_wifi_tethering";
217 
218     /** See {@code android.os.UserManager#DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI} */
219     public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI =
220             "no_sharing_admin_configured_wifi";
221 
222     /** See {@code android.os.UserManager#DISALLOW_WIFI_DIRECT} */
223     public static final String DISALLOW_WIFI_DIRECT = "no_wifi_direct";
224 
225     /** See {@code android.os.UserManager#DISALLOW_ADD_WIFI_CONFIG} */
226     public static final String DISALLOW_ADD_WIFI_CONFIG = "no_add_wifi_config";
227 
228     /** See {@code android.os.UserManager#DISALLOW_CONFIG_LOCATION} */
229     public static final String DISALLOW_CONFIG_LOCATION = "no_config_location";
230 
231     /** See {@code android.os.UserManager#DISALLOW_AIRPLANE_MODE} */
232     public static final String DISALLOW_AIRPLANE_MODE = "no_airplane_mode";
233 
234     /** See {@code android.os.UserManager#DISALLOW_CONFIG_BRIGHTNESS} */
235     public static final String DISALLOW_CONFIG_BRIGHTNESS = "no_config_brightness";
236 
237     /** See {@code android.os.UserManager#DISALLOW_AMBIENT_DISPLAY} */
238     public static final String DISALLOW_AMBIENT_DISPLAY = "no_ambient_display";
239 
240     /** See {@code android.os.UserManager#DISALLOW_CONFIG_SCREEN_TIMEOUT} */
241     public static final String DISALLOW_CONFIG_SCREEN_TIMEOUT = "no_config_screen_timeout";
242 
243     /** See {@code android.os.UserManager#DISALLOW_CELLULAR_2G} */
244     public static final String DISALLOW_CELLULAR_2G = "no_cellular_2g";
245 
246     /** See {@code android.os.UserManager#DISALLOW_ULTRA_WIDEBAND_RADIO} */
247     public static final String DISALLOW_ULTRA_WIDEBAND_RADIO = "no_ultra_wideband_radio";
248 
249     /** See {@code android.os.UserManager#DISALLOW_CONFIG_DEFAULT_APPS} */
250     public static final String DISALLOW_CONFIG_DEFAULT_APPS = "disallow_config_default_apps";
251 
252     /** See {@code android.os.UserManager#DISALLOW_SIM_GLOBALLY} */
253     public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally";
254 
255     /** See {@code android.os.UserManager#DISALLOW_THREAD_NETWORK} */
256     public static final String DISALLOW_THREAD_NETWORK = "no_thread_network";
257 
258     /** See {@code Manifest#ACTION_USER_RESTRICTIONS_CHANGED} */
259     public static final String ACTION_USER_RESTRICTIONS_CHANGED =
260             "android.os.action.USER_RESTRICTIONS_CHANGED";
261 
262     /** Array of all user restrictions*/
263     public static final String[] ALL_USER_RESTRICTIONS = new String[] {
264             DISALLOW_CONFIG_WIFI,
265             DISALLOW_CONFIG_LOCALE,
266             DISALLOW_MODIFY_ACCOUNTS,
267             DISALLOW_INSTALL_APPS,
268             DISALLOW_UNINSTALL_APPS,
269             DISALLOW_SHARE_LOCATION,
270             DISALLOW_INSTALL_UNKNOWN_SOURCES,
271             DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY,
272             DISALLOW_CONFIG_BLUETOOTH,
273             DISALLOW_BLUETOOTH,
274             DISALLOW_BLUETOOTH_SHARING,
275             DISALLOW_USB_FILE_TRANSFER,
276             DISALLOW_CONFIG_CREDENTIALS,
277             DISALLOW_REMOVE_USER,
278             DISALLOW_REMOVE_MANAGED_PROFILE,
279             DISALLOW_DEBUGGING_FEATURES,
280             DISALLOW_CONFIG_VPN,
281             DISALLOW_CONFIG_DATE_TIME,
282             DISALLOW_CONFIG_TETHERING,
283             DISALLOW_NETWORK_RESET,
284             DISALLOW_FACTORY_RESET,
285             DISALLOW_ADD_USER,
286             DISALLOW_ADD_MANAGED_PROFILE,
287             DISALLOW_ADD_CLONE_PROFILE,
288             DISALLOW_ADD_PRIVATE_PROFILE,
289             ENSURE_VERIFY_APPS,
290             DISALLOW_CONFIG_CELL_BROADCASTS,
291             DISALLOW_CONFIG_MOBILE_NETWORKS,
292             DISALLOW_APPS_CONTROL,
293             DISALLOW_MOUNT_PHYSICAL_MEDIA,
294             DISALLOW_UNMUTE_MICROPHONE,
295             DISALLOW_ADJUST_VOLUME,
296             DISALLOW_OUTGOING_CALLS,
297             DISALLOW_SMS,
298             DISALLOW_FUN,
299             DISALLOW_CREATE_WINDOWS,
300             DISALLOW_SYSTEM_ERROR_DIALOGS,
301             DISALLOW_CROSS_PROFILE_COPY_PASTE,
302             DISALLOW_OUTGOING_BEAM,
303             DISALLOW_WALLPAPER,
304             DISALLOW_SAFE_BOOT,
305             ALLOW_PARENT_PROFILE_APP_LINKING,
306             DISALLOW_RECORD_AUDIO,
307             DISALLOW_CAMERA,
308             DISALLOW_RUN_IN_BACKGROUND,
309             DISALLOW_DATA_ROAMING,
310             DISALLOW_SET_USER_ICON,
311             DISALLOW_SET_WALLPAPER,
312             DISALLOW_OEM_UNLOCK,
313             DISALLOW_UNMUTE_DEVICE,
314             DISALLOW_AUTOFILL,
315             DISALLOW_CONTENT_CAPTURE,
316             DISALLOW_CONTENT_SUGGESTIONS,
317             DISALLOW_USER_SWITCH,
318             DISALLOW_UNIFIED_PASSWORD,
319             DISALLOW_CONFIG_LOCATION,
320             DISALLOW_AIRPLANE_MODE,
321             DISALLOW_CONFIG_BRIGHTNESS,
322             DISALLOW_SHARE_INTO_MANAGED_PROFILE,
323             DISALLOW_AMBIENT_DISPLAY,
324             DISALLOW_CONFIG_SCREEN_TIMEOUT,
325             DISALLOW_PRINTING,
326             DISALLOW_CONFIG_PRIVATE_DNS,
327             DISALLOW_MICROPHONE_TOGGLE,
328             DISALLOW_CAMERA_TOGGLE,
329             DISALLOW_CHANGE_WIFI_STATE,
330             DISALLOW_WIFI_TETHERING,
331             DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI,
332             DISALLOW_WIFI_DIRECT,
333             DISALLOW_ADD_WIFI_CONFIG,
334             DISALLOW_CELLULAR_2G,
335             DISALLOW_ULTRA_WIDEBAND_RADIO,
336             DISALLOW_CONFIG_DEFAULT_APPS,
337             DISALLOW_THREAD_NETWORK,
338     };
339 }
340