1 /* 2 * Copyright (C) 2017 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 android.provider; 18 19 import static android.provider.settings.backup.DeviceSpecificSettings.DEVICE_SPECIFIC_SETTINGS_TO_BACKUP; 20 21 import static com.google.android.collect.Sets.newHashSet; 22 import static com.google.common.truth.Truth.assertWithMessage; 23 24 import static java.lang.reflect.Modifier.isFinal; 25 import static java.lang.reflect.Modifier.isPublic; 26 import static java.lang.reflect.Modifier.isStatic; 27 28 import android.platform.test.annotations.Presubmit; 29 import android.provider.settings.backup.GlobalSettings; 30 import android.provider.settings.backup.SecureSettings; 31 import android.provider.settings.backup.SystemSettings; 32 33 import androidx.test.filters.SmallTest; 34 import androidx.test.filters.Suppress; 35 import androidx.test.runner.AndroidJUnit4; 36 37 import org.junit.Test; 38 import org.junit.runner.RunWith; 39 40 import java.lang.reflect.Field; 41 import java.util.Collections; 42 import java.util.HashSet; 43 import java.util.Set; 44 45 /** Tests that ensure appropriate settings are backed up. */ 46 @Presubmit 47 @RunWith(AndroidJUnit4.class) 48 @SmallTest 49 public class SettingsBackupTest { 50 51 /** 52 * see {@link com.google.android.systemui.power.EnhancedEstimatesGoogleImpl} for more details 53 */ 54 public static final String HYBRID_SYSUI_BATTERY_WARNING_FLAGS = 55 "hybrid_sysui_battery_warning_flags"; 56 57 /** 58 * The following blacklists contain settings that should *not* be backed up and restored to 59 * another device. As a general rule, anything that is not user configurable should be 60 * blacklisted (and conversely, things that *are* user configurable *should* be backed up) 61 */ 62 private static final Set<String> BACKUP_BLACKLISTED_SYSTEM_SETTINGS = 63 newHashSet( 64 Settings.System.ADVANCED_SETTINGS, // candidate for backup? 65 Settings.System.ALARM_ALERT_CACHE, // internal cache 66 Settings.System.APPEND_FOR_LAST_AUDIBLE, // suffix deprecated since API 2 67 Settings.System.EGG_MODE, // I am the lolrus 68 Settings.System.END_BUTTON_BEHAVIOR, // bug? 69 Settings.System 70 .HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, // candidate for backup? 71 Settings.System.LOCKSCREEN_DISABLED, // ? 72 Settings.System.MEDIA_BUTTON_RECEIVER, // candidate for backup? 73 Settings.System.MUTE_STREAMS_AFFECTED, // candidate for backup? 74 Settings.System.NOTIFICATION_SOUND_CACHE, // internal cache 75 Settings.System.POINTER_LOCATION, // backup candidate? 76 Settings.System.DEBUG_ENABLE_ENHANCED_CALL_BLOCKING, // used for testing only 77 Settings.System.RINGTONE_CACHE, // internal cache 78 Settings.System.SCREEN_BRIGHTNESS, // removed in P 79 Settings.System.SETUP_WIZARD_HAS_RUN, // Only used by SuW 80 Settings.System.SHOW_GTALK_SERVICE_STATUS, // candidate for backup? 81 Settings.System.SHOW_TOUCHES, // bug? 82 Settings.System.SIP_ADDRESS_ONLY, // value, not a setting 83 Settings.System.SIP_ALWAYS, // value, not a setting 84 Settings.System.SYSTEM_LOCALES, // bug? 85 Settings.System.USER_ROTATION, // backup candidate? 86 Settings.System.VIBRATE_IN_SILENT, // deprecated? 87 Settings.System.VIBRATE_ON, // candidate for backup? 88 Settings.System.VOLUME_ACCESSIBILITY, // used internally, changing value will 89 // not change volume 90 Settings.System.VOLUME_ALARM, // deprecated since API 2? 91 Settings.System.VOLUME_ASSISTANT, // candidate for backup? 92 Settings.System.VOLUME_BLUETOOTH_SCO, // deprecated since API 2? 93 Settings.System.VOLUME_MASTER, // candidate for backup? 94 Settings.System.VOLUME_MUSIC, // deprecated since API 2? 95 Settings.System.VOLUME_NOTIFICATION, // deprecated since API 2? 96 Settings.System.VOLUME_RING, // deprecated since API 2? 97 Settings.System.VOLUME_SYSTEM, // deprecated since API 2? 98 Settings.System.VOLUME_VOICE, // deprecated since API 2? 99 Settings.System.WHEN_TO_MAKE_WIFI_CALLS, // bug? 100 Settings.System.WINDOW_ORIENTATION_LISTENER_LOG, // used for debugging only 101 Settings.System.MIN_REFRESH_RATE, // depends on hardware capabilities 102 Settings.System.PEAK_REFRESH_RATE, // depends on hardware capabilities 103 Settings.System.SCREEN_BRIGHTNESS_FLOAT, 104 Settings.System.SCREEN_BRIGHTNESS_FOR_VR_FLOAT, 105 Settings.System.MULTI_AUDIO_FOCUS_ENABLED // form-factor/OEM specific 106 ); 107 108 private static final Set<String> BACKUP_BLACKLISTED_GLOBAL_SETTINGS = 109 newHashSet( 110 Settings.Global.ACTIVITY_MANAGER_CONSTANTS, 111 Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED, 112 Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, 113 Settings.Global.ADB_ALLOWED_CONNECTION_TIME, 114 Settings.Global.ADB_ENABLED, 115 Settings.Global.ADB_WIFI_ENABLED, 116 Settings.Global.ADD_USERS_WHEN_LOCKED, 117 Settings.Global.AIRPLANE_MODE_ON, 118 Settings.Global.AIRPLANE_MODE_RADIOS, 119 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS, 120 Settings.Global.ALARM_MANAGER_CONSTANTS, 121 Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED, 122 Settings.Global.ALWAYS_FINISH_ACTIVITIES, 123 Settings.Global.ALWAYS_ON_DISPLAY_CONSTANTS, 124 Settings.Global.ANIMATOR_DURATION_SCALE, 125 Settings.Global.ANOMALY_DETECTION_CONSTANTS, 126 Settings.Global.ANOMALY_CONFIG, 127 Settings.Global.ANOMALY_CONFIG_VERSION, 128 Settings.Global.APN_DB_UPDATE_CONTENT_URL, 129 Settings.Global.APN_DB_UPDATE_METADATA_URL, 130 Settings.Global.APP_BINDING_CONSTANTS, 131 Settings.Global.APP_IDLE_CONSTANTS, 132 Settings.Global.APP_OPS_CONSTANTS, 133 Settings.Global.APP_STANDBY_ENABLED, 134 Settings.Global.APP_TIME_LIMIT_USAGE_SOURCE, 135 Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE, 136 Settings.Global.ASSISTED_GPS_ENABLED, 137 Settings.Global.AUDIO_SAFE_VOLUME_STATE, 138 Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES, 139 Settings.Global.AUTOFILL_LOGGING_LEVEL, 140 Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE, 141 Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS, 142 Settings.Global.AUTOMATIC_POWER_SAVE_MODE, 143 Settings.Global.AVERAGE_TIME_TO_DISCHARGE, 144 Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY, 145 Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME, 146 Settings.Global.BROADCAST_BG_CONSTANTS, 147 Settings.Global.BROADCAST_FG_CONSTANTS, 148 Settings.Global.BROADCAST_OFFLOAD_CONSTANTS, 149 Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD, 150 Settings.Global.BATTERY_DISCHARGE_THRESHOLD, 151 Settings.Global.BATTERY_SAVER_ADAPTIVE_DEVICE_SPECIFIC_CONSTANTS, 152 Settings.Global.BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS, 153 Settings.Global.BATTERY_STATS_CONSTANTS, 154 Settings.Global.BINDER_CALLS_STATS, 155 Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 156 Settings.Global.BLE_SCAN_LOW_POWER_WINDOW_MS, 157 Settings.Global.BLE_SCAN_LOW_POWER_INTERVAL_MS, 158 Settings.Global.BLE_SCAN_BALANCED_WINDOW_MS, 159 Settings.Global.BLE_SCAN_BALANCED_INTERVAL_MS, 160 Settings.Global.BLE_SCAN_LOW_LATENCY_WINDOW_MS, 161 Settings.Global.BLE_SCAN_LOW_LATENCY_INTERVAL_MS, 162 Settings.Global.BLE_SCAN_BACKGROUND_MODE, 163 Settings.Global.BLOCKED_SLICES, 164 Settings.Global.BLOCKING_HELPER_DISMISS_TO_VIEW_RATIO_LIMIT, 165 Settings.Global.BLOCKING_HELPER_STREAK_LIMIT, 166 Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE, 167 Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX, 168 Settings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX, 169 Settings.Global.BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX, 170 Settings.Global.BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX, 171 Settings.Global.BLUETOOTH_CLASS_OF_DEVICE, 172 Settings.Global.BLUETOOTH_DISABLED_PROFILES, 173 Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX, 174 Settings.Global.BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX, 175 Settings.Global.BLUETOOTH_INTEROPERABILITY_LIST, 176 Settings.Global.BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX, 177 Settings.Global.BLUETOOTH_MAP_PRIORITY_PREFIX, 178 Settings.Global.BLUETOOTH_PAN_PRIORITY_PREFIX, 179 Settings.Global.BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX, 180 Settings.Global.BLUETOOTH_SAP_PRIORITY_PREFIX, 181 Settings.Global.BLUETOOTH_HEARING_AID_PRIORITY_PREFIX, 182 Settings.Global.BOOT_COUNT, 183 Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL, 184 Settings.Global.CAPTIVE_PORTAL_HTTPS_URL, 185 Settings.Global.CAPTIVE_PORTAL_HTTP_URL, 186 Settings.Global.CAPTIVE_PORTAL_MODE, 187 Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS, 188 Settings.Global.CAPTIVE_PORTAL_FALLBACK_PROBE_SPECS, 189 Settings.Global.CAPTIVE_PORTAL_SERVER, 190 Settings.Global.CAPTIVE_PORTAL_USE_HTTPS, 191 Settings.Global.CAPTIVE_PORTAL_USER_AGENT, 192 Settings.Global.CAR_DOCK_SOUND, 193 Settings.Global.CARRIER_APP_WHITELIST, 194 Settings.Global.CARRIER_APP_NAMES, 195 Settings.Global.CAR_UNDOCK_SOUND, 196 Settings.Global.CDMA_CELL_BROADCAST_SMS, 197 Settings.Global.CDMA_ROAMING_MODE, 198 Settings.Global.CDMA_SUBSCRIPTION_MODE, 199 Settings.Global.CELL_ON, 200 Settings.Global.CERT_PIN_UPDATE_CONTENT_URL, 201 Settings.Global.CERT_PIN_UPDATE_METADATA_URL, 202 Settings.Global.COMPATIBILITY_MODE, 203 Settings.Global.CONNECTIVITY_CHANGE_DELAY, 204 Settings.Global.CONNECTIVITY_METRICS_BUFFER_SIZE, 205 Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS, 206 Settings.Global.CONTACT_METADATA_SYNC_ENABLED, 207 Settings.Global.CONVERSATION_ACTIONS_UPDATE_CONTENT_URL, 208 Settings.Global.CONVERSATION_ACTIONS_UPDATE_METADATA_URL, 209 Settings.Global.CONTACTS_DATABASE_WAL_ENABLED, 210 Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE, 211 Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI, 212 Settings.Global.DATABASE_CREATION_BUILDID, 213 Settings.Global.DATABASE_DOWNGRADE_REASON, 214 Settings.Global.DATA_ROAMING, 215 Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS, 216 Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS, 217 Settings.Global.DATA_STALL_RECOVERY_ON_BAD_NETWORK, 218 Settings.Global.DEBUG_APP, 219 Settings.Global.DEBUG_VIEW_ATTRIBUTES, 220 Settings.Global.DEBUG_VIEW_ATTRIBUTES_APPLICATION_PACKAGE, 221 Settings.Global.DEFAULT_DNS_SERVER, 222 Settings.Global.DEFAULT_INSTALL_LOCATION, 223 Settings.Global.DEFAULT_RESTRICT_BACKGROUND_DATA, 224 Settings.Global.DESK_DOCK_SOUND, 225 Settings.Global.DESK_UNDOCK_SOUND, 226 Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 227 Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, 228 Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, 229 Settings.Global.DEVELOPMENT_FORCE_RTL, 230 Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, 231 Settings.Global.DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR, 232 Settings.Global.DEVICE_DEMO_MODE, 233 Settings.Global.DEVICE_IDLE_CONSTANTS, 234 Settings.Global.BATTERY_SAVER_ADAPTIVE_CONSTANTS, 235 Settings.Global.BATTERY_SAVER_CONSTANTS, 236 Settings.Global.BATTERY_TIP_CONSTANTS, 237 Settings.Global.DEFAULT_SM_DP_PLUS, 238 Settings.Global.DEVICE_NAME, 239 Settings.Global.DEVICE_POLICY_CONSTANTS, 240 Settings.Global.DEVICE_PROVISIONED, 241 Settings.Global.DEVICE_PROVISIONING_MOBILE_DATA_ENABLED, 242 Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD, 243 Settings.Global.DISPLAY_PANEL_LPM, 244 Settings.Global.DISPLAY_SCALING_FORCE, 245 Settings.Global.DISPLAY_SIZE_FORCED, 246 Settings.Global.DNS_RESOLVER_MAX_SAMPLES, 247 Settings.Global.DNS_RESOLVER_MIN_SAMPLES, 248 Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS, 249 Settings.Global.DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT, 250 Settings.Global.DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY, 251 Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE, 252 Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE, 253 Settings.Global.DROPBOX_AGE_SECONDS, 254 Settings.Global.DROPBOX_MAX_FILES, 255 Settings.Global.DROPBOX_QUOTA_KB, 256 Settings.Global.DROPBOX_QUOTA_PERCENT, 257 Settings.Global.DROPBOX_RESERVE_PERCENT, 258 Settings.Global.DROPBOX_TAG_PREFIX, 259 Settings.Global.EMERGENCY_AFFORDANCE_NEEDED, 260 Settings.Global.EMULATE_DISPLAY_CUTOUT, 261 Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED, 262 Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION, 263 Settings.Global.ENABLE_CELLULAR_ON_BOOT, 264 Settings.Global.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE, 265 Settings.Global.ENABLE_DISKSTATS_LOGGING, 266 Settings.Global.ENABLE_EPHEMERAL_FEATURE, 267 Settings.Global.ENABLE_RESTRICTED_BUCKET, 268 Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED, 269 Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD, 270 Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS, 271 Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS, 272 Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT, 273 Settings.Global.ENHANCED_CONNECTIVITY_ENABLED, 274 Settings.Global.ENHANCED_4G_MODE_ENABLED, 275 Settings.Global.EPHEMERAL_COOKIE_MAX_SIZE_BYTES, 276 Settings.Global.ERROR_LOGCAT_PREFIX, 277 Settings.Global.EUICC_PROVISIONED, 278 Settings.Global.EUICC_SUPPORTED_COUNTRIES, 279 Settings.Global.EUICC_UNSUPPORTED_COUNTRIES, 280 Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS, 281 Settings.Global.EUICC_REMOVING_INVISIBLE_PROFILES_TIMEOUT_MILLIS, 282 Settings.Global.FANCY_IME_ANIMATIONS, 283 Settings.Global.FORCE_ALLOW_ON_EXTERNAL, 284 Settings.Global.FORCED_APP_STANDBY_ENABLED, 285 Settings.Global.FORCED_APP_STANDBY_FOR_SMALL_BATTERY_ENABLED, 286 Settings.Global.WIFI_ON_WHEN_PROXY_DISCONNECTED, 287 Settings.Global.FSTRIM_MANDATORY_INTERVAL, 288 Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED, 289 Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST, 290 Settings.Global.GLOBAL_HTTP_PROXY_HOST, 291 Settings.Global.GLOBAL_HTTP_PROXY_PAC, 292 Settings.Global.GLOBAL_HTTP_PROXY_PORT, 293 Settings.Global.GNSS_HAL_LOCATION_REQUEST_DURATION_MILLIS, 294 Settings.Global.GNSS_SATELLITE_BLACKLIST, 295 Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS, 296 Settings.Global.HDMI_CEC_SWITCH_ENABLED, 297 Settings.Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED, 298 Settings.Global.HDMI_CONTROL_AUTO_WAKEUP_ENABLED, 299 Settings.Global.HDMI_CONTROL_ENABLED, 300 Settings.Global.HDMI_CONTROL_VOLUME_CONTROL_ENABLED, 301 Settings.Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, 302 Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED, 303 Settings.Global.HIDDEN_API_POLICY, 304 Settings.Global.HIDE_ERROR_DIALOGS, 305 Settings.Global.HTTP_PROXY, 306 HYBRID_SYSUI_BATTERY_WARNING_FLAGS, 307 Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY, 308 Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY, 309 Settings.Global.INSTANT_APP_DEXOPT_ENABLED, 310 Settings.Global.INTENT_FIREWALL_UPDATE_CONTENT_URL, 311 Settings.Global.INTENT_FIREWALL_UPDATE_METADATA_URL, 312 Settings.Global.JOB_SCHEDULER_CONSTANTS, 313 Settings.Global.JOB_SCHEDULER_QUOTA_CONTROLLER_CONSTANTS, 314 Settings.Global.JOB_SCHEDULER_TIME_CONTROLLER_CONSTANTS, 315 Settings.Global.KEEP_PROFILE_IN_BACKGROUND, 316 Settings.Global.KERNEL_CPU_THREAD_READER, 317 Settings.Global.LANG_ID_UPDATE_CONTENT_URL, 318 Settings.Global.LANG_ID_UPDATE_METADATA_URL, 319 Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS, 320 Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS, 321 Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST, 322 Settings.Global.LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST, 323 Settings.Global.LOCATION_GLOBAL_KILL_SWITCH, 324 Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED, 325 Settings.Global.LOCK_SOUND, 326 Settings.Global.LOOPER_STATS, 327 Settings.Global.LOW_BATTERY_SOUND, 328 Settings.Global.LOW_BATTERY_SOUND_TIMEOUT, 329 Settings.Global.LOW_POWER_MODE, 330 Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX, 331 Settings.Global.LOW_POWER_MODE_STICKY, 332 Settings.Global.LOW_POWER_MODE_SUGGESTION_PARAMS, 333 Settings.Global.LTE_SERVICE_FORCED, 334 Settings.Global.LID_BEHAVIOR, 335 Settings.Global.MAX_ERROR_BYTES_PREFIX, 336 Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE, 337 Settings.Global.MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY, 338 Settings.Global.MDC_INITIAL_MAX_RETRY, 339 Settings.Global.MHL_INPUT_SWITCHING_ENABLED, 340 Settings.Global.MHL_POWER_CHARGE_ENABLED, 341 Settings.Global.MIN_DURATION_BETWEEN_RECOVERY_STEPS_IN_MS, 342 Settings.Global.MOBILE_DATA, // Candidate for backup? 343 Settings.Global.MOBILE_DATA_ALWAYS_ON, 344 Settings.Global.MODE_RINGER, 345 Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, 346 Settings.Global.MULTI_SIM_SMS_PROMPT, 347 Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION, 348 Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION, 349 Settings.Global.MULTI_SIM_VOICE_PROMPT, 350 Settings.Global.NATIVE_FLAGS_HEALTH_CHECK_ENABLED, 351 Settings.Global.NETSTATS_DEV_BUCKET_DURATION, 352 Settings.Global.NETSTATS_DEV_DELETE_AGE, 353 Settings.Global.NETSTATS_DEV_PERSIST_BYTES, 354 Settings.Global.NETSTATS_DEV_ROTATE_AGE, 355 Settings.Global.NETSTATS_ENABLED, 356 Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES, 357 Settings.Global.NETSTATS_POLL_INTERVAL, 358 Settings.Global.NETSTATS_SAMPLE_ENABLED, 359 Settings.Global.NETSTATS_AUGMENT_ENABLED, 360 Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED, 361 Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE, 362 Settings.Global.NETSTATS_UID_BUCKET_DURATION, 363 Settings.Global.NETSTATS_UID_DELETE_AGE, 364 Settings.Global.NETSTATS_UID_PERSIST_BYTES, 365 Settings.Global.NETSTATS_UID_ROTATE_AGE, 366 Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION, 367 Settings.Global.NETSTATS_UID_TAG_DELETE_AGE, 368 Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES, 369 Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE, 370 Settings.Global.NETPOLICY_QUOTA_ENABLED, 371 Settings.Global.NETPOLICY_QUOTA_UNLIMITED, 372 Settings.Global.NETPOLICY_QUOTA_LIMITED, 373 Settings.Global.NETPOLICY_QUOTA_FRAC_JOBS, 374 Settings.Global.NETPOLICY_QUOTA_FRAC_MULTIPATH, 375 Settings.Global.NETPOLICY_OVERRIDE_ENABLED, 376 Settings.Global.NETWORK_AVOID_BAD_WIFI, 377 Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES, 378 Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE, 379 Settings.Global.NETWORK_WATCHLIST_LAST_REPORT_TIME, 380 Settings.Global.NETWORK_PREFERENCE, 381 Settings.Global.NETWORK_RECOMMENDATIONS_PACKAGE, 382 Settings.Global.NETWORK_SCORER_APP, 383 Settings.Global.NETWORK_SCORING_PROVISIONED, 384 Settings.Global.NETWORK_SCORING_UI_ENABLED, 385 Settings.Global.NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT, 386 Settings.Global.NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS, 387 Settings.Global.NETWORK_WATCHLIST_ENABLED, 388 Settings.Global.NEW_CONTACT_AGGREGATOR, 389 Settings.Global.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE, 390 Settings.Global.NITZ_UPDATE_DIFF, 391 Settings.Global.NITZ_UPDATE_SPACING, 392 Settings.Global.NOTIFICATION_SNOOZE_OPTIONS, 393 Settings.Global.NR_NSA_TRACKING_SCREEN_OFF_MODE, 394 Settings.Global.NSD_ON, 395 Settings.Global.NTP_SERVER, 396 Settings.Global.NTP_TIMEOUT, 397 Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE, 398 Settings.Global.OVERLAY_DISPLAY_DEVICES, 399 Settings.Global.PAC_CHANGE_DELAY, 400 Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE, 401 Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 402 Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE, 403 Settings.Global.PACKAGE_VERIFIER_TIMEOUT, 404 Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT, 405 Settings.Global.PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS, 406 Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS, 407 Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT, 408 Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS, 409 Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT, 410 Settings.Global.POLICY_CONTROL, 411 Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE, 412 Settings.Global.POWER_MANAGER_CONSTANTS, 413 Settings.Global.PREFERRED_NETWORK_MODE, 414 Settings.Global.PRIVATE_DNS_DEFAULT_MODE, 415 Settings.Global.PROVISIONING_APN_ALARM_DELAY_IN_MS, 416 Settings.Global.RADIO_BLUETOOTH, 417 Settings.Global.RADIO_CELL, 418 Settings.Global.RADIO_NFC, 419 Settings.Global.RADIO_WIFI, 420 Settings.Global.RADIO_WIMAX, 421 Settings.Global.RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS, 422 Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT, 423 Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT, 424 Settings.Global.SAFE_BOOT_DISALLOWED, 425 Settings.Global.SELINUX_STATUS, 426 Settings.Global.SELINUX_UPDATE_CONTENT_URL, 427 Settings.Global.SELINUX_UPDATE_METADATA_URL, 428 Settings.Global.SEND_ACTION_APP_ERROR, 429 Settings.Global.SET_GLOBAL_HTTP_PROXY, 430 Settings.Global.SET_INSTALL_LOCATION, 431 Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL, 432 Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST, 433 Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL, 434 Settings.Global.SETTINGS_USE_EXTERNAL_PROVIDER_API, 435 Settings.Global.SETTINGS_USE_PSD_API, 436 Settings.Global.SHORTCUT_MANAGER_CONSTANTS, 437 Settings.Global.SHOW_FIRST_CRASH_DIALOG, 438 Settings.Global.SHOW_HIDDEN_LAUNCHER_ICON_APPS_ENABLED, 439 Settings.Global.SHOW_MUTE_IN_CRASH_DIALOG, 440 Settings.Global.SHOW_NEW_APP_INSTALLED_NOTIFICATION_ENABLED, 441 Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 442 Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG, 443 Settings.Global.SHOW_TEMPERATURE_WARNING, 444 Settings.Global.SHOW_USB_TEMPERATURE_ALARM, 445 Settings.Global.SIGNED_CONFIG_VERSION, 446 Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL, 447 Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL, 448 Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS, 449 Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT, 450 Settings.Global.SMS_SHORT_CODE_CONFIRMATION, 451 Settings.Global.SMS_SHORT_CODE_RULE, 452 Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL, 453 Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL, 454 Settings.Global.SOUND_TRIGGER_DETECTION_SERVICE_OP_TIMEOUT, 455 Settings.Global.SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS, 456 Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS, 457 Settings.Global.STORAGE_BENCHMARK_INTERVAL, 458 Settings.Global.STORAGE_SETTINGS_CLOBBER_THRESHOLD, 459 Settings.Global.SYNC_MANAGER_CONSTANTS, 460 Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS, 461 Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL, 462 Settings.Global.SYS_STORAGE_CACHE_MAX_BYTES, 463 Settings.Global.SYS_STORAGE_CACHE_PERCENTAGE, 464 Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES, 465 Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES, 466 Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE, 467 Settings.Global.SYS_VDSO, 468 Settings.Global.SYS_UIDCPUPOWER, 469 Settings.Global.SYS_TRACED, 470 Settings.Global.FPS_DEVISOR, 471 Settings.Global.TCP_DEFAULT_INIT_RWND, 472 Settings.Global.TETHER_DUN_APN, 473 Settings.Global.TETHER_DUN_REQUIRED, 474 Settings.Global.TETHER_OFFLOAD_DISABLED, 475 Settings.Global.TETHER_SUPPORTED, 476 Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER, 477 Settings.Global.TEXT_CLASSIFIER_CONSTANTS, 478 Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS, 479 Settings.Global.THEATER_MODE_ON, 480 Settings.Global.TIME_ONLY_MODE_CONSTANTS, 481 Settings.Global.TIME_REMAINING_ESTIMATE_MILLIS, 482 Settings.Global.TIME_REMAINING_ESTIMATE_BASED_ON_USAGE, 483 Settings.Global.TRANSITION_ANIMATION_SCALE, 484 Settings.Global.TRUSTED_SOUND, 485 Settings.Global.TZINFO_UPDATE_CONTENT_URL, 486 Settings.Global.TZINFO_UPDATE_METADATA_URL, 487 Settings.Global.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD, 488 Settings.Global.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD, 489 Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD, 490 Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD, 491 Settings.Global.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD, 492 Settings.Global.UNGAZE_SLEEP_ENABLED, 493 Settings.Global.UNLOCK_SOUND, 494 Settings.Global.USE_GOOGLE_MAIL, 495 Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED, 496 Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED, 497 Settings.Global.VT_IMS_ENABLED, 498 Settings.Global.WAIT_FOR_DEBUGGER, 499 Settings.Global.ENABLE_GPU_DEBUG_LAYERS, 500 Settings.Global.GPU_DEBUG_APP, 501 Settings.Global.GPU_DEBUG_LAYERS, 502 Settings.Global.GPU_DEBUG_LAYERS_GLES, 503 Settings.Global.GLOBAL_SETTINGS_ANGLE_DEBUG_PACKAGE, 504 Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_ALL_ANGLE, 505 Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_PKGS, 506 Settings.Global.GLOBAL_SETTINGS_ANGLE_GL_DRIVER_SELECTION_VALUES, 507 Settings.Global.GLOBAL_SETTINGS_ANGLE_WHITELIST, 508 Settings.Global.GAME_DRIVER_ALL_APPS, 509 Settings.Global.GAME_DRIVER_OPT_IN_APPS, 510 Settings.Global.GAME_DRIVER_PRERELEASE_OPT_IN_APPS, 511 Settings.Global.GAME_DRIVER_OPT_OUT_APPS, 512 Settings.Global.GAME_DRIVER_BLACKLISTS, 513 Settings.Global.GAME_DRIVER_BLACKLIST, 514 Settings.Global.GAME_DRIVER_WHITELIST, 515 Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, 516 Settings.Global.GLOBAL_SETTINGS_SHOW_ANGLE_IN_USE_DIALOG_BOX, 517 Settings.Global.GPU_DEBUG_LAYER_APP, 518 Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING, 519 Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT, 520 Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS, 521 Settings.Global.USER_SWITCHER_ENABLED, 522 Settings.Global.NETWORK_ACCESS_TIMEOUT_MS, 523 Settings.Global.WARNING_TEMPERATURE, 524 Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY, 525 Settings.Global.WEBVIEW_FALLBACK_LOGIC_ENABLED, 526 Settings.Global.WEBVIEW_MULTIPROCESS, 527 Settings.Global.WEBVIEW_PROVIDER, 528 Settings.Global.WFC_IMS_ENABLED, 529 Settings.Global.WFC_IMS_MODE, 530 Settings.Global.WFC_IMS_ROAMING_ENABLED, 531 Settings.Global.WFC_IMS_ROAMING_MODE, 532 Settings.Global.WIFI_ALWAYS_REQUESTED, 533 Settings.Global.WIFI_BADGING_THRESHOLDS, 534 Settings.Global.WIFI_BOUNCE_DELAY_OVERRIDE_MS, 535 Settings.Global.WIFI_COUNTRY_CODE, 536 Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN, 537 Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 538 Settings.Global.WIFI_DISPLAY_ON, 539 Settings.Global.WIFI_DISPLAY_WPS_CONFIG, 540 Settings.Global.WIFI_ENHANCED_AUTO_JOIN, 541 Settings.Global.WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS, 542 Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS, 543 Settings.Global.WIFI_FREQUENCY_BAND, 544 Settings.Global.WIFI_IDLE_MS, 545 Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT, 546 Settings.Global.WIFI_MIGRATION_COMPLETED, 547 Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS, 548 Settings.Global.WIFI_NETWORK_SHOW_RSSI, 549 Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 550 Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT, 551 Settings.Global.WIFI_ON, 552 Settings.Global.WIFI_P2P_DEVICE_NAME, 553 Settings.Global.WIFI_P2P_PENDING_FACTORY_RESET, 554 Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 555 Settings.Global.WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS, 556 Settings.Global.WIFI_SCAN_THROTTLE_ENABLED, 557 Settings.Global.WIFI_SCORE_PARAMS, 558 Settings.Global.WIFI_SLEEP_POLICY, 559 Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS, 560 Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, 561 Settings.Global.WIFI_WATCHDOG_ON, 562 Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON, 563 Settings.Global.CHARGING_STARTED_SOUND, 564 Settings.Global.WIRELESS_CHARGING_STARTED_SOUND, 565 Settings.Global.WINDOW_ANIMATION_SCALE, 566 Settings.Global.WTF_IS_FATAL, 567 Settings.Global.ZEN_MODE, 568 Settings.Global.ZEN_MODE_CONFIG_ETAG, 569 Settings.Global.ZEN_MODE_RINGER_LEVEL, 570 Settings.Global.ZRAM_ENABLED, 571 Settings.Global.OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION, 572 Settings.Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED, 573 Settings.Global.HIDDEN_API_BLACKLIST_EXEMPTIONS, 574 Settings.Global.BACKUP_AGENT_TIMEOUT_PARAMETERS, 575 Settings.Global.ISOLATED_STORAGE_LOCAL, 576 Settings.Global.ISOLATED_STORAGE_REMOTE, 577 Settings.Global.APPOP_HISTORY_PARAMETERS, 578 Settings.Global.APPOP_HISTORY_MODE, 579 Settings.Global.APPOP_HISTORY_INTERVAL_MULTIPLIER, 580 Settings.Global.APPOP_HISTORY_BASE_INTERVAL_MILLIS, 581 Settings.Global.AUTO_REVOKE_PARAMETERS, 582 Settings.Global.ENABLE_RADIO_BUG_DETECTION, 583 Settings.Global.RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD, 584 Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD, 585 Settings.Global.ENABLED_SUBSCRIPTION_FOR_SLOT, 586 Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT, 587 Settings.Global.POWER_BUTTON_LONG_PRESS, 588 Settings.Global.POWER_BUTTON_VERY_LONG_PRESS, 589 Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, // Temporary for R beta 590 Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER, 591 Settings.Global.CACHED_APPS_FREEZER_ENABLED, 592 Settings.Global.APP_INTEGRITY_VERIFICATION_TIMEOUT, 593 Settings.Global.ADVANCED_BATTERY_USAGE_AMOUNT); 594 595 private static final Set<String> BACKUP_BLACKLISTED_SECURE_SETTINGS = 596 newHashSet( 597 Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE, 598 Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, // Deprecated since O. 599 Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS, 600 Settings.Secure.ALWAYS_ON_VPN_APP, 601 Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN, 602 Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST, 603 Settings.Secure.ANDROID_ID, 604 Settings.Secure.ANR_SHOW_BACKGROUND, 605 Settings.Secure.ASSISTANT, 606 Settings.Secure.ASSIST_DISCLOSURE_ENABLED, 607 Settings.Secure.ASSIST_GESTURE_ENABLED, 608 Settings.Secure.ASSIST_GESTURE_SENSITIVITY, 609 Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED, 610 Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, 611 Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE, 612 Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 613 Settings.Secure.ASSIST_STRUCTURE_ENABLED, 614 Settings.Secure.ATTENTIVE_TIMEOUT, 615 Settings.Secure.AUTOFILL_FEATURE_FIELD_CLASSIFICATION, 616 Settings.Secure.AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT, 617 Settings.Secure.AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE, 618 Settings.Secure.AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE, 619 Settings.Secure.AUTOFILL_USER_DATA_MAX_VALUE_LENGTH, 620 Settings.Secure.AUTOFILL_USER_DATA_MIN_VALUE_LENGTH, 621 Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI, 622 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED, 623 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 624 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN, 625 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY, 626 Settings.Secure.BACKUP_AUTO_RESTORE, 627 Settings.Secure.BACKUP_ENABLED, 628 Settings.Secure.BACKUP_PROVISIONED, 629 Settings.Secure.BACKUP_TRANSPORT, 630 Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT, 631 Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup? 632 Settings.Secure.CARRIER_APPS_HANDLED, 633 Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG, 634 Settings.Secure.COMPLETED_CATEGORY_PREFIX, 635 Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS, 636 Settings.Secure.CONTENT_CAPTURE_ENABLED, 637 Settings.Secure.DEFAULT_INPUT_METHOD, 638 Settings.Secure.DEVICE_PAIRED, 639 Settings.Secure.DIALER_DEFAULT_APPLICATION, 640 Settings.Secure.DISABLED_PRINT_SERVICES, 641 Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS, 642 Settings.Secure.DOCKED_CLOCK_FACE, 643 Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, 644 Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, 645 Settings.Secure.ENABLED_INPUT_METHODS, // Intentionally removed in P 646 Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT, 647 Settings.Secure.ENABLED_NOTIFICATION_LISTENERS, 648 Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES, 649 Settings.Secure.ENABLED_PRINT_SERVICES, 650 Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE, 651 Settings.Secure.GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED, 652 Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, 653 Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR, 654 Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY, 655 Settings.Secure.INPUT_METHODS_SUBTYPE_HISTORY, 656 Settings.Secure.INSTALL_NON_MARKET_APPS, 657 Settings.Secure.LAST_SETUP_SHOWN, 658 Settings.Secure.LOCATION_CHANGER, 659 Settings.Secure.LOCATION_MODE, 660 Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE, 661 Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, // Candidate? 662 Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT, 663 Settings.Secure.LOCK_TO_APP_EXIT_LOCKED, 664 Settings.Secure.MANAGED_PROFILE_CONTACT_REMOTE_SEARCH, 665 Settings.Secure.MULTI_PRESS_TIMEOUT, 666 Settings.Secure.NFC_PAYMENT_FOREGROUND, 667 Settings.Secure.NIGHT_DISPLAY_ACTIVATED, 668 Settings.Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME, 669 Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED, 670 Settings.Secure.ODI_CAPTIONS_ENABLED, 671 Settings.Secure.PARENTAL_CONTROL_LAST_UPDATE, 672 Settings.Secure.PAYMENT_SERVICE_SEARCH_URI, 673 Settings.Secure.PRINT_SERVICE_SEARCH_URI, 674 Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT, // Candidate? 675 Settings.Secure.SEARCH_GLOBAL_SEARCH_ACTIVITY, 676 Settings.Secure.SEARCH_MAX_RESULTS_PER_SOURCE, 677 Settings.Secure.SEARCH_MAX_RESULTS_TO_DISPLAY, 678 Settings.Secure.SEARCH_MAX_SHORTCUTS_RETURNED, 679 Settings.Secure.SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS, 680 Settings.Secure.SEARCH_MAX_STAT_AGE_MILLIS, 681 Settings.Secure.SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING, 682 Settings.Secure.SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING, 683 Settings.Secure.SEARCH_NUM_PROMOTED_SOURCES, 684 Settings.Secure.SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT, 685 Settings.Secure.SEARCH_PREFILL_MILLIS, 686 Settings.Secure.SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS, 687 Settings.Secure.SEARCH_QUERY_THREAD_CORE_POOL_SIZE, 688 Settings.Secure.SEARCH_QUERY_THREAD_MAX_POOL_SIZE, 689 Settings.Secure.SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE, 690 Settings.Secure.SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE, 691 Settings.Secure.SEARCH_SOURCE_TIMEOUT_MILLIS, 692 Settings.Secure.SEARCH_THREAD_KEEPALIVE_SECONDS, 693 Settings.Secure.SECURE_FRP_MODE, 694 Settings.Secure.SEARCH_WEB_RESULTS_OVERRIDE_LIMIT, 695 Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, 696 Settings.Secure.SELECTED_SPELL_CHECKER, // Intentionally removed in Q 697 Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE, // Intentionally removed in Q 698 Settings.Secure.SETTINGS_CLASSNAME, 699 Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, // candidate? 700 Settings.Secure.SHOW_ROTATION_SUGGESTIONS, 701 Settings.Secure.SKIP_FIRST_USE_HINTS, // candidate? 702 Settings.Secure.SLEEP_TIMEOUT, 703 Settings.Secure.SMS_DEFAULT_APPLICATION, 704 Settings.Secure.SPELL_CHECKER_ENABLED, // Intentionally removed in Q 705 Settings.Secure.TRUST_AGENTS_INITIALIZED, 706 Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS, 707 Settings.Secure.TV_INPUT_CUSTOM_LABELS, 708 Settings.Secure.TV_INPUT_HIDDEN_INPUTS, 709 Settings.Secure.TV_USER_SETUP_COMPLETE, 710 Settings.Secure.UNKNOWN_SOURCES_DEFAULT_REVERSED, 711 Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS, 712 Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 713 Settings.Secure.USER_SETUP_COMPLETE, 714 Settings.Secure.USER_SETUP_PERSONALIZATION_STATE, 715 Settings.Secure.VOICE_INTERACTION_SERVICE, 716 Settings.Secure.VOICE_RECOGNITION_SERVICE, 717 Settings.Secure.INSTANT_APPS_ENABLED, 718 Settings.Secure.BACKUP_MANAGER_CONSTANTS, 719 Settings.Secure.BACKUP_LOCAL_TRANSPORT_PARAMETERS, 720 Settings.Secure.KEYGUARD_SLICE_URI, 721 Settings.Secure.PARENTAL_CONTROL_ENABLED, 722 Settings.Secure.PARENTAL_CONTROL_REDIRECT_URL, 723 Settings.Secure.BLUETOOTH_ON_WHILE_DRIVING, 724 Settings.Secure.LOW_POWER_MANUAL_ACTIVATION_COUNT, 725 Settings.Secure.LOW_POWER_WARNING_ACKNOWLEDGED, 726 Settings.Secure.SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION, 727 Settings.Secure.PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE, 728 Settings.Secure.FLASHLIGHT_AVAILABLE, 729 Settings.Secure.FLASHLIGHT_ENABLED, 730 Settings.Secure.CROSS_PROFILE_CALENDAR_ENABLED, 731 Settings.Secure.LOCATION_ACCESS_CHECK_INTERVAL_MILLIS, 732 Settings.Secure.LOCATION_ACCESS_CHECK_DELAY_MILLIS, 733 Settings.Secure.BIOMETRIC_DEBUG_ENABLED, 734 Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED, 735 Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED, 736 Settings.Secure.MANAGED_PROVISIONING_DPC_DOWNLOADED, 737 Settings.Secure.AWARE_ENABLED, 738 Settings.Secure.SKIP_GESTURE, 739 Settings.Secure.SILENCE_GESTURE, 740 Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE, 741 Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE, 742 Settings.Secure.FACE_UNLOCK_RE_ENROLL, 743 Settings.Secure.TAP_GESTURE, 744 Settings.Secure.NEARBY_SHARING_COMPONENT, // not user configurable 745 Settings.Secure.WINDOW_MAGNIFICATION, 746 Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_MAGNIFICATION_CONTROLLER, 747 Settings.Secure.SUPPRESS_DOZE); 748 749 @Test systemSettingsBackedUpOrBlacklisted()750 public void systemSettingsBackedUpOrBlacklisted() { 751 checkSettingsBackedUpOrBlacklisted( 752 getCandidateSettings(Settings.System.class), 753 newHashSet(SystemSettings.SETTINGS_TO_BACKUP), 754 BACKUP_BLACKLISTED_SYSTEM_SETTINGS); 755 } 756 757 @Test globalSettingsBackedUpOrBlacklisted()758 public void globalSettingsBackedUpOrBlacklisted() { 759 checkSettingsBackedUpOrBlacklisted( 760 getCandidateSettings(Settings.Global.class), 761 newHashSet(GlobalSettings.SETTINGS_TO_BACKUP), 762 BACKUP_BLACKLISTED_GLOBAL_SETTINGS); 763 } 764 765 @Test 766 @Suppress //("b/148236308") secureSettingsBackedUpOrBlacklisted()767 public void secureSettingsBackedUpOrBlacklisted() { 768 HashSet<String> keys = new HashSet<String>(); 769 Collections.addAll(keys, SecureSettings.SETTINGS_TO_BACKUP); 770 Collections.addAll(keys, DEVICE_SPECIFIC_SETTINGS_TO_BACKUP); 771 checkSettingsBackedUpOrBlacklisted( 772 getCandidateSettings(Settings.Secure.class), 773 keys, 774 BACKUP_BLACKLISTED_SECURE_SETTINGS); 775 } 776 checkSettingsBackedUpOrBlacklisted( Set<String> settings, Set<String> settingsToBackup, Set<String> blacklist)777 private static void checkSettingsBackedUpOrBlacklisted( 778 Set<String> settings, Set<String> settingsToBackup, Set<String> blacklist) { 779 Set<String> settingsNotBackedUp = difference(settings, settingsToBackup); 780 Set<String> settingsNotBackedUpOrBlacklisted = difference(settingsNotBackedUp, blacklist); 781 assertWithMessage("Settings not backed up or blacklisted") 782 .that(settingsNotBackedUpOrBlacklisted).isEmpty(); 783 784 assertWithMessage("blacklisted settings backed up") 785 .that(intersect(settingsToBackup, blacklist)).isEmpty(); 786 } 787 getCandidateSettings( Class<? extends Settings.NameValueTable> clazz)788 private static Set<String> getCandidateSettings( 789 Class<? extends Settings.NameValueTable> clazz) { 790 HashSet<String> result = new HashSet<String>(); 791 for (Field field : clazz.getDeclaredFields()) { 792 if (looksLikeValidSetting(field)) { 793 try { 794 result.add((String) field.get(null)); 795 } catch (IllegalAccessException e) { 796 // Impossible for public fields 797 throw new RuntimeException(e); 798 } 799 } 800 } 801 return result; 802 } 803 looksLikeValidSetting(Field field)804 private static boolean looksLikeValidSetting(Field field) { 805 int modifiers = field.getModifiers(); 806 return isPublic(modifiers) 807 && isStatic(modifiers) 808 && isFinal(modifiers) 809 && field.getType() == String.class 810 && field.getAnnotation(Deprecated.class) == null; 811 } 812 difference(Set<T> s1, Set<T> s2)813 private static <T> Set<T> difference(Set<T> s1, Set<T> s2) { 814 HashSet<T> result = new HashSet<T>(s1); 815 result.removeAll(s2); 816 return result; 817 } 818 intersect(Set<T> s1, Set<T> s2)819 private static <T> Set<T> intersect(Set<T> s1, Set<T> s2) { 820 HashSet<T> result = new HashSet<T>(s1); 821 result.retainAll(s2); 822 return result; 823 } 824 825 } 826