• 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.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 denylists 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      * denied (and conversely, things that *are* user configurable *should* be backed up)
61      */
62     private static final Set<String> BACKUP_DENY_LIST_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.DESKTOP_MODE, // developer setting for internal prototyping
102                     Settings.System.MIN_REFRESH_RATE, // depends on hardware capabilities
103                     Settings.System.PEAK_REFRESH_RATE, // depends on hardware capabilities
104                     Settings.System.SCREEN_BRIGHTNESS_FLOAT,
105                     Settings.System.SCREEN_BRIGHTNESS_FOR_VR,
106                     Settings.System.SCREEN_BRIGHTNESS_FOR_VR_FLOAT,
107                     Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,
108                     Settings.System.MULTI_AUDIO_FOCUS_ENABLED, // form-factor/OEM specific
109                     Settings.System.WEAR_ACCESSIBILITY_GESTURE_ENABLED
110                     );
111 
112     private static final Set<String> BACKUP_DENY_LIST_GLOBAL_SETTINGS =
113             newHashSet(
114                     Settings.Global.ACTIVITY_MANAGER_CONSTANTS,
115                     Settings.Global.ACTIVITY_STARTS_LOGGING_ENABLED,
116                     Settings.Global.ADB_ALLOWED_CONNECTION_TIME,
117                     Settings.Global.ADB_ENABLED,
118                     Settings.Global.ADB_WIFI_ENABLED,
119                     Settings.Global.ADD_USERS_WHEN_LOCKED,
120                     Settings.Global.AIRPLANE_MODE_ON,
121                     Settings.Global.AIRPLANE_MODE_RADIOS,
122                     Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS,
123                     Settings.Global.ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED,
124                     Settings.Global.ALWAYS_FINISH_ACTIVITIES,
125                     Settings.Global.ALWAYS_ON_DISPLAY_CONSTANTS,
126                     Settings.Global.ANIMATOR_DURATION_SCALE,
127                     Settings.Global.ANOMALY_DETECTION_CONSTANTS,
128                     Settings.Global.ANOMALY_CONFIG,
129                     Settings.Global.ANOMALY_CONFIG_VERSION,
130                     Settings.Global.APN_DB_UPDATE_CONTENT_URL,
131                     Settings.Global.APN_DB_UPDATE_METADATA_URL,
132                     Settings.Global.APP_BINDING_CONSTANTS,
133                     Settings.Global.APP_OPS_CONSTANTS,
134                     Settings.Global.APP_STANDBY_ENABLED,
135                     Settings.Global.APP_TIME_LIMIT_USAGE_SOURCE,
136                     Settings.Global.ART_VERIFIER_VERIFY_DEBUGGABLE,
137                     Settings.Global.ASSISTED_GPS_ENABLED,
138                     Settings.Global.AUDIO_SAFE_VOLUME_STATE,
139                     Settings.Global.AUTOFILL_LOGGING_LEVEL,
140                     Settings.Global.AUTOFILL_MAX_PARTITIONS_SIZE,
141                     Settings.Global.AUTOFILL_MAX_VISIBLE_DATASETS,
142                     Settings.Global.AVERAGE_TIME_TO_DISCHARGE,
143                     Settings.Global.BATTERY_CHARGING_STATE_UPDATE_DELAY,
144                     Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
145                     Settings.Global.BROADCAST_BG_CONSTANTS,
146                     Settings.Global.BROADCAST_FG_CONSTANTS,
147                     Settings.Global.BROADCAST_OFFLOAD_CONSTANTS,
148                     Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD,
149                     Settings.Global.BATTERY_DISCHARGE_THRESHOLD,
150                     Settings.Global.BATTERY_SAVER_DEVICE_SPECIFIC_CONSTANTS,
151                     Settings.Global.BATTERY_STATS_CONSTANTS,
152                     Settings.Global.BINDER_CALLS_STATS,
153                     Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE,
154                     Settings.Global.BLE_SCAN_LOW_POWER_WINDOW_MS,
155                     Settings.Global.BLE_SCAN_LOW_POWER_INTERVAL_MS,
156                     Settings.Global.BLE_SCAN_BALANCED_WINDOW_MS,
157                     Settings.Global.BLE_SCAN_BALANCED_INTERVAL_MS,
158                     Settings.Global.BLE_SCAN_LOW_LATENCY_WINDOW_MS,
159                     Settings.Global.BLE_SCAN_LOW_LATENCY_INTERVAL_MS,
160                     Settings.Global.BLE_SCAN_BACKGROUND_MODE,
161                     Settings.Global.BLOCK_UNTRUSTED_TOUCHES_MODE,
162                     Settings.Global.BLOCKED_SLICES,
163                     Settings.Global.BLOCKING_HELPER_DISMISS_TO_VIEW_RATIO_LIMIT,
164                     Settings.Global.BLOCKING_HELPER_STREAK_LIMIT,
165                     Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE,
166                     Settings.Global.BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX,
167                     Settings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX,
168                     Settings.Global.BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX,
169                     Settings.Global.BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX,
170                     Settings.Global.BLUETOOTH_CLASS_OF_DEVICE,
171                     Settings.Global.BLUETOOTH_DISABLED_PROFILES,
172                     Settings.Global.BLUETOOTH_HEADSET_PRIORITY_PREFIX,
173                     Settings.Global.BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX,
174                     Settings.Global.BLUETOOTH_INTEROPERABILITY_LIST,
175                     Settings.Global.BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX,
176                     Settings.Global.BLUETOOTH_MAP_PRIORITY_PREFIX,
177                     Settings.Global.BLUETOOTH_PAN_PRIORITY_PREFIX,
178                     Settings.Global.BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX,
179                     Settings.Global.BLUETOOTH_SAP_PRIORITY_PREFIX,
180                     Settings.Global.BLUETOOTH_HEARING_AID_PRIORITY_PREFIX,
181                     Settings.Global.BOOT_COUNT,
182                     Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
183                     Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
184                     Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
185                     Settings.Global.CAPTIVE_PORTAL_MODE,
186                     Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
187                     Settings.Global.CAPTIVE_PORTAL_FALLBACK_PROBE_SPECS,
188                     Settings.Global.CAPTIVE_PORTAL_SERVER,
189                     Settings.Global.CAPTIVE_PORTAL_USE_HTTPS,
190                     Settings.Global.CAPTIVE_PORTAL_USER_AGENT,
191                     Settings.Global.CAR_DOCK_SOUND,
192                     Settings.Global.CARRIER_APP_WHITELIST,
193                     Settings.Global.CARRIER_APP_NAMES,
194                     Settings.Global.CAR_UNDOCK_SOUND,
195                     Settings.Global.CDMA_CELL_BROADCAST_SMS,
196                     Settings.Global.CDMA_ROAMING_MODE,
197                     Settings.Global.CDMA_SUBSCRIPTION_MODE,
198                     Settings.Global.CELL_ON,
199                     Settings.Global.CERT_PIN_UPDATE_CONTENT_URL,
200                     Settings.Global.CERT_PIN_UPDATE_METADATA_URL,
201                     Settings.Global.COMPATIBILITY_MODE,
202                     Settings.Global.CONNECTIVITY_CHANGE_DELAY,
203                     Settings.Global.CONNECTIVITY_METRICS_BUFFER_SIZE,
204                     Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
205                     Settings.Global.CONTACT_METADATA_SYNC_ENABLED,
206                     Settings.Global.CONVERSATION_ACTIONS_UPDATE_CONTENT_URL,
207                     Settings.Global.CONVERSATION_ACTIONS_UPDATE_METADATA_URL,
208                     Settings.Global.CONTACTS_DATABASE_WAL_ENABLED,
209                     Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
210                     Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI,
211                     Settings.Global.DATABASE_CREATION_BUILDID,
212                     Settings.Global.DATABASE_DOWNGRADE_REASON,
213                     Settings.Global.DATA_ROAMING,
214                     Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS,
215                     Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS,
216                     Settings.Global.DATA_STALL_RECOVERY_ON_BAD_NETWORK,
217                     Settings.Global.DEBUG_APP,
218                     Settings.Global.DEBUG_VIEW_ATTRIBUTES,
219                     Settings.Global.DEBUG_VIEW_ATTRIBUTES_APPLICATION_PACKAGE,
220                     Settings.Global.DEFAULT_DNS_SERVER,
221                     Settings.Global.DEFAULT_INSTALL_LOCATION,
222                     Settings.Global.DEFAULT_RESTRICT_BACKGROUND_DATA,
223                     Settings.Global.DESK_DOCK_SOUND,
224                     Settings.Global.DESK_UNDOCK_SOUND,
225                     Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT,
226                     Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
227                     Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
228                     Settings.Global.DEVELOPMENT_FORCE_RTL,
229                     Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
230                     Settings.Global.DEVELOPMENT_RENDER_SHADOWS_IN_COMPOSITOR,
231                     Settings.Global.DEVELOPMENT_USE_BLAST_ADAPTER_VR,
232                     Settings.Global.DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH,
233                     Settings.Global.DEVICE_DEMO_MODE,
234                     Settings.Global.DISABLE_WINDOW_BLURS,
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.BYPASS_DEVICE_POLICY_MANAGEMENT_ROLE_QUALIFICATIONS,
242                     Settings.Global.DEVICE_PROVISIONING_MOBILE_DATA_ENABLED,
243                     Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD,
244                     Settings.Global.DISPLAY_PANEL_LPM,
245                     Settings.Global.DISPLAY_SCALING_FORCE,
246                     Settings.Global.DISPLAY_SIZE_FORCED,
247                     Settings.Global.DNS_RESOLVER_MAX_SAMPLES,
248                     Settings.Global.DNS_RESOLVER_MIN_SAMPLES,
249                     Settings.Global.DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS,
250                     Settings.Global.DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT,
251                     Settings.Global.DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY,
252                     Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE,
253                     Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE,
254                     Settings.Global.DROPBOX_AGE_SECONDS,
255                     Settings.Global.DROPBOX_MAX_FILES,
256                     Settings.Global.DROPBOX_QUOTA_KB,
257                     Settings.Global.DROPBOX_QUOTA_PERCENT,
258                     Settings.Global.DROPBOX_RESERVE_PERCENT,
259                     Settings.Global.DROPBOX_TAG_PREFIX,
260                     Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
261                     Settings.Global.EMERGENCY_GESTURE_POWER_BUTTON_COOLDOWN_PERIOD_MS,
262                     Settings.Global.EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS,
263                     Settings.Global.EMULATE_DISPLAY_CUTOUT,
264                     Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
265                     Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
266                     Settings.Global.ENABLE_CELLULAR_ON_BOOT,
267                     Settings.Global.ENABLE_DELETION_HELPER_NO_THRESHOLD_TOGGLE,
268                     Settings.Global.ENABLE_DISKSTATS_LOGGING,
269                     Settings.Global.ENABLE_EPHEMERAL_FEATURE,
270                     Settings.Global.ENABLE_RESTRICTED_BUCKET,
271                     Settings.Global.ENABLE_TARE,
272                     Settings.Global.ENABLE_TARE_ALARM_MANAGER,
273                     Settings.Global.ENABLE_TARE_JOB_SCHEDULER,
274                     Settings.Global.DYNAMIC_POWER_SAVINGS_ENABLED,
275                     Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
276                     Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
277                     Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
278                     Settings.Global.STYLUS_HANDWRITING_ENABLED,
279                     Settings.Global.STYLUS_EVER_USED,
280                     Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
281                     Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
282                     Settings.Global.ENHANCED_4G_MODE_ENABLED,
283                     Settings.Global.EPHEMERAL_COOKIE_MAX_SIZE_BYTES,
284                     Settings.Global.ERROR_LOGCAT_PREFIX,
285                     Settings.Global.EUICC_PROVISIONED,
286                     Settings.Global.EUICC_SUPPORTED_COUNTRIES,
287                     Settings.Global.EUICC_UNSUPPORTED_COUNTRIES,
288                     Settings.Global.EUICC_FACTORY_RESET_TIMEOUT_MILLIS,
289                     Settings.Global.EUICC_REMOVING_INVISIBLE_PROFILES_TIMEOUT_MILLIS,
290                     Settings.Global.EUICC_SWITCH_SLOT_TIMEOUT_MILLIS,
291                     Settings.Global.FANCY_IME_ANIMATIONS,
292                     Settings.Global.ONE_HANDED_KEYGUARD_SIDE,
293                     Settings.Global.FORCE_ALLOW_ON_EXTERNAL,
294                     Settings.Global.FORCED_APP_STANDBY_ENABLED,
295                     Settings.Global.FORCED_APP_STANDBY_FOR_SMALL_BATTERY_ENABLED,
296                     Settings.Global.WIFI_ON_WHEN_PROXY_DISCONNECTED,
297                     Settings.Global.FSTRIM_MANDATORY_INTERVAL,
298                     Settings.Global.FOREGROUND_SERVICE_STARTS_LOGGING_ENABLED,
299                     Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
300                     Settings.Global.GLOBAL_HTTP_PROXY_HOST,
301                     Settings.Global.GLOBAL_HTTP_PROXY_PAC,
302                     Settings.Global.GLOBAL_HTTP_PROXY_PORT,
303                     Settings.Global.GNSS_HAL_LOCATION_REQUEST_DURATION_MILLIS,
304                     Settings.Global.GNSS_SATELLITE_BLOCKLIST,
305                     Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS,
306                     Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED,
307                     Settings.Global.HIDDEN_API_POLICY,
308                     Settings.Global.FORCE_NON_DEBUGGABLE_FINAL_BUILD_FOR_COMPAT,
309                     Settings.Global.HIDE_ERROR_DIALOGS,
310                     Settings.Global.HTTP_PROXY,
311                     HYBRID_SYSUI_BATTERY_WARNING_FLAGS,
312                     Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY,
313                     Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY,
314                     Settings.Global.INSTANT_APP_DEXOPT_ENABLED,
315                     Settings.Global.INTENT_FIREWALL_UPDATE_CONTENT_URL,
316                     Settings.Global.INTENT_FIREWALL_UPDATE_METADATA_URL,
317                     Settings.Global.KEEP_PROFILE_IN_BACKGROUND,
318                     Settings.Global.KERNEL_CPU_THREAD_READER,
319                     Settings.Global.LANG_ID_UPDATE_CONTENT_URL,
320                     Settings.Global.LANG_ID_UPDATE_METADATA_URL,
321                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS,
322                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
323                     Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST,
324                     Settings.Global.LOCATION_ENABLE_STATIONARY_THROTTLE,
325                     Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED,
326                     Settings.Global.LOCK_SOUND,
327                     Settings.Global.LOOPER_STATS,
328                     Settings.Global.LOW_BATTERY_SOUND,
329                     Settings.Global.LOW_BATTERY_SOUND_TIMEOUT,
330                     Settings.Global.LOW_POWER_MODE,
331                     Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL_MAX,
332                     Settings.Global.LOW_POWER_MODE_STICKY,
333                     Settings.Global.LOW_POWER_MODE_SUGGESTION_PARAMS,
334                     Settings.Global.LOW_POWER_STANDBY_ACTIVE_DURING_MAINTENANCE,
335                     Settings.Global.LOW_POWER_STANDBY_ENABLED,
336                     Settings.Global.LTE_SERVICE_FORCED,
337                     Settings.Global.LID_BEHAVIOR,
338                     Settings.Global.MAX_ERROR_BYTES_PREFIX,
339                     Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE,
340                     Settings.Global.MAX_SOUND_TRIGGER_DETECTION_SERVICE_OPS_PER_DAY,
341                     Settings.Global.MAXIMUM_OBSCURING_OPACITY_FOR_TOUCH,
342                     Settings.Global.MDC_INITIAL_MAX_RETRY,
343                     Settings.Global.MHL_INPUT_SWITCHING_ENABLED,
344                     Settings.Global.MHL_POWER_CHARGE_ENABLED,
345                     Settings.Global.MIN_DURATION_BETWEEN_RECOVERY_STEPS_IN_MS,
346                     Settings.Global.MOBILE_DATA, // Candidate for backup?
347                     Settings.Global.MOBILE_DATA_ALWAYS_ON,
348                     Settings.Global.MODE_RINGER,
349                     Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION,
350                     Settings.Global.MULTI_SIM_SMS_PROMPT,
351                     Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION,
352                     Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
353                     Settings.Global.MULTI_SIM_VOICE_PROMPT,
354                     Settings.Global.NATIVE_FLAGS_HEALTH_CHECK_ENABLED,
355                     Settings.Global.NETSTATS_DEV_BUCKET_DURATION,
356                     Settings.Global.NETSTATS_DEV_DELETE_AGE,
357                     Settings.Global.NETSTATS_DEV_PERSIST_BYTES,
358                     Settings.Global.NETSTATS_DEV_ROTATE_AGE,
359                     Settings.Global.NETSTATS_ENABLED,
360                     Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES,
361                     Settings.Global.NETSTATS_POLL_INTERVAL,
362                     Settings.Global.NETSTATS_SAMPLE_ENABLED,
363                     Settings.Global.NETSTATS_AUGMENT_ENABLED,
364                     Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED,
365                     Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE,
366                     Settings.Global.NETSTATS_UID_BUCKET_DURATION,
367                     Settings.Global.NETSTATS_UID_DELETE_AGE,
368                     Settings.Global.NETSTATS_UID_PERSIST_BYTES,
369                     Settings.Global.NETSTATS_UID_ROTATE_AGE,
370                     Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION,
371                     Settings.Global.NETSTATS_UID_TAG_DELETE_AGE,
372                     Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES,
373                     Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE,
374                     Settings.Global.NETPOLICY_QUOTA_ENABLED,
375                     Settings.Global.NETPOLICY_QUOTA_UNLIMITED,
376                     Settings.Global.NETPOLICY_QUOTA_LIMITED,
377                     Settings.Global.NETPOLICY_QUOTA_FRAC_JOBS,
378                     Settings.Global.NETPOLICY_QUOTA_FRAC_MULTIPATH,
379                     Settings.Global.NETPOLICY_OVERRIDE_ENABLED,
380                     Settings.Global.NETWORK_DEFAULT_DAILY_MULTIPATH_QUOTA_BYTES,
381                     Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE,
382                     Settings.Global.NETWORK_WATCHLIST_LAST_REPORT_TIME,
383                     Settings.Global.NETWORK_PREFERENCE,
384                     Settings.Global.NETWORK_RECOMMENDATIONS_PACKAGE,
385                     Settings.Global.NETWORK_SCORER_APP,
386                     Settings.Global.NETWORK_SCORING_PROVISIONED,
387                     Settings.Global.NETWORK_SCORING_UI_ENABLED,
388                     Settings.Global.NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT,
389                     Settings.Global.NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS,
390                     Settings.Global.NETWORK_WATCHLIST_ENABLED,
391                     Settings.Global.NEW_CONTACT_AGGREGATOR,
392                     Settings.Global.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE,
393                     Settings.Global.NITZ_NETWORK_DISCONNECT_RETENTION,
394                     Settings.Global.NITZ_UPDATE_DIFF,
395                     Settings.Global.NITZ_UPDATE_SPACING,
396                     Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,
397                     Settings.Global.NOTIFICATION_FEEDBACK_ENABLED,
398                     Settings.Global.NR_NSA_TRACKING_SCREEN_OFF_MODE,
399                     Settings.Global.NTP_SERVER,
400                     Settings.Global.NTP_TIMEOUT,
401                     Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,
402                     Settings.Global.OVERLAY_DISPLAY_DEVICES,
403                     Settings.Global.PAC_CHANGE_DELAY,
404                     Settings.Global.PACKAGE_STREAMING_VERIFIER_TIMEOUT,
405                     Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE,
406                     Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB,
407                     Settings.Global.PACKAGE_VERIFIER_SETTING_VISIBLE,
408                     Settings.Global.PACKAGE_VERIFIER_TIMEOUT,
409                     Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT,
410                     Settings.Global.PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS,
411                     Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS,
412                     Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT,
413                     Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS,
414                     Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT,
415                     Settings.Global.PEOPLE_SPACE_CONVERSATION_TYPE,
416                     Settings.Global.POLICY_CONTROL,
417                     Settings.Global.POWER_BUTTON_SUPPRESSION_DELAY_AFTER_GESTURE_WAKE,
418                     Settings.Global.POWER_MANAGER_CONSTANTS,
419                     Settings.Global.PREFERRED_NETWORK_MODE,
420                     Settings.Global.PRIVATE_DNS_DEFAULT_MODE,
421                     Settings.Global.PROVISIONING_APN_ALARM_DELAY_IN_MS,
422                     Settings.Global.RADIO_BLUETOOTH,
423                     Settings.Global.RADIO_CELL,
424                     Settings.Global.RADIO_NFC,
425                     Settings.Global.RADIO_WIFI,
426                     Settings.Global.RADIO_WIMAX,
427                     Settings.Global.REMOVE_GUEST_ON_EXIT,
428                     Settings.Global.RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS,
429                     Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT,
430                     Settings.Global.RESTRICTED_NETWORKING_MODE,
431                     Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT,
432                     Settings.Global.SAFE_BOOT_DISALLOWED,
433                     Settings.Global.SELINUX_STATUS,
434                     Settings.Global.SELINUX_UPDATE_CONTENT_URL,
435                     Settings.Global.SELINUX_UPDATE_METADATA_URL,
436                     Settings.Global.SEND_ACTION_APP_ERROR,
437                     Settings.Global.SET_GLOBAL_HTTP_PROXY,
438                     Settings.Global.SET_INSTALL_LOCATION,
439                     Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL,
440                     Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST,
441                     Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL,
442                     Settings.Global.SETTINGS_USE_EXTERNAL_PROVIDER_API,
443                     Settings.Global.SETTINGS_USE_PSD_API,
444                     Settings.Global.SHORTCUT_MANAGER_CONSTANTS,
445                     Settings.Global.SHOW_FIRST_CRASH_DIALOG,
446                     Settings.Global.SHOW_HIDDEN_LAUNCHER_ICON_APPS_ENABLED,
447                     Settings.Global.SHOW_MUTE_IN_CRASH_DIALOG,
448                     Settings.Global.SHOW_NEW_APP_INSTALLED_NOTIFICATION_ENABLED,
449                     Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
450                     Settings.Global.SHOW_PEOPLE_SPACE,
451                     Settings.Global.SHOW_NEW_NOTIF_DISMISS,
452                     Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG,
453                     Settings.Global.SHOW_TEMPERATURE_WARNING,
454                     Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
455                     Settings.Global.SIGNED_CONFIG_VERSION,
456                     Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
457                     Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
458                     Settings.Global.SMS_OUTGOING_CHECK_INTERVAL_MS,
459                     Settings.Global.SMS_OUTGOING_CHECK_MAX_COUNT,
460                     Settings.Global.SMS_SHORT_CODE_CONFIRMATION,
461                     Settings.Global.SMS_SHORT_CODE_RULE,
462                     Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL,
463                     Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL,
464                     Settings.Global.SOUND_TRIGGER_DETECTION_SERVICE_OP_TIMEOUT,
465                     Settings.Global.SPEED_LABEL_CACHE_EVICTION_AGE_MILLIS,
466                     Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS,
467                     Settings.Global.STORAGE_BENCHMARK_INTERVAL,
468                     Settings.Global.STORAGE_SETTINGS_CLOBBER_THRESHOLD,
469                     Settings.Global.SYNC_MANAGER_CONSTANTS,
470                     Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
471                     Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
472                     Settings.Global.SYS_STORAGE_CACHE_PERCENTAGE,
473                     Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES,
474                     Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES,
475                     Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE,
476                     Settings.Global.SYS_UIDCPUPOWER,
477                     Settings.Global.SYS_TRACED,
478                     Settings.Global.FPS_DEVISOR,
479                     Settings.Global.TARE_ALARM_MANAGER_CONSTANTS,
480                     Settings.Global.TARE_JOB_SCHEDULER_CONSTANTS,
481                     Settings.Global.TCP_DEFAULT_INIT_RWND,
482                     Settings.Global.TETHER_DUN_APN,
483                     Settings.Global.TETHER_DUN_REQUIRED,
484                     Settings.Global.TETHER_OFFLOAD_DISABLED,
485                     Settings.Global.TETHER_SUPPORTED,
486                     Settings.Global.TETHER_ENABLE_LEGACY_DHCP_SERVER,
487                     Settings.Global.TEXT_CLASSIFIER_CONSTANTS,
488                     Settings.Global.TEXT_CLASSIFIER_ACTION_MODEL_PARAMS,
489                     Settings.Global.THEATER_MODE_ON,
490                     Settings.Global.TIME_ONLY_MODE_CONSTANTS,
491                     Settings.Global.TIME_REMAINING_ESTIMATE_MILLIS,
492                     Settings.Global.TIME_REMAINING_ESTIMATE_BASED_ON_USAGE,
493                     Settings.Global.TRANSITION_ANIMATION_SCALE,
494                     Settings.Global.TRUSTED_SOUND,
495                     Settings.Global.TZINFO_UPDATE_CONTENT_URL,
496                     Settings.Global.TZINFO_UPDATE_METADATA_URL,
497                     Settings.Global.INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
498                     Settings.Global.INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
499                     Settings.Global.UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD,
500                     Settings.Global.UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD,
501                     Settings.Global.UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD,
502                     Settings.Global.UNGAZE_SLEEP_ENABLED,
503                     Settings.Global.UNLOCK_SOUND,
504                     Settings.Global.USE_GOOGLE_MAIL,
505                     Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
506                     Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
507                     Settings.Global.VT_IMS_ENABLED,
508                     Settings.Global.WAIT_FOR_DEBUGGER,
509                     Settings.Global.ENABLE_GPU_DEBUG_LAYERS,
510                     Settings.Global.GPU_DEBUG_APP,
511                     Settings.Global.GPU_DEBUG_LAYERS,
512                     Settings.Global.GPU_DEBUG_LAYERS_GLES,
513                     Settings.Global.ANGLE_DEBUG_PACKAGE,
514                     Settings.Global.ANGLE_GL_DRIVER_ALL_ANGLE,
515                     Settings.Global.ANGLE_GL_DRIVER_SELECTION_PKGS,
516                     Settings.Global.ANGLE_GL_DRIVER_SELECTION_VALUES,
517                     Settings.Global.ANGLE_EGL_FEATURES,
518                     Settings.Global.UPDATABLE_DRIVER_ALL_APPS,
519                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_IN_APPS,
520                     Settings.Global.UPDATABLE_DRIVER_PRERELEASE_OPT_IN_APPS,
521                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_OPT_OUT_APPS,
522                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLISTS,
523                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_DENYLIST,
524                     Settings.Global.UPDATABLE_DRIVER_PRODUCTION_ALLOWLIST,
525                     Settings.Global.UPDATABLE_DRIVER_SPHAL_LIBRARIES,
526                     Settings.Global.UWB_ENABLED,
527                     Settings.Global.SHOW_ANGLE_IN_USE_DIALOG_BOX,
528                     Settings.Global.GPU_DEBUG_LAYER_APP,
529                     Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
530                     Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
531                     Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS,
532                     Settings.Global.USER_SWITCHER_ENABLED,
533                     Settings.Global.WARNING_TEMPERATURE,
534                     Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
535                     Settings.Global.WEBVIEW_MULTIPROCESS,
536                     Settings.Global.WEBVIEW_PROVIDER,
537                     Settings.Global.WFC_IMS_ENABLED,
538                     Settings.Global.WFC_IMS_MODE,
539                     Settings.Global.WFC_IMS_ROAMING_ENABLED,
540                     Settings.Global.WFC_IMS_ROAMING_MODE,
541                     Settings.Global.WIFI_ALWAYS_REQUESTED,
542                     Settings.Global.WIFI_BADGING_THRESHOLDS,
543                     Settings.Global.WIFI_BOUNCE_DELAY_OVERRIDE_MS,
544                     Settings.Global.WIFI_COUNTRY_CODE,
545                     Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN,
546                     Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON,
547                     Settings.Global.WIFI_DISPLAY_ON,
548                     Settings.Global.WIFI_DISPLAY_WPS_CONFIG,
549                     Settings.Global.WIFI_ENHANCED_AUTO_JOIN,
550                     Settings.Global.WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS,
551                     Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS,
552                     Settings.Global.WIFI_FREQUENCY_BAND,
553                     Settings.Global.WIFI_IDLE_MS,
554                     Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT,
555                     Settings.Global.WIFI_MIGRATION_COMPLETED,
556                     Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS,
557                     Settings.Global.WIFI_NETWORK_SHOW_RSSI,
558                     Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
559                     Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT,
560                     Settings.Global.WIFI_ON,
561                     Settings.Global.WIFI_P2P_DEVICE_NAME,
562                     Settings.Global.WIFI_P2P_PENDING_FACTORY_RESET,
563                     Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE,
564                     Settings.Global.WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS,
565                     Settings.Global.WIFI_SCAN_THROTTLE_ENABLED,
566                     Settings.Global.WIFI_SCORE_PARAMS,
567                     Settings.Global.WIFI_SLEEP_POLICY,
568                     Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS,
569                     Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED,
570                     Settings.Global.WIFI_WATCHDOG_ON,
571                     Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON,
572                     Settings.Global.CHARGING_STARTED_SOUND,
573                     Settings.Global.WIRELESS_CHARGING_STARTED_SOUND,
574                     Settings.Global.WINDOW_ANIMATION_SCALE,
575                     Settings.Global.WTF_IS_FATAL,
576                     Settings.Global.ZEN_MODE,
577                     Settings.Global.ZEN_MODE_CONFIG_ETAG,
578                     Settings.Global.ZEN_MODE_RINGER_LEVEL,
579                     Settings.Global.ZRAM_ENABLED,
580                     Settings.Global.OVERRIDE_SETTINGS_PROVIDER_RESTORE_ANY_VERSION,
581                     Settings.Global.CHAINED_BATTERY_ATTRIBUTION_ENABLED,
582                     Settings.Global.HIDDEN_API_BLACKLIST_EXEMPTIONS,
583                     Settings.Global.BACKUP_AGENT_TIMEOUT_PARAMETERS,
584                     Settings.Global.APPOP_HISTORY_PARAMETERS,
585                     Settings.Global.APPOP_HISTORY_MODE,
586                     Settings.Global.APPOP_HISTORY_INTERVAL_MULTIPLIER,
587                     Settings.Global.APPOP_HISTORY_BASE_INTERVAL_MILLIS,
588                     Settings.Global.AUTO_REVOKE_PARAMETERS,
589                     Settings.Global.ENABLE_RADIO_BUG_DETECTION,
590                     Settings.Global.RADIO_BUG_WAKELOCK_TIMEOUT_COUNT_THRESHOLD,
591                     Settings.Global.RADIO_BUG_SYSTEM_ERROR_COUNT_THRESHOLD,
592                     Settings.Global.ENABLED_SUBSCRIPTION_FOR_SLOT,
593                     Settings.Global.MODEM_STACK_ENABLED_FOR_SLOT,
594                     Settings.Global.POWER_BUTTON_VERY_LONG_PRESS,
595                     Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, // Temporary for R beta
596                     Settings.Global.INTEGRITY_CHECK_INCLUDES_RULE_PROVIDER,
597                     Settings.Global.CACHED_APPS_FREEZER_ENABLED,
598                     Settings.Global.APP_INTEGRITY_VERIFICATION_TIMEOUT,
599                     Settings.Global.KEY_CHORD_POWER_VOLUME_UP,
600                     Settings.Global.CLOCKWORK_HOME_READY,
601                     Settings.Global.WATCHDOG_TIMEOUT_MILLIS,
602                     Settings.Global.MANAGED_PROVISIONING_DEFER_PROVISIONING_TO_ROLE_HOLDER,
603                     Settings.Global.REVIEW_PERMISSIONS_NOTIFICATION_STATE,
604                     Settings.Global.ENABLE_BACK_ANIMATION, // Temporary for T, dev option only
605                     Settings.Global.Wearable.BATTERY_SAVER_MODE,
606                     Settings.Global.Wearable.COMBINED_LOCATION_ENABLED,
607                     Settings.Global.Wearable.HAS_PAY_TOKENS,
608                     Settings.Global.Wearable.GMS_CHECKIN_TIMEOUT_MIN,
609                     Settings.Global.Wearable.HOTWORD_DETECTION_ENABLED,
610                     Settings.Global.Wearable.SMART_REPLIES_ENABLED,
611                     Settings.Global.Wearable.DEFAULT_VIBRATION,
612                     Settings.Global.Wearable.OBTAIN_PAIRED_DEVICE_LOCATION,
613                     Settings.Global.Wearable.RETAIL_MODE,
614                     Settings.Global.Wearable.PHONE_PLAY_STORE_AVAILABILITY,
615                     Settings.Global.Wearable.BUG_REPORT,
616                     Settings.Global.Wearable.SMART_ILLUMINATE_ENABLED,
617                     Settings.Global.Wearable.CLOCKWORK_AUTO_TIME,
618                     Settings.Global.Wearable.CLOCKWORK_AUTO_TIME_ZONE,
619                     Settings.Global.Wearable.CLOCKWORK_24HR_TIME,
620                     Settings.Global.Wearable.AUTO_WIFI,
621                     Settings.Global.Wearable.WIFI_POWER_SAVE,
622                     Settings.Global.Wearable.ALT_BYPASS_WIFI_REQUIREMENT_TIME_MILLIS,
623                     Settings.Global.Wearable.SETUP_SKIPPED,
624                     Settings.Global.Wearable.LAST_CALL_FORWARD_ACTION,
625                     Settings.Global.Wearable.STEM_1_TYPE,
626                     Settings.Global.Wearable.STEM_1_DATA,
627                     Settings.Global.Wearable.STEM_1_DEFAULT_DATA,
628                     Settings.Global.Wearable.STEM_2_TYPE,
629                     Settings.Global.Wearable.STEM_2_DATA,
630                     Settings.Global.Wearable.STEM_2_DEFAULT_DATA,
631                     Settings.Global.Wearable.STEM_3_TYPE,
632                     Settings.Global.Wearable.STEM_3_DATA,
633                     Settings.Global.Wearable.STEM_3_DEFAULT_DATA,
634                     Settings.Global.Wearable.MUTE_WHEN_OFF_BODY_ENABLED,
635                     Settings.Global.Wearable.WEAR_OS_VERSION_STRING,
636                     Settings.Global.Wearable.CORNER_ROUNDNESS,
637                     Settings.Global.Wearable.BUTTON_SET,
638                     Settings.Global.Wearable.SIDE_BUTTON,
639                     Settings.Global.Wearable.ANDROID_WEAR_VERSION,
640                     Settings.Global.Wearable.SYSTEM_CAPABILITIES,
641                     Settings.Global.Wearable.SYSTEM_EDITION,
642                     Settings.Global.Wearable.WEAR_PLATFORM_MR_NUMBER,
643                     Settings.Global.Wearable.MOBILE_SIGNAL_DETECTOR,
644                     Settings.Global.Wearable.AMBIENT_ENABLED,
645                     Settings.Global.Wearable.AMBIENT_TILT_TO_WAKE,
646                     Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED_DEV,
647                     Settings.Global.Wearable.AMBIENT_TOUCH_TO_WAKE,
648                     Settings.Global.Wearable.AMBIENT_TILT_TO_BRIGHT,
649                     Settings.Global.Wearable.DECOMPOSABLE_WATCHFACE,
650                     Settings.Global.Wearable.AMBIENT_FORCE_WHEN_DOCKED,
651                     Settings.Global.Wearable.AMBIENT_LOW_BIT_ENABLED,
652                     Settings.Global.Wearable.AMBIENT_PLUGGED_TIMEOUT_MIN,
653                     Settings.Global.Wearable.PAIRED_DEVICE_OS_TYPE,
654                     Settings.Global.Wearable.COMPANION_BLE_ROLE,
655                     Settings.Global.Wearable.COMPANION_NAME,
656                     Settings.Global.Wearable.USER_HFP_CLIENT_SETTING,
657                     Settings.Global.Wearable.COMPANION_OS_VERSION,
658                     Settings.Global.Wearable.ENABLE_ALL_LANGUAGES,
659                     Settings.Global.Wearable.SETUP_LOCALE,
660                     Settings.Global.Wearable.OEM_SETUP_VERSION,
661                     Settings.Global.Wearable.MASTER_GESTURES_ENABLED,
662                     Settings.Global.Wearable.UNGAZE_ENABLED,
663                     Settings.Global.Wearable.WEAR_ACTIVITY_AUTO_RESUME_TIMEOUT_MS,
664                     Settings.Global.Wearable.BURN_IN_PROTECTION_ENABLED,
665                     Settings.Global.Wearable.WRIST_ORIENTATION_MODE,
666                     Settings.Global.Wearable.CLOCKWORK_SYSUI_PACKAGE,
667                     Settings.Global.Wearable.CLOCKWORK_SYSUI_MAIN_ACTIVITY,
668                     Settings.Global.Wearable.CLOCKWORK_LONG_PRESS_TO_ASSISTANT_ENABLED,
669                     Settings.Global.Wearable.WEAR_ACTIVITY_AUTO_RESUME_TIMEOUT_SET_BY_USER,
670                     Settings.Global.Wearable.WET_MODE_ON,
671                     Settings.Global.Wearable.COOLDOWN_MODE_ON);
672 
673     private static final Set<String> BACKUP_DENY_LIST_SECURE_SETTINGS =
674              newHashSet(
675                  Settings.Secure.ACCESSIBILITY_SOFT_KEYBOARD_MODE,
676                  Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, // Deprecated since O.
677                  Settings.Secure.ALLOWED_GEOLOCATION_ORIGINS,
678                  Settings.Secure.ALWAYS_ON_VPN_APP,
679                  Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN,
680                  Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN_WHITELIST,
681                  Settings.Secure.ANDROID_ID,
682                  Settings.Secure.ANR_SHOW_BACKGROUND,
683                  Settings.Secure.ASSISTANT,
684                  Settings.Secure.ASSIST_DISCLOSURE_ENABLED,
685                  Settings.Secure.ASSIST_GESTURE_ENABLED,
686                  Settings.Secure.ASSIST_GESTURE_SENSITIVITY,
687                  Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED,
688                  Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
689                  Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
690                  Settings.Secure.ASSIST_SCREENSHOT_ENABLED,
691                  Settings.Secure.ASSIST_STRUCTURE_ENABLED,
692                  Settings.Secure.ATTENTIVE_TIMEOUT,
693                  Settings.Secure.AUTOFILL_FEATURE_FIELD_CLASSIFICATION,
694                  Settings.Secure.AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT,
695                  Settings.Secure.AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE,
696                  Settings.Secure.AUTOFILL_USER_DATA_MAX_USER_DATA_SIZE,
697                  Settings.Secure.AUTOFILL_USER_DATA_MAX_VALUE_LENGTH,
698                  Settings.Secure.AUTOFILL_USER_DATA_MIN_VALUE_LENGTH,
699                  Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI,
700                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED,
701                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
702                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN,
703                  Settings.Secure.AUTOMATIC_STORAGE_MANAGER_TURNED_OFF_BY_POLICY,
704                  Settings.Secure.BACKUP_AUTO_RESTORE,
705                  Settings.Secure.BACKUP_ENABLED,
706                  Settings.Secure.BACKUP_PROVISIONED,
707                  Settings.Secure.BACKUP_TRANSPORT,
708                  Settings.Secure.CALL_SCREENING_DEFAULT_COMPONENT,
709                  Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, // Candidate for backup?
710                  Settings.Secure.CARRIER_APPS_HANDLED,
711                  Settings.Secure.CMAS_ADDITIONAL_BROADCAST_PKG,
712                  Settings.Secure.COMPLETED_CATEGORY_PREFIX,
713                  Settings.Secure.CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS,
714                  Settings.Secure.CONTENT_CAPTURE_ENABLED,
715                  Settings.Secure.DEFAULT_INPUT_METHOD,
716                  Settings.Secure.DEVICE_PAIRED,
717                  Settings.Secure.DIALER_DEFAULT_APPLICATION,
718                  Settings.Secure.DISABLED_PRINT_SERVICES,
719                  Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS,
720                  Settings.Secure.DOCKED_CLOCK_FACE,
721                  Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
722                  Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION,
723                  Settings.Secure.ENABLED_ACCESSIBILITY_AUDIO_DESCRIPTION_BY_DEFAULT,
724                  Settings.Secure.ENABLED_INPUT_METHODS,  // Intentionally removed in P
725                  Settings.Secure.ENABLED_NOTIFICATION_ASSISTANT,
726                  Settings.Secure.ENABLED_NOTIFICATION_LISTENERS,
727                  Settings.Secure.ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES,
728                  Settings.Secure.ENABLED_PRINT_SERVICES,
729                  Settings.Secure.GLOBAL_ACTIONS_PANEL_AVAILABLE,
730                  Settings.Secure.GLOBAL_ACTIONS_PANEL_DEBUG_ENABLED,
731                  Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
732                  Settings.Secure.INCALL_BACK_BUTTON_BEHAVIOR,
733                  Settings.Secure.INPUT_METHOD_SELECTOR_VISIBILITY,
734                  Settings.Secure.INPUT_METHODS_SUBTYPE_HISTORY,
735                  Settings.Secure.INSTALL_NON_MARKET_APPS,
736                  Settings.Secure.LAST_SETUP_SHOWN,
737                  Settings.Secure.LOCATION_CHANGER,
738                  Settings.Secure.LOCATION_MODE,
739                  Settings.Secure.LOCATION_PERMISSIONS_UPGRADE_TO_Q_MODE,
740                  Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, // Candidate?
741                  Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
742                  Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
743                  Settings.Secure.MANAGED_PROFILE_CONTACT_REMOTE_SEARCH,
744                  Settings.Secure.MULTI_PRESS_TIMEOUT,
745                  Settings.Secure.NFC_PAYMENT_FOREGROUND,
746                  Settings.Secure.NIGHT_DISPLAY_ACTIVATED,
747                  Settings.Secure.NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
748                  Settings.Secure.NUM_ROTATION_SUGGESTIONS_ACCEPTED,
749                  Settings.Secure.ODI_CAPTIONS_ENABLED,
750                  Settings.Secure.PARENTAL_CONTROL_LAST_UPDATE,
751                  Settings.Secure.PAYMENT_SERVICE_SEARCH_URI,
752                  Settings.Secure.PRINT_SERVICE_SEARCH_URI,
753                  Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT, // Candidate?
754                  Settings.Secure.SEARCH_GLOBAL_SEARCH_ACTIVITY,
755                  Settings.Secure.SEARCH_MAX_RESULTS_PER_SOURCE,
756                  Settings.Secure.SEARCH_MAX_RESULTS_TO_DISPLAY,
757                  Settings.Secure.SEARCH_MAX_SHORTCUTS_RETURNED,
758                  Settings.Secure.SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS,
759                  Settings.Secure.SEARCH_MAX_STAT_AGE_MILLIS,
760                  Settings.Secure.SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING,
761                  Settings.Secure.SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING,
762                  Settings.Secure.SEARCH_NUM_PROMOTED_SOURCES,
763                  Settings.Secure.SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT,
764                  Settings.Secure.SEARCH_PREFILL_MILLIS,
765                  Settings.Secure.SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS,
766                  Settings.Secure.SEARCH_QUERY_THREAD_CORE_POOL_SIZE,
767                  Settings.Secure.SEARCH_QUERY_THREAD_MAX_POOL_SIZE,
768                  Settings.Secure.SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE,
769                  Settings.Secure.SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE,
770                  Settings.Secure.SEARCH_SOURCE_TIMEOUT_MILLIS,
771                  Settings.Secure.SEARCH_THREAD_KEEPALIVE_SECONDS,
772                  Settings.Secure.SECURE_FRP_MODE,
773                  Settings.Secure.SEARCH_WEB_RESULTS_OVERRIDE_LIMIT,
774                  Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE,
775                  Settings.Secure.SELECTED_SPELL_CHECKER,  // Intentionally removed in Q
776                  Settings.Secure.SELECTED_SPELL_CHECKER_SUBTYPE,  // Intentionally removed in Q
777                  Settings.Secure.SETTINGS_CLASSNAME,
778                  Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, // candidate?
779                  Settings.Secure.SHOW_ROTATION_SUGGESTIONS,
780                  Settings.Secure.SKIP_FIRST_USE_HINTS, // candidate?
781                  Settings.Secure.SLEEP_TIMEOUT,
782                  Settings.Secure.SMS_DEFAULT_APPLICATION,
783                  Settings.Secure.SPELL_CHECKER_ENABLED,  // Intentionally removed in Q
784                  Settings.Secure.TRUST_AGENTS_INITIALIZED,
785                  Settings.Secure.KNOWN_TRUST_AGENTS_INITIALIZED,
786                  Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS,
787                  Settings.Secure.TV_INPUT_CUSTOM_LABELS,
788                  Settings.Secure.TV_INPUT_HIDDEN_INPUTS,
789                  Settings.Secure.TV_USER_SETUP_COMPLETE,
790                  Settings.Secure.UNKNOWN_SOURCES_DEFAULT_REVERSED,
791                  Settings.Secure.UNSAFE_VOLUME_MUSIC_ACTIVE_MS,
792                  Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
793                  Settings.Secure.USER_SETUP_COMPLETE,
794                  Settings.Secure.USER_SETUP_PERSONALIZATION_STATE,
795                  Settings.Secure.VOICE_INTERACTION_SERVICE,
796                  Settings.Secure.VOICE_RECOGNITION_SERVICE,
797                  Settings.Secure.INSTANT_APPS_ENABLED,
798                  Settings.Secure.BACKUP_MANAGER_CONSTANTS,
799                  Settings.Secure.BACKUP_LOCAL_TRANSPORT_PARAMETERS,
800                  Settings.Secure.KEYGUARD_SLICE_URI,
801                  Settings.Secure.PARENTAL_CONTROL_ENABLED,
802                  Settings.Secure.PARENTAL_CONTROL_REDIRECT_URL,
803                  Settings.Secure.BLUETOOTH_ON_WHILE_DRIVING,
804                  Settings.Secure.LOW_POWER_MANUAL_ACTIVATION_COUNT,
805                  Settings.Secure.LOW_POWER_WARNING_ACKNOWLEDGED,
806                  Settings.Secure.SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION,
807                  Settings.Secure.PACKAGES_TO_CLEAR_DATA_BEFORE_FULL_RESTORE,
808                  Settings.Secure.FLASHLIGHT_AVAILABLE,
809                  Settings.Secure.FLASHLIGHT_ENABLED,
810                  Settings.Secure.CROSS_PROFILE_CALENDAR_ENABLED,
811                  Settings.Secure.LOCATION_ACCESS_CHECK_INTERVAL_MILLIS,
812                  Settings.Secure.LOCATION_ACCESS_CHECK_DELAY_MILLIS,
813                  Settings.Secure.BIOMETRIC_DEBUG_ENABLED,
814                  Settings.Secure.FACE_UNLOCK_ATTENTION_REQUIRED,
815                  Settings.Secure.FACE_UNLOCK_DIVERSITY_REQUIRED,
816                  Settings.Secure.MANAGED_PROVISIONING_DPC_DOWNLOADED,
817                  Settings.Secure.AWARE_ENABLED,
818                  Settings.Secure.SKIP_GESTURE,
819                  Settings.Secure.SILENCE_GESTURE,
820                  Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
821                  Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
822                  Settings.Secure.DOZE_QUICK_PICKUP_GESTURE,
823                  Settings.Secure.FACE_UNLOCK_RE_ENROLL,
824                  Settings.Secure.TAP_GESTURE,
825                  Settings.Secure.NEARBY_SHARING_COMPONENT, // not user configurable
826                  Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_MAGNIFICATION_CONTROLLER,
827                  Settings.Secure.SUPPRESS_DOZE,
828                  Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED,
829                  Settings.Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT,
830                  Settings.Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT,
831                  Settings.Secure.UI_TRANSLATION_ENABLED);
832 
833     @Test
systemSettingsBackedUpOrDenied()834     public void systemSettingsBackedUpOrDenied() {
835         checkSettingsBackedUpOrDenied(
836                 getCandidateSettings(Settings.System.class),
837                 newHashSet(SystemSettings.SETTINGS_TO_BACKUP),
838                 BACKUP_DENY_LIST_SYSTEM_SETTINGS);
839     }
840 
841     @Test
globalSettingsBackedUpOrDenied()842     public void globalSettingsBackedUpOrDenied() {
843         Set<String> candidateSettings = getCandidateSettings(Settings.Global.class);
844         candidateSettings.addAll(getCandidateSettings(Settings.Global.Wearable.class));
845         checkSettingsBackedUpOrDenied(
846                 candidateSettings,
847                 newHashSet(GlobalSettings.SETTINGS_TO_BACKUP),
848                 BACKUP_DENY_LIST_GLOBAL_SETTINGS);
849     }
850 
851     @Test
852     @Suppress //("b/148236308")
secureSettingsBackedUpOrDenied()853     public void secureSettingsBackedUpOrDenied() {
854         HashSet<String> keys = new HashSet<String>();
855         Collections.addAll(keys, SecureSettings.SETTINGS_TO_BACKUP);
856         Collections.addAll(keys, DEVICE_SPECIFIC_SETTINGS_TO_BACKUP);
857         checkSettingsBackedUpOrDenied(
858                 getCandidateSettings(Settings.Secure.class),
859                 keys,
860                 BACKUP_DENY_LIST_SECURE_SETTINGS);
861     }
862 
checkSettingsBackedUpOrDenied( Set<String> settings, Set<String> settingsToBackup, Set<String> denylist)863     private static void checkSettingsBackedUpOrDenied(
864             Set<String> settings, Set<String> settingsToBackup, Set<String> denylist) {
865         Set<String> settingsNotBackedUp = difference(settings, settingsToBackup);
866         Set<String> settingsNotBackedUpOrDenied = difference(settingsNotBackedUp, denylist);
867         assertWithMessage("Settings not backed up or denied")
868                 .that(settingsNotBackedUpOrDenied).isEmpty();
869 
870         assertWithMessage("denied settings backed up")
871                 .that(intersect(settingsToBackup, denylist)).isEmpty();
872     }
873 
getCandidateSettings(Class<?> clazz)874     private static Set<String> getCandidateSettings(Class<?> clazz) {
875         HashSet<String> result = new HashSet<String>();
876         for (Field field : clazz.getDeclaredFields()) {
877             if (looksLikeValidSetting(field)) {
878                 try {
879                     result.add((String) field.get(null));
880                 } catch (IllegalAccessException e) {
881                     // Impossible for public fields
882                     throw new RuntimeException(e);
883                 }
884             }
885         }
886         return result;
887     }
888 
looksLikeValidSetting(Field field)889     private static boolean looksLikeValidSetting(Field field) {
890         int modifiers = field.getModifiers();
891         return isPublic(modifiers)
892                 && isStatic(modifiers)
893                 && isFinal(modifiers)
894                 && field.getType() == String.class
895                 && field.getAnnotation(Deprecated.class) == null;
896     }
897 
difference(Set<T> s1, Set<T> s2)898     private static <T> Set<T> difference(Set<T> s1, Set<T> s2) {
899         HashSet<T> result = new HashSet<T>(s1);
900         result.removeAll(s2);
901         return result;
902     }
903 
intersect(Set<T> s1, Set<T> s2)904     private static <T> Set<T> intersect(Set<T> s1, Set<T> s2) {
905         HashSet<T> result = new HashSet<T>(s1);
906         result.retainAll(s2);
907         return result;
908     }
909 
910 }
911