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.settings.intelligence.search.indexing; 18 19 import android.app.admin.DevicePolicyManager; 20 import android.content.Context; 21 import android.content.res.Resources; 22 import android.content.res.TypedArray; 23 24 import java.util.HashMap; 25 import java.util.Map; 26 27 // TODO(b/232188488): Remove once we switch to using FRROs. 28 public class DevicePolicyResourcesUtils { 29 30 public static String DEVICE_POLICY_RESOURCES_VERSION_KEY = "DEVICE_POLICY_RESOURCES_VERSION"; 31 32 private static Map<String, String> DEVICE_POLICY_RESOURCES = new HashMap<>(); 33 34 static { 35 DEVICE_POLICY_RESOURCES.put("security_settings_face_profile_preference_title", 36 "Settings.FACE_SETTINGS_FOR_WORK_TITLE"); 37 DEVICE_POLICY_RESOURCES.put("fingerprint_last_delete_message_profile_challenge", 38 "Settings.WORK_PROFILE_FINGERPRINT_LAST_DELETE_MESSAGE"); 39 DEVICE_POLICY_RESOURCES.put("lock_settings_picker_admin_restricted_personal_message", 40 "Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK"); 41 DEVICE_POLICY_RESOURCES.put("lock_settings_picker_profile_message", 42 "Settings.WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE"); 43 DEVICE_POLICY_RESOURCES.put("unlock_set_unlock_launch_picker_title_profile", 44 "Settings.WORK_PROFILE_SET_UNLOCK_LAUNCH_PICKER_TITLE"); 45 DEVICE_POLICY_RESOURCES.put("lock_last_pattern_attempt_before_wipe_profile", 46 "Settings.WORK_PROFILE_LAST_PATTERN_ATTEMPT_BEFORE_WIPE"); 47 DEVICE_POLICY_RESOURCES.put("lock_last_pin_attempt_before_wipe_profile", 48 "Settings.WORK_PROFILE_LAST_PIN_ATTEMPT_BEFORE_WIPE"); 49 DEVICE_POLICY_RESOURCES.put("lock_last_password_attempt_before_wipe_profile", 50 "Settings.WORK_PROFILE_LAST_PASSWORD_ATTEMPT_BEFORE_WIPE"); 51 DEVICE_POLICY_RESOURCES.put("lock_failed_attempts_now_wiping_profile", 52 "Settings.WORK_PROFILE_LOCK_ATTEMPTS_FAILED"); 53 DEVICE_POLICY_RESOURCES.put("accessibility_category_work", 54 "Settings.ACCESSIBILITY_CATEGORY_WORK"); 55 DEVICE_POLICY_RESOURCES.put("accessibility_category_personal", 56 "Settings.ACCESSIBILITY_CATEGORY_PERSONAL"); 57 DEVICE_POLICY_RESOURCES.put("accessibility_work_account_title", 58 "Settings.ACCESSIBILITY_WORK_ACCOUNT_TITLE"); 59 DEVICE_POLICY_RESOURCES.put("accessibility_personal_account_title", 60 "Settings.ACCESSIBILITY_PERSONAL_ACCOUNT_TITLE"); 61 DEVICE_POLICY_RESOURCES.put("managed_profile_location_switch_title", 62 "Settings.WORK_PROFILE_LOCATION_SWITCH_TITLE"); 63 DEVICE_POLICY_RESOURCES.put("lockpassword_choose_your_profile_password_header", 64 "Settings.SET_WORK_PROFILE_PASSWORD_HEADER"); 65 DEVICE_POLICY_RESOURCES.put("lockpassword_choose_your_profile_pin_header", 66 "Settings.SET_WORK_PROFILE_PIN_HEADER"); 67 DEVICE_POLICY_RESOURCES.put("lockpassword_choose_your_profile_pattern_header", 68 "Settings.SET_WORK_PROFILE_PATTERN_HEADER"); 69 DEVICE_POLICY_RESOURCES.put("lockpassword_reenter_your_profile_password_header", 70 "Settings.REENTER_WORK_PROFILE_PASSWORD_HEADER"); 71 DEVICE_POLICY_RESOURCES.put("lockpassword_confirm_your_work_password_header", 72 "Settings.CONFIRM_WORK_PROFILE_PASSWORD_HEADER"); 73 DEVICE_POLICY_RESOURCES.put("lockpassword_confirm_your_work_pattern_header", 74 "Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER"); 75 DEVICE_POLICY_RESOURCES.put("lockpassword_confirm_your_work_pin_header", 76 "Settings.CONFIRM_WORK_PROFILE_PIN_HEADER"); 77 DEVICE_POLICY_RESOURCES.put("lockpassword_reenter_your_profile_pin_header", 78 "Settings.REENTER_WORK_PROFILE_PIN_HEADER"); 79 DEVICE_POLICY_RESOURCES.put("lockpassword_strong_auth_required_work_pattern", 80 "Settings.WORK_PROFILE_PATTERN_REQUIRED"); 81 DEVICE_POLICY_RESOURCES.put("lockpassword_confirm_your_pattern_generic_profile", 82 "Settings.WORK_PROFILE_CONFIRM_PATTERN"); 83 DEVICE_POLICY_RESOURCES.put("lockpassword_strong_auth_required_work_pin", 84 "Settings.WORK_PROFILE_PIN_REQUIRED"); 85 DEVICE_POLICY_RESOURCES.put("lockpassword_strong_auth_required_work_password", 86 "Settings.WORK_PROFILE_PASSWORD_REQUIRED"); 87 DEVICE_POLICY_RESOURCES.put("lock_settings_profile_title", 88 "Settings.WORK_PROFILE_SECURITY_TITLE"); 89 DEVICE_POLICY_RESOURCES.put("lock_settings_profile_screen_lock_title", 90 "Settings.WORK_PROFILE_UNIFY_LOCKS_TITLE"); 91 DEVICE_POLICY_RESOURCES.put("lock_settings_profile_unification_summary", 92 "Settings.WORK_PROFILE_UNIFY_LOCKS_SUMMARY"); 93 DEVICE_POLICY_RESOURCES.put("lock_settings_profile_unification_dialog_body", 94 "Settings.WORK_PROFILE_UNIFY_LOCKS_DETAIL"); 95 DEVICE_POLICY_RESOURCES.put("lock_settings_profile_unification_dialog_uncompliant_body", 96 "Settings.WORK_PROFILE_UNIFY_LOCKS_NONCOMPLIANT"); 97 DEVICE_POLICY_RESOURCES.put("language_and_input_for_work_category_title", 98 "Settings.WORK_PROFILE_KEYBOARDS_AND_TOOLS"); 99 DEVICE_POLICY_RESOURCES.put("managed_profile_not_available_label", 100 "Settings.WORK_PROFILE_NOT_AVAILABLE"); 101 DEVICE_POLICY_RESOURCES.put("work_mode_label", "Settings.WORK_PROFILE_SETTING"); 102 DEVICE_POLICY_RESOURCES.put("work_mode_on_summary", 103 "Settings.WORK_PROFILE_SETTING_ON_SUMMARY"); 104 DEVICE_POLICY_RESOURCES.put("work_mode_off_summary", 105 "Settings.WORK_PROFILE_SETTING_OFF_SUMMARY"); 106 DEVICE_POLICY_RESOURCES.put("remove_managed_profile_label", "Settings.REMOVE_WORK_PROFILE"); 107 DEVICE_POLICY_RESOURCES.put("ssl_ca_cert_info_message_device_owner", 108 "Settings.DEVICE_OWNER_INSTALLED_CERTIFICATE_AUTHORITY_WARNING"); 109 DEVICE_POLICY_RESOURCES.put("ssl_ca_cert_info_message", 110 "Settings.WORK_PROFILE_INSTALLED_CERTIFICATE_AUTHORITY_WARNING"); 111 DEVICE_POLICY_RESOURCES.put("work_profile_confirm_remove_title", 112 "Settings.WORK_PROFILE_CONFIRM_REMOVE_TITLE"); 113 DEVICE_POLICY_RESOURCES.put("work_profile_confirm_remove_message", 114 "Settings.WORK_PROFILE_CONFIRM_REMOVE_MESSAGE"); 115 DEVICE_POLICY_RESOURCES.put("notification_settings_work_profile", 116 "Settings.WORK_APPS_CANNOT_ACCESS_NOTIFICATION_SETTINGS"); 117 DEVICE_POLICY_RESOURCES.put("sound_work_settings", 118 "Settings.WORK_PROFILE_SOUND_SETTINGS_SECTION_HEADER"); 119 DEVICE_POLICY_RESOURCES.put("work_use_personal_sounds_title", 120 "Settings.WORK_PROFILE_USE_PERSONAL_SOUNDS_TITLE"); 121 DEVICE_POLICY_RESOURCES.put("work_use_personal_sounds_summary", 122 "Settings.WORK_PROFILE_USE_PERSONAL_SOUNDS_SUMMARY"); 123 DEVICE_POLICY_RESOURCES.put("work_ringtone_title", "Settings.WORK_PROFILE_RINGTONE_TITLE"); 124 DEVICE_POLICY_RESOURCES.put("work_notification_ringtone_title", 125 "Settings.WORK_PROFILE_NOTIFICATION_RINGTONE_TITLE"); 126 DEVICE_POLICY_RESOURCES.put("work_alarm_ringtone_title", 127 "Settings.WORK_PROFILE_ALARM_RINGTONE_TITLE"); 128 DEVICE_POLICY_RESOURCES.put("work_sound_same_as_personal", 129 "Settings.WORK_PROFILE_SYNC_WITH_PERSONAL_SOUNDS_ACTIVE_SUMMARY"); 130 DEVICE_POLICY_RESOURCES.put("work_sync_dialog_title", 131 "Settings.ENABLE_WORK_PROFILE_SYNC_WITH_PERSONAL_SOUNDS_DIALOG_TITLE"); 132 DEVICE_POLICY_RESOURCES.put("work_sync_dialog_message", 133 "Settings.ENABLE_WORK_PROFILE_SYNC_WITH_PERSONAL_SOUNDS_DIALOG_MESSAGE"); 134 DEVICE_POLICY_RESOURCES.put("profile_section_header", 135 "Settings.WORK_PROFILE_NOTIFICATIONS_SECTION_HEADER"); 136 DEVICE_POLICY_RESOURCES.put("locked_work_profile_notification_title", 137 "Settings.WORK_PROFILE_LOCKED_NOTIFICATION_TITLE"); 138 DEVICE_POLICY_RESOURCES.put("lock_screen_notifs_redact_work", 139 "Settings.WORK_PROFILE_LOCK_SCREEN_REDACT_NOTIFICATION_TITLE"); 140 DEVICE_POLICY_RESOURCES.put("lock_screen_notifs_redact_work_summary", 141 "Settings.WORK_PROFILE_LOCK_SCREEN_REDACT_NOTIFICATION_SUMMARY"); 142 DEVICE_POLICY_RESOURCES.put("work_profile_notification_access_blocked_summary", 143 "Settings.WORK_PROFILE_NOTIFICATION_LISTENER_BLOCKED"); 144 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_title", 145 "Settings.CONNECTED_WORK_AND_PERSONAL_APPS_TITLE"); 146 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_summary_1", 147 "Settings.CONNECTED_APPS_SHARE_PERMISSIONS_AND_DATA"); 148 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_summary_2", 149 "Settings.ONLY_CONNECT_TRUSTED_APPS"); 150 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_summary_3", 151 "Settings.HOW_TO_DISCONNECT_APPS"); 152 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_consent_dialog_title", 153 "Settings.CONNECT_APPS_DIALOG_TITLE"); 154 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_consent_dialog_summary", 155 "Settings.CONNECT_APPS_DIALOG_SUMMARY"); 156 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_consent_dialog_app_data_summary", 157 "Settings.APP_CAN_ACCESS_PERSONAL_DATA"); 158 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_consent_dialog_permissions_summary", 159 "Settings.APP_CAN_ACCESS_PERSONAL_PERMISSIONS"); 160 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_install_work_app_title", 161 "Settings.INSTALL_IN_WORK_PROFILE_TO_CONNECT_PROMPT"); 162 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_install_personal_app_title", 163 "Settings.INSTALL_IN_PERSONAL_PROFILE_TO_CONNECT_PROMPT"); 164 DEVICE_POLICY_RESOURCES.put("opening_paragraph_delete_profile_unknown_company", 165 "Settings.WORK_PROFILE_MANAGED_BY"); 166 DEVICE_POLICY_RESOURCES.put("managing_admin", "Settings.MANAGED_BY"); 167 DEVICE_POLICY_RESOURCES.put("work_profile_usage_access_warning", 168 "Settings.WORK_PROFILE_DISABLE_USAGE_ACCESS_WARNING"); 169 DEVICE_POLICY_RESOURCES.put("disabled_by_policy_title", 170 "Settings.DISABLED_BY_IT_ADMIN_TITLE"); 171 DEVICE_POLICY_RESOURCES.put("default_admin_support_msg", "Settings.CONTACT_YOUR_IT_ADMIN"); 172 DEVICE_POLICY_RESOURCES.put("admin_profile_owner_message", 173 "Settings.WORK_PROFILE_ADMIN_POLICIES_WARNING"); 174 DEVICE_POLICY_RESOURCES.put("admin_profile_owner_user_message", 175 "Settings.USER_ADMIN_POLICIES_WARNING"); 176 DEVICE_POLICY_RESOURCES.put("admin_device_owner_message", 177 "Settings.DEVICE_ADMIN_POLICIES_WARNING"); 178 DEVICE_POLICY_RESOURCES.put("condition_work_title", 179 "Settings.WORK_PROFILE_OFF_CONDITION_TITLE"); 180 DEVICE_POLICY_RESOURCES.put("managed_profile_settings_title", 181 "Settings.MANAGED_PROFILE_SETTINGS_TITLE"); 182 DEVICE_POLICY_RESOURCES.put("managed_profile_contact_search_title", 183 "Settings.WORK_PROFILE_CONTACT_SEARCH_TITLE"); 184 DEVICE_POLICY_RESOURCES.put("managed_profile_contact_search_summary", 185 "Settings.WORK_PROFILE_CONTACT_SEARCH_SUMMARY"); 186 DEVICE_POLICY_RESOURCES.put("cross_profile_calendar_title", 187 "Settings.CROSS_PROFILE_CALENDAR_TITLE"); 188 DEVICE_POLICY_RESOURCES.put("cross_profile_calendar_summary", 189 "Settings.CROSS_PROFILE_CALENDAR_SUMMARY"); 190 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_always_on_vpn_personal", 191 "Settings.ALWAYS_ON_VPN_PERSONAL_PROFILE"); 192 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_always_on_vpn_device", 193 "Settings.ALWAYS_ON_VPN_DEVICE"); 194 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_always_on_vpn_work", 195 "Settings.ALWAYS_ON_VPN_WORK_PROFILE"); 196 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_ca_certs_personal", 197 "Settings.CA_CERTS_PERSONAL_PROFILE"); 198 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_ca_certs_work", 199 "Settings.CA_CERTS_WORK_PROFILE"); 200 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_ca_certs_device", 201 "Settings.CA_CERTS_DEVICE"); 202 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_lock_device", 203 "Settings.ADMIN_CAN_LOCK_DEVICE"); 204 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_wipe_device", 205 "Settings.ADMIN_CAN_WIPE_DEVICE"); 206 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_failed_password_wipe_device", 207 "Settings.ADMIN_CONFIGURED_FAILED_PASSWORD_WIPE_DEVICE"); 208 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_failed_password_wipe_work", 209 "Settings.ADMIN_CONFIGURED_FAILED_PASSWORD_WIPE_WORK_PROFILE"); 210 DEVICE_POLICY_RESOURCES.put("do_disclosure_generic", 211 "Settings.DEVICE_MANAGED_WITHOUT_NAME"); 212 DEVICE_POLICY_RESOURCES.put("do_disclosure_with_name", "Settings.DEVICE_MANAGED_WITH_NAME"); 213 DEVICE_POLICY_RESOURCES.put("work_profile_app_subtext", 214 "Settings.WORK_PROFILE_APP_SUBTEXT"); 215 DEVICE_POLICY_RESOURCES.put("personal_profile_app_subtext", 216 "Settings.PERSONAL_PROFILE_APP_SUBTEXT"); 217 DEVICE_POLICY_RESOURCES.put("security_settings_work_fingerprint_preference_title", 218 "Settings.FINGERPRINT_FOR_WORK"); 219 DEVICE_POLICY_RESOURCES.put( 220 "security_settings_face_enroll_introduction_message_unlock_disabled", 221 "Settings.FACE_UNLOCK_DISABLED"); 222 DEVICE_POLICY_RESOURCES.put( 223 "security_settings_fingerprint_enroll_introduction_message_unlock_disabled", 224 "Settings.FINGERPRINT_UNLOCK_DISABLED"); 225 DEVICE_POLICY_RESOURCES.put("security_fingerprint_disclaimer_lockscreen_disabled_1", 226 "Settings.FINGERPRINT_UNLOCK_DISABLED_EXPLANATION"); 227 DEVICE_POLICY_RESOURCES.put("lockpassword_pin_recently_used", "Settings.PIN_RECENTLY_USED"); 228 DEVICE_POLICY_RESOURCES.put("lockpassword_password_recently_used", 229 "Settings.PASSWORD_RECENTLY_USED"); 230 DEVICE_POLICY_RESOURCES.put("manage_device_admin", "Settings.MANAGE_DEVICE_ADMIN_APPS"); 231 DEVICE_POLICY_RESOURCES.put("number_of_device_admins_none", 232 "Settings.NUMBER_OF_DEVICE_ADMINS_NONE"); 233 DEVICE_POLICY_RESOURCES.put("number_of_device_admins", "Settings.NUMBER_OF_DEVICE_ADMINS"); 234 DEVICE_POLICY_RESOURCES.put("forgot_password_title", "Settings.FORGOT_PASSWORD_TITLE"); 235 DEVICE_POLICY_RESOURCES.put("forgot_password_text", "Settings.FORGOT_PASSWORD_TEXT"); 236 DEVICE_POLICY_RESOURCES.put("move_error_device_admin", "Settings.ERROR_MOVE_DEVICE_ADMIN"); 237 DEVICE_POLICY_RESOURCES.put("device_admin_settings_title", 238 "Settings.DEVICE_ADMIN_SETTINGS_TITLE"); 239 DEVICE_POLICY_RESOURCES.put("remove_device_admin", "Settings.REMOVE_DEVICE_ADMIN"); 240 DEVICE_POLICY_RESOURCES.put("uninstall_device_admin", "Settings.UNINSTALL_DEVICE_ADMIN"); 241 DEVICE_POLICY_RESOURCES.put("remove_and_uninstall_device_admin", 242 "Settings.REMOVE_AND_UNINSTALL_DEVICE_ADMIN"); 243 DEVICE_POLICY_RESOURCES.put("select_device_admin_msg", "Settings.SELECT_DEVICE_ADMIN_APPS"); 244 DEVICE_POLICY_RESOURCES.put("no_device_admins", "Settings.NO_DEVICE_ADMINS"); 245 DEVICE_POLICY_RESOURCES.put("add_device_admin_msg", "Settings.ACTIVATE_DEVICE_ADMIN_APP"); 246 DEVICE_POLICY_RESOURCES.put("add_device_admin", "Settings.ACTIVATE_THIS_DEVICE_ADMIN_APP"); 247 DEVICE_POLICY_RESOURCES.put("device_admin_add_title", 248 "Settings.ACTIVATE_DEVICE_ADMIN_APP_TITLE"); 249 DEVICE_POLICY_RESOURCES.put("device_admin_warning", "Settings.NEW_DEVICE_ADMIN_WARNING"); 250 DEVICE_POLICY_RESOURCES.put("device_admin_warning_simplified", 251 "Settings.NEW_DEVICE_ADMIN_WARNING_SIMPLIFIED"); 252 DEVICE_POLICY_RESOURCES.put("device_admin_status", "Settings.ACTIVE_DEVICE_ADMIN_WARNING"); 253 DEVICE_POLICY_RESOURCES.put("profile_owner_add_title", "Settings.SET_PROFILE_OWNER_TITLE"); 254 DEVICE_POLICY_RESOURCES.put("profile_owner_add_title_simplified", 255 "Settings.SET_PROFILE_OWNER_DIALOG_TITLE"); 256 DEVICE_POLICY_RESOURCES.put("adding_profile_owner_warning", 257 "Settings.SET_PROFILE_OWNER_POSTSETUP_WARNING"); 258 DEVICE_POLICY_RESOURCES.put("admin_disabled_other_options", 259 "Settings.OTHER_OPTIONS_DISABLED_BY_ADMIN"); 260 DEVICE_POLICY_RESOURCES.put("remove_account_failed", 261 "Settings.REMOVE_ACCOUNT_FAILED_ADMIN_RESTRICTION"); 262 DEVICE_POLICY_RESOURCES.put("help_url_action_disabled_by_it_admin", 263 "Settings.IT_ADMIN_POLICY_DISABLING_INFO_URL"); 264 DEVICE_POLICY_RESOURCES.put("share_remote_bugreport_dialog_title", 265 "Settings.SHARE_REMOTE_BUGREPORT_DIALOG_TITLE"); 266 DEVICE_POLICY_RESOURCES.put("share_remote_bugreport_dialog_message_finished", 267 "Settings.SHARE_REMOTE_BUGREPORT_FINISHED_REQUEST_CONSENT"); 268 DEVICE_POLICY_RESOURCES.put("share_remote_bugreport_dialog_message", 269 "Settings.SHARE_REMOTE_BUGREPORT_NOT_FINISHED_REQUEST_CONSENT"); 270 DEVICE_POLICY_RESOURCES.put("sharing_remote_bugreport_dialog_message", 271 "Settings.SHARING_REMOTE_BUGREPORT_MESSAGE"); 272 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_settings", "Settings.MANAGED_DEVICE_INFO"); 273 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_settings_summary_generic", 274 "Settings.MANAGED_DEVICE_INFO_SUMMARY"); 275 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_settings_summary_with_name", 276 "Settings.MANAGED_DEVICE_INFO_SUMMARY_WITH_NAME"); 277 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_header", 278 "Settings.ENTERPRISE_PRIVACY_HEADER"); 279 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_exposure_category", 280 "Settings.INFORMATION_YOUR_ORGANIZATION_CAN_SEE_TITLE"); 281 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_exposure_changes_category", 282 "Settings.CHANGES_MADE_BY_YOUR_ORGANIZATION_ADMIN_TITLE"); 283 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_device_access_category", 284 "Settings.YOUR_ACCESS_TO_THIS_DEVICE_TITLE"); 285 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_enterprise_data", 286 "Settings.ADMIN_CAN_SEE_WORK_DATA_WARNING"); 287 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_installed_packages", 288 "Settings.ADMIN_CAN_SEE_APPS_WARNING"); 289 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_usage_stats", 290 "Settings.ADMIN_CAN_SEE_USAGE_WARNING"); 291 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_network_logs", 292 "Settings.ADMIN_CAN_SEE_NETWORK_LOGS_WARNING"); 293 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_bug_reports", 294 "Settings.ADMIN_CAN_SEE_BUG_REPORT_WARNING"); 295 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_security_logs", 296 "Settings.ADMIN_CAN_SEE_SECURITY_LOGS_WARNING"); 297 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_none", "Settings.ADMIN_ACTION_NONE"); 298 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_enterprise_installed_packages", 299 "Settings.ADMIN_ACTION_APPS_INSTALLED"); 300 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_apps_count_estimation_info", 301 "Settings.ADMIN_ACTION_APPS_COUNT_ESTIMATED"); 302 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_number_packages_lower_bound", 303 "Settings.ADMIN_ACTIONS_APPS_COUNT_MINIMUM"); 304 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_location_access", 305 "Settings.ADMIN_ACTION_ACCESS_LOCATION"); 306 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_microphone_access", 307 "Settings.ADMIN_ACTION_ACCESS_MICROPHONE"); 308 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_camera_access", 309 "Settings.ADMIN_ACTION_ACCESS_CAMERA"); 310 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_enterprise_set_default_apps", 311 "Settings.ADMIN_ACTION_SET_DEFAULT_APPS"); 312 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_number_packages", 313 "Settings.ADMIN_ACTIONS_APPS_COUNT"); 314 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_input_method", 315 "Settings.ADMIN_ACTION_SET_CURRENT_INPUT_METHOD"); 316 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_input_method_name", 317 "Settings.ADMIN_ACTION_SET_INPUT_METHOD_NAME"); 318 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_global_http_proxy", 319 "Settings.ADMIN_ACTION_SET_HTTP_PROXY"); 320 DEVICE_POLICY_RESOURCES.put("work_policy_privacy_settings_summary", 321 "Settings.WORK_PROFILE_PRIVACY_POLICY_INFO_SUMMARY"); 322 DEVICE_POLICY_RESOURCES.put("work_policy_privacy_settings", 323 "Settings.WORK_PROFILE_PRIVACY_POLICY_INFO"); 324 DEVICE_POLICY_RESOURCES.put("interact_across_profiles_keywords", 325 "Settings.CONNECTED_APPS_SEARCH_KEYWORDS"); 326 DEVICE_POLICY_RESOURCES.put("keywords_unification", 327 "Settings.WORK_PROFILE_UNIFICATION_SEARCH_KEYWORDS"); 328 DEVICE_POLICY_RESOURCES.put("keywords_accounts", "Settings.ACCOUNTS_SEARCH_KEYWORDS"); 329 DEVICE_POLICY_RESOURCES.put("category_personal", "Settings.PERSONAL_CATEGORY_HEADER"); 330 DEVICE_POLICY_RESOURCES.put("lock_screen_notifications_summary_show_profile", 331 "Settings.LOCK_SCREEN_SHOW_WORK_NOTIFICATION_CONTENT"); 332 DEVICE_POLICY_RESOURCES.put("lock_screen_notifications_summary_hide_profile", 333 "Settings.LOCK_SCREEN_HIDE_WORK_NOTIFICATION_CONTENT"); 334 DEVICE_POLICY_RESOURCES.put("account_settings_menu_auto_sync_personal", 335 "Settings.AUTO_SYNC_PERSONAL_DATA"); 336 DEVICE_POLICY_RESOURCES.put("account_settings_menu_auto_sync_work", 337 "Settings.AUTO_SYNC_WORK_DATA"); 338 DEVICE_POLICY_RESOURCES.put("security_advanced_settings_work_profile_settings_summary", 339 "Settings.MORE_SECURITY_SETTINGS_WORK_PROFILE_SUMMARY"); 340 DEVICE_POLICY_RESOURCES.put("lock_settings_picker_new_profile_lock_title", 341 "Settings.LOCK_SETTINGS_NEW_PROFILE_LOCK_TITLE"); 342 DEVICE_POLICY_RESOURCES.put("lock_settings_picker_update_profile_lock_title", 343 "Settings.LOCK_SETTINGS_UPDATE_PROFILE_LOCK_TITLE"); 344 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_exposure_category", 345 "Settings.INFORMATION_SEEN_BY_ORGANIZATION_TITLE"); 346 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_exposure_changes_category", 347 "Settings.CHANGES_BY_ORGANIZATION_TITLE"); 348 DEVICE_POLICY_RESOURCES.put("enterprise_privacy_header", 349 "Settings.ENTERPRISE_PRIVACY_FOOTER"); 350 DEVICE_POLICY_RESOURCES.put("spellcheckers_settings_for_work_title", 351 "Settings.SPELL_CHECKER_FOR_WORK"); 352 DEVICE_POLICY_RESOURCES.put("user_dict_settings_for_work_title", 353 "Settings.PERSONAL_DICTIONARY_FOR_WORK"); 354 DEVICE_POLICY_RESOURCES.put("lock_settings_picker_admin_restricted_personal_message_action", 355 "Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION"); 356 DEVICE_POLICY_RESOURCES.put("disabled_by_admin_summary_text", 357 "Settings.CONTROLLED_BY_ADMIN_SUMMARY"); 358 DEVICE_POLICY_RESOURCES.put("managed_user_title", "Settings.WORK_PROFILE_USER_LABEL"); 359 DEVICE_POLICY_RESOURCES.put("category_work", "Settings.WORK_CATEGORY_HEADER"); 360 DEVICE_POLICY_RESOURCES.put("category_personal", "Settings.PERSONAL_CATEGORY_HEADER"); 361 DEVICE_POLICY_RESOURCES.put("disabled_by_admin", 362 "Settings.DISABLED_BY_ADMIN_SWITCH_SUMMARY"); 363 DEVICE_POLICY_RESOURCES.put("enabled_by_admin", "Settings.ENABLED_BY_ADMIN_SWITCH_SUMMARY"); 364 } 365 isDevicePolicyResource(Context context, int resId)366 public static boolean isDevicePolicyResource(Context context, int resId) { 367 try { 368 String resName = context.getResources().getResourceEntryName(resId); 369 return DEVICE_POLICY_RESOURCES.containsKey(resName); 370 } catch (Resources.NotFoundException e) { 371 return false; 372 } 373 } 374 isDevicePolicyResource( Context context, TypedArray typedArray, int resId)375 public static boolean isDevicePolicyResource( 376 Context context, TypedArray typedArray, int resId) { 377 try { 378 String resName = context.getResources().getResourceEntryName( 379 typedArray.getResourceId(resId, -1)); 380 return DEVICE_POLICY_RESOURCES.containsKey(resName); 381 } catch (Resources.NotFoundException e) { 382 return false; 383 } 384 } 385 getDevicePolicyResource(Context context, int resId)386 public static String getDevicePolicyResource(Context context, int resId) { 387 try { 388 String resName = context.getResources().getResourceEntryName(resId); 389 if (!DEVICE_POLICY_RESOURCES.containsKey(resName)) { 390 return context.getString(resId); 391 } 392 return context.getSystemService(DevicePolicyManager.class).getResources().getString( 393 DEVICE_POLICY_RESOURCES.get(resName), () -> context.getString(resId)); 394 } catch (Resources.NotFoundException e) { 395 return context.getString(resId); 396 } 397 } 398 getDevicePolicyResource( Context context, TypedArray typedArray, int resId)399 public static String getDevicePolicyResource( 400 Context context, TypedArray typedArray, int resId) { 401 try { 402 String resName = context.getResources().getResourceEntryName( 403 typedArray.getResourceId(resId, -1)); 404 if (!DEVICE_POLICY_RESOURCES.containsKey(resName)) { 405 return typedArray.getString(resId); 406 } 407 return context.getSystemService(DevicePolicyManager.class).getResources() 408 .getString(DEVICE_POLICY_RESOURCES.get(resName), () -> 409 typedArray.getString(resId)); 410 } catch (Resources.NotFoundException e) { 411 return typedArray.getString(resId); 412 } 413 } 414 } 415