• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.runner.AndroidJUnit4;
35 
36 import com.android.server.display.feature.flags.Flags;
37 
38 import org.junit.Test;
39 import org.junit.runner.RunWith;
40 
41 import java.lang.reflect.Field;
42 import java.util.Collections;
43 import java.util.HashSet;
44 import java.util.Set;
45 
46 /** Tests that ensure appropriate settings are backed up. */
47 @Presubmit
48 @RunWith(AndroidJUnit4.class)
49 @SmallTest
50 public class SettingsBackupTest {
51 
52     /**
53      * see {@link com.google.android.systemui.power.EnhancedEstimatesGoogleImpl} for more details
54      */
55     public static final String HYBRID_SYSUI_BATTERY_WARNING_FLAGS =
56             "hybrid_sysui_battery_warning_flags";
57 
58     private static final Set<String> BACKUP_DENY_LIST_GLOBAL_SETTINGS =
59             newHashSet(
60                     Settings.Global.ACTIVITY_MANAGER_CONSTANTS,
61                     Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED,
62                     Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
63                     Settings.Global.ADB_ENABLED,
64                     Settings.Global.ADB_WIFI_ENABLED,
65                     Settings.Global.ADB_DISCONNECT_SESSIONS_ON_REVOKE,
66                     Settings.Global.AIRPLANE_MODE_ON,
67                     Settings.Global.AIRPLANE_MODE_RADIOS,
68                     Settings.Global.ALLOW_WORK_PROFILE_TELEPHONY_FOR_NON_DPM_ROLE_HOLDERS,
69                     Settings.Global.SATELLITE_MODE_RADIOS,
70                     Settings.Global.SATELLITE_MODE_ENABLED,
71                     Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,
72                     Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED,
73                     Settings.Global.ALWAYS_FINISH_ACTIVITIES,
74                     Settings.Global.ALWAYS_ON_DISPLAY_CONSTANTS,
75                     Settings.Global.ANIMATOR_DURATION_SCALE,
76                     Settings.Global.ANOMALY_DETECTION_CONSTANTS,
77                     Settings.Global.ANOMALY_CONFIG,
78                     Settings.Global.ANOMALY_CONFIG_VERSION,
79                     Settings.Global.APN_DB_UPDATE_CONTENT_URL,
80                     Settings.Global.APN_DB_UPDATE_METADATA_URL,
81                     Settings.Global.APP_BINDING_CONSTANTS,
82                     Settings.Global.APP_OPS_CONSTANTS,
83                     Settings.Global.APP_STANDBY_ENABLED,
84                     Settings.Global.APP_TIME_LIMIT_USAGE_SOURCE,
85                     Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
86                     Settings.Global.ASSISTED_GPS_ENABLED,
87                     Settings.Global.AUDIO_SAFE_VOLUME_STATE,
88                     Settings.Global.AUDIO_SAFE_CSD_CURRENT_VALUE,
89                     Settings.Global.AUDIO_SAFE_CSD_NEXT_WARNING,
90                     Settings.Global.AUDIO_SAFE_CSD_DOSE_RECORDS,
91                     Settings.Global.AUTOFILL_LOGGING_LEVEL,
92                     Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
93                     Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
94                     Settings.Global.AUTO_TIME_ZONE_EXPLICIT,
95                     Settings.Global.AVERAGE_TIME_TO_DISCHARGE,
96                     Settings.Global.BATTERY_CHARGING_STATE_ENFORCE_LEVEL,
97                     Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY,
98                     Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
99                     Settings.Global.BROADCAST_BG_CONSTANTS,
100                     Settings.Global.BROADCAST_FG_CONSTANTS,
101                     Settings.Global.BROADCAST_OFFLOAD_CONSTANTS,
102                     Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD,
103                     Settings.Global.BATTERY_DISCHARGE_THRESHOLD,
104                     Settings.Global.BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS,
105                     Settings.Global.BATTERY_STATS_CONSTANTS,
106                     Settings.Global.BINDER_CALLS_STATS,
107                     Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE,
108                     Settings.Global.BLE_SCAN_LOW_POWER_WINDOW_MS,
109                     Settings.Global.BLE_SCAN_LOW_POWER_INTERVAL_MS,
110                     Settings.Global.BLE_SCAN_BALANCED_WINDOW_MS,
111                     Settings.Global.BLE_SCAN_BALANCED_INTERVAL_MS,
112                     Settings.Global.BLE_SCAN_LOW_LATENCY_WINDOW_MS,
113                     Settings.Global.BLE_SCAN_LOW_LATENCY_INTERVAL_MS,
114                     Settings.Global.BLE_SCAN_BACKGROUND_MODE,
115                     Settings.Global.BLOCKED_SLICES,
116                     Settings.Global.BLOCKING_HELPER_DISMISS_TO_VIEW_RATIO_LIMIT,
117                     Settings.Global.BLOCKING_HELPER_STREAK_LIMIT,
118                     Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE,
119                     Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX,
120                     Settings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX,
121                     Settings.Global.BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX,
122                     Settings.Global.BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX,
123                     Settings.Global.BLUETOOTH_CLASS_OF_DEVICE,
124                     Settings.Global.BLUETOOTH_DISABLED_PROFILES,
125                     Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX,
126                     Settings.Global.BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX,
127                     Settings.Global.BLUETOOTH_INTEROPERABILITY_LIST,
128                     Settings.Global.BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX,
129                     Settings.Global.BLUETOOTH_MAP_PRIORITY_PREFIX,
130                     Settings.Global.BLUETOOTH_PAN_PRIORITY_PREFIX,
131                     Settings.Global.BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX,
132                     Settings.Global.BLUETOOTH_SAP_PRIORITY_PREFIX,
133                     Settings.Global.BLUETOOTH_HEARING_AID_PRIORITY_PREFIX,
134                     Settings.Global.BOOT_COUNT,
135                     Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
136                     Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
137                     Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
138                     Settings.Global.CAPTIVE_PORTAL_MODE,
139                     Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
140                     Settings.Global.CAPTIVE_PORTAL_FALLBACK_PROBE_SPECS,
141                     Settings.Global.CAPTIVE_PORTAL_SERVER,
142                     Settings.Global.CAPTIVE_PORTAL_USE_HTTPS,
143                     Settings.Global.CAPTIVE_PORTAL_USER_AGENT,
144                     Settings.Global.CAR_DOCK_SOUND,
145                     Settings.Global.CARRIER_APP_WHITELIST,
146                     Settings.Global.CARRIER_APP_NAMES,
147                     Settings.Global.CAR_UNDOCK_SOUND,
148                     Settings.Global.CDMA_CELL_BROADCAST_SMS,
149                     Settings.Global.CDMA_ROAMING_MODE,
150                     Settings.Global.CDMA_SUBSCRIPTION_MODE,
151                     Settings.Global.CELL_ON,
152                     Settings.Global.CERT_PIN_UPDATE_CONTENT_URL,
153                     Settings.Global.CERT_PIN_UPDATE_METADATA_URL,
154                     Settings.Global.COMPATIBILITY_MODE,
155                     Settings.Global.CONNECTIVITY_CHANGE_DELAY,
156                     Settings.Global.CONNECTIVITY_METRICS_BUFFER_SIZE,
157                     Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
158                     Settings.Global.CONTACT_METADATA_SYNC_ENABLED,
159                     Settings.Global.CONVERSATION_ACTIONS_UPDATE_CONTENT_URL,
160                     Settings.Global.CONVERSATION_ACTIONS_UPDATE_METADATA_URL,
161                     Settings.Global.CONTACTS_DATABASE_WAL_ENABLED,
162                     Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
163                     Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI,
164                     Settings.Global.DATABASE_CREATION_BUILDID,
165                     Settings.Global.DATABASE_DOWNGRADE_REASON,
166                     Settings.Global.DATA_ROAMING,
167                     Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
168                     Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS,
169                     Settings.Global.DATA_STALL_RECOVERY_ON_BAD_NETWORK,
170                     Settings.Global.DEBUG_APP,
171                     Settings.Global.DEBUG_VIEW_ATTRIBUTES,
172                     Settings.Global.DEBUG_VIEW_ATTRIBUTES_APPLICATION_PACKAGE,
173                     Settings.Global.DEFAULT_DNS_SERVER,
174                     Settings.Global.DEFAULT_INSTALL_LOCATION,
175                     Settings.Global.DEFAULT_RESTRICT_BACKGROUND_DATA,
176                     Settings.Global.DESK_DOCK_SOUND,
177                     Settings.Global.DESK_UNDOCK_SOUND,
178                     Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT,
179                     Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
180                     Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
181                     Settings.Global.DEVELOPMENT_FORCE_RTL,
182                     Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
183                     Settings.Global.DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR,
184                     Settings.Global.DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH,
185                     Settings.Global.DEVICE_DEMO_MODE,
186                     Settings.Global.DEVICE_IDLE_CONSTANTS,
187                     Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS,
188                     Settings.Global.DISABLE_WINDOW_BLURS,
189                     Settings.Global.BATTERY_SAVER_CONSTANTS,
190                     Settings.Global.BATTERY_TIP_CONSTANTS,
191                     Settings.Global.DEFAULT_SM_DP_PLUS,
192                     Settings.Global.DEVICE_NAME,
193                     Settings.Global.DEVICE_POLICY_CONSTANTS,
194                     Settings.Global.DEVICE_PROVISIONED,
195                     Settings.Global.BYPASS_DEVICE_POLICY_MANAGEMENT_ROLE_QUALIFICATIONS,
196                     Settings.Global.DEVICE_PROVISIONING_MOBILE_DATA_ENABLED,
197                     Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
198                     Settings.Global.DISPLAY_PANEL_LPM,
199                     Settings.Global.DISPLAY_SCALING_FORCE,
200                     Settings.Global.DISPLAY_SIZE_FORCED,
201                     Settings.Global.DNS_RESOLVER_MAX_SAMPLES,
202                     Settings.Global.DNS_RESOLVER_MIN_SAMPLES,
203                     Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS,
204                     Settings.Global.DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT,
205                     Settings.Global.DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY,
206                     Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE,
207                     Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE,
208                     Settings.Global.DROPBOX_AGE_SECONDS,
209                     Settings.Global.DROPBOX_MAX_FILES,
210                     Settings.Global.DROPBOX_QUOTA_KB,
211                     Settings.Global.DROPBOX_QUOTA_PERCENT,
212                     Settings.Global.DROPBOX_RESERVE_PERCENT,
213                     Settings.Global.DROPBOX_TAG_PREFIX,
214                     Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
215                     Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
216                     Settings.Global.EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS,
217                     Settings.Global.EMERGENCY_GESTURE_STICKY_UI_MAX_DURATION_MILLIS,
218                     Settings.Global.EMULATE_DISPLAY_CUTOUT,
219                     Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
220                     Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
221                     Settings.Global.ENABLE_CELLULAR_ON_BOOT,
222                     Settings.Global.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE,
223                     Settings.Global.ENABLE_DISKSTATS_LOGGING,
224                     Settings.Global.ENABLE_EPHEMERAL_FEATURE,
225                     Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED,
226                     Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
227                     Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
228                     Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
229                     Settings.Global.STYLUS_EVER_USED,
230                     Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
231                     Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
232                     Settings.Global.ENHANCED_4G_MODE_ENABLED,
233                     Settings.Global.ENABLE_16K_PAGES, // Added for 16K developer option
234                     Settings.Global.EPHEMERAL_COOKIE_MAX_SIZE_BYTES,
235                     Settings.Global.ERROR_KERNEL_LOG_PREFIX,
236                     Settings.Global.ERROR_LOGCAT_PREFIX,
237                     Settings.Global.EUICC_PROVISIONED,
238                     Settings.Global.EUICC_SUPPORTED_COUNTRIES,
239                     Settings.Global.EUICC_UNSUPPORTED_COUNTRIES,
240                     Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS,
241                     Settings.Global.EUICC_REMOVING_INVISIBLE_PROFILES_TIMEOUT_MILLIS,
242                     Settings.Global.EUICC_SWITCH_SLOT_TIMEOUT_MILLIS,
243                     Settings.Global.FANCY_IME_ANIMATIONS,
244                     Settings.Global.ONE_HANDED_KEYGUARD_SIDE,
245                     Settings.Global.FORCE_ALLOW_ON_EXTERNAL,
246                     Settings.Global.FORCED_APP_STANDBY_FOR_SMALL_BATTERY_ENABLED,
247                     Settings.Global.WIFI_ON_WHEN_PROXY_DISCONNECTED,
248                     Settings.Global.FSTRIM_MANDATORY_INTERVAL,
249                     Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED,
250                     Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
251                     Settings.Global.GLOBAL_HTTP_PROXY_HOST,
252                     Settings.Global.GLOBAL_HTTP_PROXY_PAC,
253                     Settings.Global.GLOBAL_HTTP_PROXY_PORT,
254                     Settings.Global.GNSS_HAL_LOCATION_REQUEST_DURATION_MILLIS,
255                     Settings.Global.GNSS_SATELLITE_BLOCKLIST,
256                     Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS,
257                     Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
258                     Settings.Global.HIDDEN_API_POLICY,
259                     Settings.Global.FORCE_NON_DEBUGGABLE_FINAL_BUILD_FOR_COMPAT,
260                     Settings.Global.HIDE_ERROR_DIALOGS,
261                     Settings.Global.HTTP_PROXY,
262                     HYBRID_SYSUI_BATTERY_WARNING_FLAGS,
263                     Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY,
264                     Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY,
265                     Settings.Global.INSTANT_APP_DEXOPT_ENABLED,
266                     Settings.Global.INTENT_FIREWALL_UPDATE_CONTENT_URL,
267                     Settings.Global.INTENT_FIREWALL_UPDATE_METADATA_URL,
268                     Settings.Global.KEEP_PROFILE_IN_BACKGROUND,
269                     Settings.Global.KERNEL_CPU_THREAD_READER,
270                     Settings.Global.LANG_ID_UPDATE_CONTENT_URL,
271                     Settings.Global.LANG_ID_UPDATE_METADATA_URL,
272                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS,
273                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
274                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
275                     Settings.Global.LOCATION_ENABLE_STATIONARY_THROTTLE,
276                     Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED,
277                     Settings.Global.LOCK_SOUND,
278                     Settings.Global.LOOPER_STATS,
279                     Settings.Global.LOW_BATTERY_SOUND,
280                     Settings.Global.LOW_BATTERY_SOUND_TIMEOUT,
281                     Settings.Global.LOW_POWER_MODE,
282                     Settings.Global.EXTRA_LOW_POWER_MODE,
283                     Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
284                     Settings.Global.LOW_POWER_MODE_STICKY,
285                     Settings.Global.LOW_POWER_MODE_SUGGESTION_PARAMS,
286                     Settings.Global.LOW_POWER_STANDBY_ACTIVE_DURING_MAINTENANCE,
287                     Settings.Global.LOW_POWER_STANDBY_ENABLED,
288                     Settings.Global.LTE_SERVICE_FORCED,
289                     Settings.Global.LID_BEHAVIOR,
290                     Settings.Global.MAX_ERROR_BYTES_PREFIX,
291                     Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE,
292                     Settings.Global.MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY,
293                     Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH,
294                     Settings.Global.MDC_INITIAL_MAX_RETRY,
295                     Settings.Global.MHL_INPUT_SWITCHING_ENABLED,
296                     Settings.Global.MHL_POWER_CHARGE_ENABLED,
297                     Settings.Global.MIN_DURATION_BETWEEN_RECOVERY_STEPS_IN_MS,
298                     Settings.Global.MOBILE_DATA, // Candidate for backup?
299                     Settings.Global.MOBILE_DATA_ALWAYS_ON,
300                     Settings.Global.DSRM_DURATION_MILLIS,
301                     Settings.Global.DSRM_ENABLED_ACTIONS,
302                     Settings.Global.MODE_RINGER,
303                     Settings.Global.MUTE_ALARM_STREAM_WITH_RINGER_MODE,
304                     Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION,
305                     Settings.Global.MULTI_SIM_SMS_PROMPT,
306                     Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION,
307                     Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
308                     Settings.Global.MULTI_SIM_VOICE_PROMPT,
309                     Settings.Global.NATIVE_FLAGS_HEALTH_CHECK_ENABLED,
310                     Settings.Global.NETSTATS_DEV_BUCKET_DURATION,
311                     Settings.Global.NETSTATS_DEV_DELETE_AGE,
312                     Settings.Global.NETSTATS_DEV_PERSIST_BYTES,
313                     Settings.Global.NETSTATS_DEV_ROTATE_AGE,
314                     Settings.Global.NETSTATS_ENABLED,
315                     Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES,
316                     Settings.Global.NETSTATS_POLL_INTERVAL,
317                     Settings.Global.NETSTATS_SAMPLE_ENABLED,
318                     Settings.Global.NETSTATS_AUGMENT_ENABLED,
319                     Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED,
320                     Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE,
321                     Settings.Global.NETSTATS_UID_BUCKET_DURATION,
322                     Settings.Global.NETSTATS_UID_DELETE_AGE,
323                     Settings.Global.NETSTATS_UID_PERSIST_BYTES,
324                     Settings.Global.NETSTATS_UID_ROTATE_AGE,
325                     Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION,
326                     Settings.Global.NETSTATS_UID_TAG_DELETE_AGE,
327                     Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES,
328                     Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE,
329                     Settings.Global.NETPOLICY_QUOTA_ENABLED,
330                     Settings.Global.NETPOLICY_QUOTA_UNLIMITED,
331                     Settings.Global.NETPOLICY_QUOTA_LIMITED,
332                     Settings.Global.NETPOLICY_QUOTA_FRAC_JOBS,
333                     Settings.Global.NETPOLICY_QUOTA_FRAC_MULTIPATH,
334                     Settings.Global.NETPOLICY_OVERRIDE_ENABLED,
335                     Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES,
336                     Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE,
337                     Settings.Global.NETWORK_WATCHLIST_LAST_REPORT_TIME,
338                     Settings.Global.NETWORK_PREFERENCE,
339                     Settings.Global.NETWORK_RECOMMENDATIONS_PACKAGE,
340                     Settings.Global.NETWORK_SCORER_APP,
341                     Settings.Global.NETWORK_SCORING_PROVISIONED,
342                     Settings.Global.NETWORK_SCORING_UI_ENABLED,
343                     Settings.Global.NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT,
344                     Settings.Global.NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS,
345                     Settings.Global.NETWORK_WATCHLIST_ENABLED,
346                     Settings.Global.NEW_CONTACT_AGGREGATOR,
347                     Settings.Global.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE,
348                     Settings.Global.NITZ_NETWORK_DISCONNECT_RETENTION,
349                     Settings.Global.NITZ_UPDATE_DIFF,
350                     Settings.Global.NITZ_UPDATE_SPACING,
351                     Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
352                     Settings.Global.NOTIFICATION_FEEDBACK_ENABLED,
353                     Settings.Global.NR_NSA_TRACKING_SCREEN_OFF_MODE,
354                     Settings.Global.NTP_SERVER,
355                     Settings.Global.NTP_TIMEOUT,
356                     Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,
357                     Settings.Global.OVERLAY_DISPLAY_DEVICES,
358                     Settings.Global.PAC_CHANGE_DELAY,
359                     Settings.Global.PACKAGE_STREAMING_VERIFIER_TIMEOUT,
360                     Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE,
361                     Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB,
362                     Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE,
363                     Settings.Global.PACKAGE_VERIFIER_TIMEOUT,
364                     Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT,
365                     Settings.Global.PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS,
366                     Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS,
367                     Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT,
368                     Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS,
369                     Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT,
370                     Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE,
371                     Settings.Global.POLICY_CONTROL,
372                     Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
373                     Settings.Global.POWER_MANAGER_CONSTANTS,
374                     Settings.Global.PREFERRED_NETWORK_MODE,
375                     Settings.Global.PRIVATE_DNS_DEFAULT_MODE,
376                     Settings.Global.PROVISIONING_APN_ALARM_DELAY_IN_MS,
377                     Settings.Global.RADIO_BLUETOOTH,
378                     Settings.Global.RADIO_CELL,
379                     Settings.Global.RADIO_NFC,
380                     Settings.Global.RADIO_WIFI,
381                     Settings.Global.RADIO_WIMAX,
382                     Settings.Global.RADIO_UWB,
383                     Settings.Global.RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS,
384                     Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT,
385                     Settings.Global.RESTRICTED_NETWORKING_MODE,
386                     Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT,
387                     Settings.Global.SAFE_BOOT_DISALLOWED,
388                     Settings.Global.SECURE_FRP_MODE,
389                     Settings.Global.SELINUX_STATUS,
390                     Settings.Global.SELINUX_UPDATE_CONTENT_URL,
391                     Settings.Global.SELINUX_UPDATE_METADATA_URL,
392                     Settings.Global.SEND_ACTION_APP_ERROR,
393                     Settings.Global.SET_GLOBAL_HTTP_PROXY,
394                     Settings.Global.SET_INSTALL_LOCATION,
395                     Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL,
396                     Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST,
397                     Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL,
398                     Settings.Global.SETTINGS_USE_EXTERNAL_PROVIDER_API,
399                     Settings.Global.SETTINGS_USE_PSD_API,
400                     Settings.Global.SHORTCUT_MANAGER_CONSTANTS,
401                     Settings.Global.SHOW_FIRST_CRASH_DIALOG,
402                     Settings.Global.SHOW_HIDDEN_LAUNCHER_ICON_APPS_ENABLED,
403                     Settings.Global.SHOW_MUTE_IN_CRASH_DIALOG,
404                     Settings.Global.SHOW_NEW_APP_INSTALLED_NOTIFICATION_ENABLED,
405                     Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
406                     Settings.Global.SHOW_PEOPLE_SPACE,
407                     Settings.Global.SHOW_NEW_NOTIF_DISMISS,
408                     Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG,
409                     Settings.Global.SHOW_TEMPERATURE_WARNING,
410                     Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
411                     Settings.Global.SIGNED_CONFIG_VERSION,
412                     Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
413                     Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
414                     Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
415                     Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
416                     Settings.Global.SMS_SHORT_CODE_CONFIRMATION,
417                     Settings.Global.SMS_SHORT_CODE_RULE,
418                     Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL,
419                     Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL,
420                     Settings.Global.SOUND_TRIGGER_DETECTION_SERVICE_OP_TIMEOUT,
421                     Settings.Global.SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS,
422                     Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS,
423                     Settings.Global.STORAGE_BENCHMARK_INTERVAL,
424                     Settings.Global.STORAGE_SETTINGS_CLOBBER_THRESHOLD,
425                     Settings.Global.SYNC_MANAGER_CONSTANTS,
426                     Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
427                     Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
428                     Settings.Global.SYS_STORAGE_CACHE_PERCENTAGE,
429                     Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
430                     Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
431                     Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
432                     Settings.Global.SYS_UIDCPUPOWER,
433                     Settings.Global.SYS_TRACED,
434                     Settings.Global.FPS_DEVISOR,
435                     Settings.Global.TCP_DEFAULT_INIT_RWND,
436                     Settings.Global.TETHER_DUN_APN,
437                     Settings.Global.TETHER_DUN_REQUIRED,
438                     Settings.Global.TETHER_OFFLOAD_DISABLED,
439                     Settings.Global.TETHER_SUPPORTED,
440                     Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER,
441                     Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
442                     Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS,
443                     Settings.Global.THEATER_MODE_ON,
444                     Settings.Global.TIME_ONLY_MODE_CONSTANTS,
445                     Settings.Global.TIME_REMAINING_ESTIMATE_MILLIS,
446                     Settings.Global.TIME_REMAINING_ESTIMATE_BASED_ON_USAGE,
447                     Settings.Global.TRANSITION_ANIMATION_SCALE,
448                     Settings.Global.TRUSTED_SOUND,
449                     Settings.Global.TZINFO_UPDATE_CONTENT_URL,
450                     Settings.Global.TZINFO_UPDATE_METADATA_URL,
451                     Settings.Global.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
452                     Settings.Global.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
453                     Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
454                     Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
455                     Settings.Global.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD,
456                     Settings.Global.UNGAZE_SLEEP_ENABLED,
457                     Settings.Global.UNLOCK_SOUND,
458                     Settings.Global.USE_GOOGLE_MAIL,
459                     Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
460                     Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
461                     Settings.Global.VT_IMS_ENABLED,
462                     Settings.Global.WAIT_FOR_DEBUGGER,
463                     Settings.Global.ENABLE_GPU_DEBUG_LAYERS,
464                     Settings.Global.GPU_DEBUG_APP,
465                     Settings.Global.GPU_DEBUG_LAYERS,
466                     Settings.Global.GPU_DEBUG_LAYERS_GLES,
467                     Settings.Global.ANGLE_DEBUG_PACKAGE,
468                     Settings.Global.ANGLE_GL_DRIVER_ALL_ANGLE,
469                     Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS,
470                     Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES,
471                     Settings.Global.ANGLE_EGL_FEATURES,
472                     Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
473                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
474                     Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
475                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS,
476                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS,
477                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST,
478                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST,
479                     Settings.Global.UPDATABLE_DRIVER_SPHAL_LIBRARIES,
480                     Settings.Global.UWB_ENABLED,
481                     Settings.Global.SHOW_ANGLE_IN_USE_DIALOG_BOX,
482                     Settings.Global.GPU_DEBUG_LAYER_APP,
483                     Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
484                     Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
485                     Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS,
486                     Settings.Global.WARNING_TEMPERATURE,
487                     Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
488                     Settings.Global.WEBVIEW_MULTIPROCESS,
489                     Settings.Global.WEBVIEW_PROVIDER,
490                     Settings.Global.WFC_IMS_ENABLED,
491                     Settings.Global.WFC_IMS_MODE,
492                     Settings.Global.WFC_IMS_ROAMING_ENABLED,
493                     Settings.Global.WFC_IMS_ROAMING_MODE,
494                     Settings.Global.WIFI_ALWAYS_REQUESTED,
495                     Settings.Global.WIFI_BADGING_THRESHOLDS,
496                     Settings.Global.WIFI_BOUNCE_DELAY_OVERRIDE_MS,
497                     Settings.Global.WIFI_COUNTRY_CODE,
498                     Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN,
499                     Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
500                     Settings.Global.WIFI_DISPLAY_ON,
501                     Settings.Global.WIFI_DISPLAY_WPS_CONFIG,
502                     Settings.Global.WIFI_ENHANCED_AUTO_JOIN,
503                     Settings.Global.WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS,
504                     Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS,
505                     Settings.Global.WIFI_FREQUENCY_BAND,
506                     Settings.Global.WIFI_IDLE_MS,
507                     Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT,
508                     Settings.Global.WIFI_MIGRATION_COMPLETED,
509                     Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,
510                     Settings.Global.WIFI_NETWORK_SHOW_RSSI,
511                     Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
512                     Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT,
513                     Settings.Global.WIFI_ON,
514                     Settings.Global.WIFI_P2P_DEVICE_NAME,
515                     Settings.Global.WIFI_P2P_PENDING_FACTORY_RESET,
516                     Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE,
517                     Settings.Global.WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS,
518                     Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
519                     Settings.Global.WIFI_SCORE_PARAMS,
520                     Settings.Global.WIFI_SLEEP_POLICY,
521                     Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS,
522                     Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED,
523                     Settings.Global.WIFI_WATCHDOG_ON,
524                     Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON,
525                     Settings.Global.CHARGING_STARTED_SOUND,
526                     Settings.Global.WIRELESS_CHARGING_STARTED_SOUND,
527                     Settings.Global.WINDOW_ANIMATION_SCALE,
528                     Settings.Global.WTF_IS_FATAL,
529                     Settings.Global.ZEN_MODE,
530                     Settings.Global.ZEN_MODE_CONFIG_ETAG,
531                     Settings.Global.ZEN_MODE_RINGER_LEVEL,
532                     Settings.Global.ZRAM_ENABLED,
533                     Settings.Global.OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION,
534                     Settings.Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED,
535                     Settings.Global.HIDDEN_API_BLACKLIST_EXEMPTIONS,
536                     Settings.Global.BACKUP_AGENT_TIMEOUT_PARAMETERS,
537                     Settings.Global.APPOP_HISTORY_PARAMETERS,
538                     Settings.Global.APPOP_HISTORY_MODE,
539                     Settings.Global.APPOP_HISTORY_INTERVAL_MULTIPLIER,
540                     Settings.Global.APPOP_HISTORY_BASE_INTERVAL_MILLIS,
541                     Settings.Global.AUTO_REVOKE_PARAMETERS,
542                     Settings.Global.ENABLE_RADIO_BUG_DETECTION,
543                     Settings.Global.REPAIR_MODE_ACTIVE,
544                     Settings.Global.RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD,
545                     Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD,
546                     Settings.Global.ENABLED_SUBSCRIPTION_FOR_SLOT,
547                     Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT,
548                     Settings.Global.POWER_BUTTON_SHORT_PRESS,
549                     Settings.Global.POWER_BUTTON_DOUBLE_PRESS,
550                     Settings.Global.POWER_BUTTON_TRIPLE_PRESS,
551                     Settings.Global.POWER_BUTTON_VERY_LONG_PRESS,
552                     Settings.Global.STEM_PRIMARY_BUTTON_SHORT_PRESS,
553                     Settings.Global.STEM_PRIMARY_BUTTON_DOUBLE_PRESS,
554                     Settings.Global.STEM_PRIMARY_BUTTON_TRIPLE_PRESS,
555                     Settings.Global.STEM_PRIMARY_BUTTON_LONG_PRESS,
556                     Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, // Temporary for R beta
557                     Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER,
558                     Settings.Global.CACHED_APPS_FREEZER_ENABLED,
559                     Settings.Global.APP_INTEGRITY_VERIFICATION_TIMEOUT,
560                     Settings.Global.KEY_CHORD_POWER_VOLUME_UP,
561                     Settings.Global.CLOCKWORK_HOME_READY,
562                     Settings.Global.WATCHDOG_TIMEOUT_MILLIS,
563                     Settings.Global.MANAGED_PROVISIONING_DEFER_PROVISIONING_TO_ROLE_HOLDER,
564                     Settings.Global.REVIEW_PERMISSIONS_NOTIFICATION_STATE,
565                     Settings.Global.ENABLE_BACK_ANIMATION, // Temporary for T, dev option only
566                     Settings.Global.Wearable.COMBINED_LOCATION_ENABLE,
567                     Settings.Global.Wearable.HAS_PAY_TOKENS,
568                     Settings.Global.Wearable.GMS_CHECKIN_TIMEOUT_MIN,
569                     Settings.Global.Wearable.HOTWORD_DETECTION_ENABLED,
570                     Settings.Global.Wearable.DEFAULT_VIBRATION,
571                     Settings.Global.Wearable.OBTAIN_PAIRED_DEVICE_LOCATION,
572                     Settings.Global.Wearable.PHONE_PLAY_STORE_AVAILABILITY,
573                     Settings.Global.Wearable.BUG_REPORT,
574                     Settings.Global.Wearable.SMART_ILLUMINATE_ENABLED,
575                     Settings.Global.Wearable.AUTO_WIFI,
576                     Settings.Global.Wearable.WIFI_POWER_SAVE,
577                     Settings.Global.Wearable.ALT_BYPASS_WIFI_REQUIREMENT_TIME_MILLIS,
578                     Settings.Global.Wearable.SETUP_SKIPPED,
579                     Settings.Global.Wearable.LAST_CALL_FORWARD_ACTION,
580                     Settings.Global.Wearable.STEM_1_TYPE,
581                     Settings.Global.Wearable.STEM_1_DATA,
582                     Settings.Global.Wearable.STEM_1_DEFAULT_DATA,
583                     Settings.Global.Wearable.STEM_2_TYPE,
584                     Settings.Global.Wearable.STEM_2_DATA,
585                     Settings.Global.Wearable.STEM_2_DEFAULT_DATA,
586                     Settings.Global.Wearable.STEM_3_TYPE,
587                     Settings.Global.Wearable.STEM_3_DATA,
588                     Settings.Global.Wearable.STEM_3_DEFAULT_DATA,
589                     Settings.Global.Wearable.WEAR_OS_VERSION_STRING,
590                     Settings.Global.Wearable.SIDE_BUTTON,
591                     Settings.Global.Wearable.ANDROID_WEAR_VERSION,
592                     Settings.Global.Wearable.SYSTEM_CAPABILITIES,
593                     Settings.Global.Wearable.SYSTEM_EDITION,
594                     Settings.Global.Wearable.WEAR_PLATFORM_MR_NUMBER,
595                     Settings.Global.Wearable.MOBILE_SIGNAL_DETECTOR,
596                     Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED_DEV,
597                     Settings.Global.Wearable.AMBIENT_TILT_TO_BRIGHT,
598                     Settings.Global.Wearable.BATTERY_SAVER_MODE,
599                     Settings.Global.Wearable.DECOMPOSABLE_WATCHFACE,
600                     Settings.Global.Wearable.AMBIENT_FORCE_WHEN_DOCKED,
601                     Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED,
602                     Settings.Global.Wearable.AMBIENT_PLUGGED_TIMEOUT_MIN,
603                     Settings.Global.Wearable.PAIRED_DEVICE_OS_TYPE,
604                     Settings.Global.Wearable.COMPANION_BLE_ROLE,
605                     Settings.Global.Wearable.COMPANION_NAME,
606                     Settings.Global.Wearable.COMPANION_APP_NAME,
607                     Settings.Global.Wearable.COMPANION_OS_VERSION,
608                     Settings.Global.Wearable.ENABLE_ALL_LANGUAGES,
609                     Settings.Global.Wearable.SETUP_LOCALE,
610                     Settings.Global.Wearable.OEM_SETUP_VERSION,
611                     Settings.Global.Wearable.OEM_SETUP_COMPLETED_STATUS,
612                     Settings.Global.Wearable.MASTER_GESTURES_ENABLED,
613                     Settings.Global.Wearable.UNGAZE_ENABLED,
614                     Settings.Global.Wearable.BURN_IN_PROTECTION_ENABLED,
615                     Settings.Global.Wearable.WRIST_ORIENTATION_MODE,
616                     Settings.Global.Wearable.CLOCKWORK_SYSUI_PACKAGE,
617                     Settings.Global.Wearable.CLOCKWORK_SYSUI_MAIN_ACTIVITY,
618                     Settings.Global.Wearable.CLOCKWORK_LONG_PRESS_TO_ASSISTANT_ENABLED,
619                     Settings.Global.Wearable.WET_MODE_ON,
620                     Settings.Global.Wearable.COOLDOWN_MODE_ON,
621                     Settings.Global.Wearable.BEDTIME_MODE,
622                     Settings.Global.Wearable.BEDTIME_HARD_MODE,
623                     Settings.Global.Wearable.VIBRATE_FOR_ACTIVE_UNLOCK,
624                     Settings.Global.Wearable.LOCK_SCREEN_STATE,
625                     Settings.Global.Wearable.DISABLE_AOD_WHILE_PLUGGED,
626                     Settings.Global.Wearable.NETWORK_LOCATION_OPT_IN,
627                     Settings.Global.Wearable.CUSTOM_COLOR_FOREGROUND,
628                     Settings.Global.Wearable.CUSTOM_COLOR_BACKGROUND,
629                     Settings.Global.Wearable.PHONE_SWITCHING_STATUS,
630                     Settings.Global.Wearable.TETHER_CONFIG_STATE,
631                     Settings.Global.Wearable.PHONE_SWITCHING_SUPPORTED,
632                     Settings.Global.Wearable.WEAR_MEDIA_CONTROLS_PACKAGE,
633                     Settings.Global.Wearable.WEAR_MEDIA_SESSIONS_PACKAGE,
634                     Settings.Global.Wearable.WEAR_POWER_ANOMALY_SERVICE_ENABLED,
635                     Settings.Global.Wearable.CONNECTIVITY_KEEP_DATA_ON);
636 
637     private static final Set<String> BACKUP_DENY_LIST_SECURE_SETTINGS =
638              newHashSet(
639                  Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,
640                  Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, // Deprecated since O.
641                  Settings.Secure.ALLOW_PRIMARY_GAIA_ACCOUNT_REMOVAL_FOR_TESTS,
642                  Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS,
643                  Settings.Secure.ALWAYS_ON_VPN_APP,
644                  Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN,
645                  Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST,
646                  Settings.Secure.ANDROID_ID,
647                  Settings.Secure.ANR_SHOW_BACKGROUND,
648                  Settings.Secure.ASSISTANT,
649                  Settings.Secure.ASSIST_DISCLOSURE_ENABLED,
650                  Settings.Secure.ASSIST_GESTURE_ENABLED,
651                  Settings.Secure.ASSIST_GESTURE_SENSITIVITY,
652                  Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED,
653                  Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
654                  Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
655                  Settings.Secure.ASSIST_SCREENSHOT_ENABLED,
656                  Settings.Secure.ASSIST_STRUCTURE_ENABLED,
657                  Settings.Secure.ATTENTIVE_TIMEOUT,
658                  Settings.Secure.AUTOFILL_FEATURE_FIELD_CLASSIFICATION,
659                  Settings.Secure.AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT,
660                  Settings.Secure.AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE,
661                  Settings.Secure.AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE,
662                  Settings.Secure.AUTOFILL_USER_DATA_MAX_VALUE_LENGTH,
663                  Settings.Secure.AUTOFILL_USER_DATA_MIN_VALUE_LENGTH,
664                  Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI,
665                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED,
666                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
667                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN,
668                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY,
669                  Settings.Secure.AUDIO_SAFE_CSD_AS_A_FEATURE_ENABLED, // not controllable by user
670                  Settings.Secure.BACKUP_AUTO_RESTORE,
671                  Settings.Secure.BACKUP_ENABLED,
672                  Settings.Secure.BACKUP_PROVISIONED,
673                  Settings.Secure.BACKUP_SCHEDULING_ENABLED,
674                  Settings.Secure.BACKUP_TRANSPORT,
675                  Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT,
676                  Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup?
677                  Settings.Secure.CARRIER_APPS_HANDLED,
678                  Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG,
679                  Settings.Secure.COMPLETED_CATEGORY_PREFIX,
680                  Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS,
681                  Settings.Secure.CONTENT_CAPTURE_ENABLED,
682                  Settings.Secure.CONTEXTUAL_SEARCH_PACKAGE,
683                  Settings.Secure.DEFAULT_INPUT_METHOD,
684                  Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD,
685                  Settings.Secure.DEVICE_PAIRED,
686                  Settings.Secure.DIALER_DEFAULT_APPLICATION,
687                  Settings.Secure.DISABLED_PRINT_SERVICES,
688                  Settings.Secure.DISABLE_SECURE_WINDOWS,
689                  Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS,
690                  Settings.Secure.DOCKED_CLOCK_FACE,
691                  Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
692                  Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
693                  Settings.Secure.EMERGENCY_GESTURE_UI_SHOWING,
694                  Settings.Secure.EMERGENCY_GESTURE_UI_LAST_STARTED_MILLIS,
695                  Settings.Secure.ENABLED_INPUT_METHODS,  // Intentionally removed in P
696                  Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT,
697                  Settings.Secure.ENABLED_NOTIFICATION_LISTENERS,
698                  Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,
699                  Settings.Secure.ENABLED_PRINT_SERVICES,
700                  Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE,
701                  Settings.Secure.GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED,
702                  Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR,
703                  Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY,
704                  Settings.Secure.INPUT_METHODS_SUBTYPE_HISTORY,
705                  Settings.Secure.INSTALL_NON_MARKET_APPS,
706                  Settings.Secure.LAST_SETUP_SHOWN,
707                  Settings.Secure.LOCATION_CHANGER,
708                  Settings.Secure.LOCATION_MODE,
709                  Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE,
710                  Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, // Candidate?
711                  Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
712                  Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
713                  Settings.Secure.MANAGED_PROFILE_CONTACT_REMOTE_SEARCH,
714                  Settings.Secure.MULTI_PRESS_TIMEOUT,
715                  Settings.Secure.NFC_PAYMENT_FOREGROUND,
716                  Settings.Secure.NIGHT_DISPLAY_ACTIVATED,
717                  Settings.Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
718                  Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED,
719                  Settings.Secure.ODI_CAPTIONS_ENABLED,
720                  Settings.Secure.PARENTAL_CONTROL_LAST_UPDATE,
721                  Settings.Secure.PAYMENT_SERVICE_SEARCH_URI,
722                  Settings.Secure.PRINT_SERVICE_SEARCH_URI,
723                  Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT, // Candidate?
724                  Settings.Secure.SEARCH_GLOBAL_SEARCH_ACTIVITY,
725                  Settings.Secure.SEARCH_MAX_RESULTS_PER_SOURCE,
726                  Settings.Secure.SEARCH_MAX_RESULTS_TO_DISPLAY,
727                  Settings.Secure.SEARCH_MAX_SHORTCUTS_RETURNED,
728                  Settings.Secure.SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS,
729                  Settings.Secure.SEARCH_MAX_STAT_AGE_MILLIS,
730                  Settings.Secure.SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING,
731                  Settings.Secure.SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING,
732                  Settings.Secure.SEARCH_NUM_PROMOTED_SOURCES,
733                  Settings.Secure.SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT,
734                  Settings.Secure.SEARCH_PREFILL_MILLIS,
735                  Settings.Secure.SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS,
736                  Settings.Secure.SEARCH_QUERY_THREAD_CORE_POOL_SIZE,
737                  Settings.Secure.SEARCH_QUERY_THREAD_MAX_POOL_SIZE,
738                  Settings.Secure.SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE,
739                  Settings.Secure.SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE,
740                  Settings.Secure.SEARCH_SOURCE_TIMEOUT_MILLIS,
741                  Settings.Secure.SEARCH_THREAD_KEEPALIVE_SECONDS,
742                  Settings.Secure.SECURE_FRP_MODE,
743                  Settings.Secure.SEARCH_WEB_RESULTS_OVERRIDE_LIMIT,
744                  Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE,
745                  Settings.Secure.SELECTED_SPELL_CHECKER,  // Intentionally removed in Q
746                  Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE,  // Intentionally removed in Q
747                  Settings.Secure.SETTINGS_CLASSNAME,
748                  Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, // candidate?
749                  Settings.Secure.SHOW_ROTATION_SUGGESTIONS,
750                  Settings.Secure.SKIP_FIRST_USE_HINTS, // candidate?
751                  Settings.Secure.SLEEP_TIMEOUT,
752                  Settings.Secure.SMS_DEFAULT_APPLICATION,
753                  Settings.Secure.SPELL_CHECKER_ENABLED,  // Intentionally removed in Q
754                  Settings.Secure.TRUST_AGENTS_INITIALIZED,
755                  Settings.Secure.KNOWN_TRUST_AGENTS_INITIALIZED,
756                  Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS,
757                  Settings.Secure.TV_INPUT_CUSTOM_LABELS,
758                  Settings.Secure.TV_INPUT_HIDDEN_INPUTS,
759                  Settings.Secure.TV_USER_SETUP_COMPLETE,
760                  Settings.Secure.UNKNOWN_SOURCES_DEFAULT_REVERSED,
761                  Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS,
762                  Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
763                  Settings.Secure.USER_SETUP_COMPLETE,
764                  Settings.Secure.USER_SETUP_PERSONALIZATION_STATE,
765                  Settings.Secure.VOICE_INTERACTION_SERVICE,
766                  Settings.Secure.VOICE_RECOGNITION_SERVICE,
767                  Settings.Secure.INSTANT_APPS_ENABLED,
768                  Settings.Secure.BACKUP_MANAGER_CONSTANTS,
769                  Settings.Secure.BACKUP_LOCAL_TRANSPORT_PARAMETERS,
770                  Settings.Secure.KEYGUARD_SLICE_URI,
771                  Settings.Secure.PARENTAL_CONTROL_ENABLED,
772                  Settings.Secure.PARENTAL_CONTROL_REDIRECT_URL,
773                  Settings.Secure.BLUETOOTH_ON_WHILE_DRIVING,
774                  Settings.Secure.LOW_POWER_MANUAL_ACTIVATION_COUNT,
775                  Settings.Secure.SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION,
776                  Settings.Secure.PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE,
777                  Settings.Secure.FLASHLIGHT_AVAILABLE,
778                  Settings.Secure.FLASHLIGHT_ENABLED,
779                  Settings.Secure.CROSS_PROFILE_CALENDAR_ENABLED,
780                  Settings.Secure.LOCATION_ACCESS_CHECK_INTERVAL_MILLIS,
781                  Settings.Secure.LOCATION_ACCESS_CHECK_DELAY_MILLIS,
782                  Settings.Secure.BIOMETRIC_DEBUG_ENABLED,
783                  Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
784                  Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED,
785                  Settings.Secure.MANAGED_PROVISIONING_DPC_DOWNLOADED,
786                  Settings.Secure.AWARE_ENABLED,
787                  Settings.Secure.SKIP_GESTURE,
788                  Settings.Secure.SILENCE_GESTURE,
789                  Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
790                  Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
791                  Settings.Secure.DOZE_QUICK_PICKUP_GESTURE,
792                  Settings.Secure.FACE_UNLOCK_RE_ENROLL,
793                  Settings.Secure.TAP_GESTURE,
794                  Settings.Secure.NEARBY_SHARING_COMPONENT, // not user configurable
795                  Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_MAGNIFICATION_CONTROLLER,
796                  Settings.Secure.SUPPRESS_DOZE,
797                  Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED,
798                  Settings.Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT,
799                  Settings.Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT,
800                  Settings.Secure.UI_TRANSLATION_ENABLED,
801                  Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_EDGE_HAPTIC_ENABLED,
802                  Settings.Secure.DND_CONFIGS_MIGRATED,
803                  Settings.Secure.NAVIGATION_MODE_RESTORE,
804                  Settings.Secure.V_TO_U_RESTORE_ALLOWLIST,
805                  Settings.Secure.V_TO_U_RESTORE_DENYLIST);
806 
807     @Test
systemSettingsBackedUpOrDenied()808     public void systemSettingsBackedUpOrDenied() {
809         checkSettingsBackedUpOrDenied(
810                 getCandidateSettings(Settings.System.class),
811                 newHashSet(SystemSettings.SETTINGS_TO_BACKUP),
812                 getBackUpDenyListSystemSettings());
813     }
814 
815     @Test
globalSettingsBackedUpOrDenied()816     public void globalSettingsBackedUpOrDenied() {
817         Set<String> candidateSettings = getCandidateSettings(Settings.Global.class);
818         candidateSettings.addAll(getCandidateSettings(Settings.Global.Wearable.class));
819         checkSettingsBackedUpOrDenied(
820                 candidateSettings,
821                 newHashSet(GlobalSettings.SETTINGS_TO_BACKUP),
822                 BACKUP_DENY_LIST_GLOBAL_SETTINGS);
823     }
824 
825     @Test
secureSettingsBackedUpOrDenied()826     public void secureSettingsBackedUpOrDenied() {
827         // List of settings that were not added to either SETTINGS_TO_BACKUP or
828         // BACKUP_DENY_LIST_SECURE_SETTINGS while this test was suppressed in
829         // the last two years. Settings in this list are temporarily allowed to
830         // not be explicitly listed as backed up or denied so we can re-enable
831         // this test.
832         //
833         // DO NOT ADD NEW SETTINGS TO THIS LIST!
834         Set<String> settingsNotBackedUpOrDeniedTemporaryAllowList =
835                 newHashSet(
836                         Settings.Secure.ACCESSIBILITY_ALLOW_DIAGONAL_SCROLLING,
837                         Settings.Secure.AMBIENT_CONTEXT_CONSENT_COMPONENT,
838                         Settings.Secure.AMBIENT_CONTEXT_EVENT_ARRAY_EXTRA_KEY,
839                         Settings.Secure.AMBIENT_CONTEXT_PACKAGE_NAME_EXTRA_KEY,
840                         Settings.Secure.AUTO_REVOKE_DISABLED,
841                         Settings.Secure.BIOMETRIC_APP_ENABLED,
842                         Settings.Secure.BIOMETRIC_KEYGUARD_ENABLED,
843                         Settings.Secure.BIOMETRIC_VIRTUAL_ENABLED,
844                         Settings.Secure.BIOMETRIC_FINGERPRINT_VIRTUAL_ENABLED,
845                         Settings.Secure.BIOMETRIC_FACE_VIRTUAL_ENABLED,
846                         Settings.Secure.BLUETOOTH_ADDR_VALID,
847                         Settings.Secure.BLUETOOTH_ADDRESS,
848                         Settings.Secure.BLUETOOTH_NAME,
849                         Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS,
850                         Settings.Secure.CLIPBOARD_SHOW_ACCESS_NOTIFICATIONS,
851                         Settings.Secure.COMMUNAL_MODE_ENABLED,
852                         Settings.Secure.COMMUNAL_MODE_TRUSTED_NETWORKS,
853                         Settings.Secure.DEFAULT_VOICE_INPUT_METHOD,
854                         Settings.Secure.DOCK_SETUP_STATE,
855                         Settings.Secure.EXTRA_AUTOMATIC_POWER_SAVE_MODE,
856                         Settings.Secure.GAME_DASHBOARD_ALWAYS_ON,
857                         Settings.Secure.HDMI_CEC_SET_MENU_LANGUAGE_DENYLIST,
858                         Settings.Secure.HIDE_PRIVATESPACE_ENTRY_POINT,
859                         Settings.Secure.LAUNCHER_TASKBAR_EDUCATION_SHOWING,
860                         Settings.Secure.LOCATION_COARSE_ACCURACY_M,
861                         Settings.Secure.LOCATION_SHOW_SYSTEM_OPS,
862                         Settings.Secure.NAS_SETTINGS_UPDATED,
863                         Settings.Secure.NAV_BAR_FORCE_VISIBLE,
864                         Settings.Secure.NAV_BAR_KIDS_MODE,
865                         Settings.Secure.NEARBY_FAST_PAIR_SETTINGS_DEVICES_COMPONENT,
866                         Settings.Secure.NEARBY_SHARING_SLICE_URI,
867                         Settings.Secure.NOTIFIED_NON_ACCESSIBILITY_CATEGORY_SERVICES,
868                         Settings.Secure.ONE_HANDED_TUTORIAL_SHOW_COUNT,
869                         Settings.Secure.PRIVATE_SPACE_AUTO_LOCK,
870                         Settings.Secure.RELEASE_COMPRESS_BLOCKS_ON_INSTALL,
871                         Settings.Secure.SCREENSAVER_COMPLICATIONS_ENABLED,
872                         Settings.Secure.SHOW_QR_CODE_SCANNER_SETTING,
873                         Settings.Secure.SKIP_ACCESSIBILITY_SHORTCUT_DIALOG_TIMEOUT_RESTRICTION,
874                         Settings.Secure.SPATIAL_AUDIO_ENABLED,
875                         Settings.Secure.TIMEOUT_TO_DOCK_USER,
876                         Settings.Secure.UI_NIGHT_MODE_LAST_COMPUTED,
877                         Settings.Secure.UI_NIGHT_MODE_OVERRIDE_OFF,
878                         Settings.Secure.UI_NIGHT_MODE_OVERRIDE_ON);
879 
880         HashSet<String> keys = new HashSet<String>();
881         Collections.addAll(keys, SecureSettings.SETTINGS_TO_BACKUP);
882         Collections.addAll(keys, DEVICE_SPECIFIC_SETTINGS_TO_BACKUP);
883 
884         Set<String> allSettings = getCandidateSettings(Settings.Secure.class);
885         allSettings.removeAll(settingsNotBackedUpOrDeniedTemporaryAllowList);
886 
887         checkSettingsBackedUpOrDenied(allSettings, keys, BACKUP_DENY_LIST_SECURE_SETTINGS);
888     }
889 
890     /**
891      * The following denylists contain settings that should *not* be backed up and restored to
892      * another device.  As a general rule, anything that is not user configurable should be
893      * denied (and conversely, things that *are* user configurable *should* be backed up)
894      */
getBackUpDenyListSystemSettings()895     private static Set<String> getBackUpDenyListSystemSettings() {
896         Set<String> settings =
897                 newHashSet(
898                         Settings.System.ADVANCED_SETTINGS, // candidate for backup?
899                         Settings.System.ALARM_ALERT_CACHE, // internal cache
900                         Settings.System.APPEND_FOR_LAST_AUDIBLE, // suffix deprecated since API 2
901                         Settings.System.EGG_MODE, // I am the lolrus
902                         Settings.System.END_BUTTON_BEHAVIOR, // bug?
903                         Settings.System.DEFAULT_DEVICE_FONT_SCALE, // Non configurable
904                         Settings.System
905                                 .HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
906                         // candidate for backup?
907                         Settings.System.LOCKSCREEN_DISABLED, // ?
908                         Settings.System.MEDIA_BUTTON_RECEIVER, // candidate for backup?
909                         Settings.System.MUTE_STREAMS_AFFECTED, //  candidate for backup?
910                         Settings.System.NOTIFICATION_SOUND_CACHE, // internal cache
911                         Settings.System.POINTER_LOCATION, // backup candidate?
912                         Settings.System.DEBUG_ENABLE_ENHANCED_CALL_BLOCKING,
913                         // used for testing only
914                         Settings.System.RINGTONE_CACHE, // internal cache
915                         Settings.System.SCREEN_BRIGHTNESS, // removed in P
916                         Settings.System.SETUP_WIZARD_HAS_RUN, // Only used by SuW
917                         Settings.System.SHOW_GTALK_SERVICE_STATUS, // candidate for backup?
918                         Settings.System.SHOW_TOUCHES,
919                         Settings.System.SHOW_KEY_PRESSES,
920                         Settings.System.SHOW_ROTARY_INPUT,
921                         Settings.System.SIP_ADDRESS_ONLY, // value, not a setting
922                         Settings.System.SIP_ALWAYS, // value, not a setting
923                         Settings.System.SYSTEM_LOCALES, // bug?
924                         Settings.System.USER_ROTATION, // backup candidate?
925                         Settings.System.VIBRATE_IN_SILENT, // deprecated?
926                         Settings.System.VOLUME_ACCESSIBILITY,
927                         // used internally, changing value will
928                         // not change volume
929                         Settings.System.VOLUME_ALARM, // deprecated since API 2?
930                         Settings.System.VOLUME_ASSISTANT, // candidate for backup?
931                         Settings.System.VOLUME_BLUETOOTH_SCO, // deprecated since API 2?
932                         Settings.System.VOLUME_MASTER, // candidate for backup?
933                         Settings.System.VOLUME_MUSIC, // deprecated since API 2?
934                         Settings.System.VOLUME_NOTIFICATION, // deprecated since API 2?
935                         Settings.System.VOLUME_RING, // deprecated since API 2?
936                         Settings.System.VOLUME_SYSTEM, // deprecated since API 2?
937                         Settings.System.VOLUME_VOICE, // deprecated since API 2?
938                         Settings.System.WHEN_TO_MAKE_WIFI_CALLS, // bug?
939                         Settings.System.WINDOW_ORIENTATION_LISTENER_LOG, // used for debugging only
940                         Settings.System.SCREEN_BRIGHTNESS_FOR_ALS,
941                         Settings.System.WEAR_ACCESSIBILITY_GESTURE_ENABLED_DURING_OOBE,
942                         Settings.System.WEAR_TTS_PREWARM_ENABLED,
943                         Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,
944                         Settings.System.MULTI_AUDIO_FOCUS_ENABLED // form-factor/OEM specific
945                 );
946         if (!Flags.backUpSmoothDisplayAndForcePeakRefreshRate()) {
947             settings.add(Settings.System.MIN_REFRESH_RATE);
948             settings.add(Settings.System.PEAK_REFRESH_RATE);
949         }
950         return settings;
951     }
952 
checkSettingsBackedUpOrDenied( Set<String> settings, Set<String> settingsToBackup, Set<String> denylist)953     private static void checkSettingsBackedUpOrDenied(
954             Set<String> settings, Set<String> settingsToBackup, Set<String> denylist) {
955         Set<String> settingsNotBackedUp = difference(settings, settingsToBackup);
956         Set<String> settingsNotBackedUpOrDenied = difference(settingsNotBackedUp, denylist);
957         assertWithMessage("Settings not backed up or denied")
958                 .that(settingsNotBackedUpOrDenied).isEmpty();
959 
960         assertWithMessage("denied settings backed up")
961                 .that(intersect(settingsToBackup, denylist)).isEmpty();
962     }
963 
getCandidateSettings(Class<?> clazz)964     private static Set<String> getCandidateSettings(Class<?> clazz) {
965         HashSet<String> result = new HashSet<String>();
966         for (Field field : clazz.getDeclaredFields()) {
967             if (looksLikeValidSetting(field)) {
968                 try {
969                     result.add((String) field.get(null));
970                 } catch (IllegalAccessException e) {
971                     // Impossible for public fields
972                     throw new RuntimeException(e);
973                 }
974             }
975         }
976         return result;
977     }
978 
looksLikeValidSetting(Field field)979     private static boolean looksLikeValidSetting(Field field) {
980         int modifiers = field.getModifiers();
981         return isPublic(modifiers)
982                 && isStatic(modifiers)
983                 && isFinal(modifiers)
984                 && field.getType() == String.class
985                 && field.getAnnotation(Deprecated.class) == null;
986     }
987 
difference(Set<T> s1, Set<T> s2)988     private static <T> Set<T> difference(Set<T> s1, Set<T> s2) {
989         HashSet<T> result = new HashSet<T>(s1);
990         result.removeAll(s2);
991         return result;
992     }
993 
intersect(Set<T> s1, Set<T> s2)994     private static <T> Set<T> intersect(Set<T> s1, Set<T> s2) {
995         HashSet<T> result = new HashSet<T>(s1);
996         result.retainAll(s2);
997         return result;
998     }
999 
1000 }
1001