Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55eb1a0a authored by Al Sutton's avatar Al Sutton Committed by Android (Google) Code Review
Browse files

Merge changes from topic "ExtractBackupDataFromSettings"

* changes:
  Move the list of settings to backup out of the Settings class
  Move the validators out of the settings class
parents 94a973b5 0833b2e6
Loading
Loading
Loading
Loading
+0 −1404

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ android_test {
    // because this test is not an instrumentation test. (because the target runs in the system process.)
    srcs: [
        "test/**/*.java",
        "src/android/provider/settings/backup/*",
        "src/android/provider/settings/validators/*",
        "src/com/android/providers/settings/SettingsBackupAgent.java",
        "src/com/android/providers/settings/SettingsState.java",
        "src/com/android/providers/settings/SettingsHelper.java",
@@ -31,6 +33,8 @@ android_test {
    static_libs: [
        "androidx.test.rules",
        "SettingsLibDisplayDensityUtils",
        "platform-test-annotations",
        "truth-prebuilt",
    ],
    libs: [
        "android.test.base",
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.provider.settings.backup;

import android.provider.Settings;

/** Information related to the backup of Global settings */
public class GlobalSettings {

    /**
     * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in SystemSettings
     * and SecureSettings as well.  This is because those tables drive both backup and
     * restore, and restore needs to properly whitelist keys that used to live
     * in those namespaces.
     *
     * NOTE: Settings are backed up and restored in the order they appear
     *       in this array. If you have one setting depending on another,
     *       make sure that they are ordered appropriately.
     *
     * NOTE: This table should only be used for settings which should be restored
     *       between different types of devices
     *       {@see #Settings.Secure.DEVICE_SPECIFIC_SETTINGS_TO_BACKUP}
     *
     * NOTE: All settings which are backed up should have a corresponding validator.
     */
    public static final String[] SETTINGS_TO_BACKUP = {
        Settings.Global.APPLY_RAMPING_RINGER,
        Settings.Global.BUGREPORT_IN_POWER_MENU,
        Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
        Settings.Global.APP_AUTO_RESTRICTION_ENABLED,
        Settings.Global.AUTO_TIME,
        Settings.Global.AUTO_TIME_ZONE,
        Settings.Global.POWER_SOUNDS_ENABLED,
        Settings.Global.DOCK_SOUNDS_ENABLED,
        Settings.Global.CHARGING_SOUNDS_ENABLED,
        Settings.Global.USB_MASS_STORAGE_ENABLED,
        Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED,
        Settings.Global.WIFI_WAKEUP_ENABLED,
        Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
        Settings.Global.USE_OPEN_WIFI_PACKAGE,
        Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
        Settings.Global.EMERGENCY_TONE,
        Settings.Global.CALL_AUTO_RETRY,
        Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
        Settings.Global.ENABLE_AUTOMATIC_SYSTEM_SERVER_HEAP_DUMPS,
        Settings.Global.ENCODED_SURROUND_OUTPUT,
        Settings.Global.ENCODED_SURROUND_OUTPUT_ENABLED_FORMATS,
        Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL,
        Settings.Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED,
        Settings.Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL,
        Settings.Global.BLUETOOTH_ON,
        Settings.Global.PRIVATE_DNS_MODE,
        Settings.Global.PRIVATE_DNS_SPECIFIER,
        Settings.Global.SOFT_AP_TIMEOUT_ENABLED,
        Settings.Global.ZEN_DURATION,
        Settings.Global.CHARGING_VIBRATION_ENABLED,
        Settings.Global.AWARE_ALLOWED,
    };
}
+166 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.provider.settings.backup;

import android.annotation.UnsupportedAppUsage;
import android.provider.Settings;

/** Information relating to the Secure settings which should be backed up */
public class SecureSettings {

    /**
     * NOTE: Settings are backed up and restored in the order they appear
     *       in this array. If you have one setting depending on another,
     *       make sure that they are ordered appropriately.
     */
    @UnsupportedAppUsage
    public static final String[] SETTINGS_TO_BACKUP = {
        Settings.Secure.BUGREPORT_IN_POWER_MENU,                            // moved to global
        Settings.Secure.ALLOW_MOCK_LOCATION,
        Settings.Secure.USB_MASS_STORAGE_ENABLED,                           // moved to global
        Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
        Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER,
        Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
        Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
        Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
        Settings.Secure.AUTOFILL_SERVICE,
        Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
        Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
        Settings.Secure.ENABLED_VR_LISTENERS,
        Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
        Settings.Secure.TOUCH_EXPLORATION_ENABLED,
        Settings.Secure.ACCESSIBILITY_ENABLED,
        Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
        Settings.Secure.ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
        Settings.Secure.ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
        Settings.Secure.ACCESSIBILITY_SHORTCUT_ENABLED,
        Settings.Secure.ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
        Settings.Secure.ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_PRESET,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_LOCALE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_TYPEFACE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE,
        Settings.Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
        Settings.Secure.TTS_DEFAULT_RATE,
        Settings.Secure.TTS_DEFAULT_PITCH,
        Settings.Secure.TTS_DEFAULT_SYNTH,
        Settings.Secure.TTS_ENABLED_PLUGINS,
        Settings.Secure.TTS_DEFAULT_LOCALE,
        Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
        Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
        Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
        Settings.Secure.WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
        Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND,
        Settings.Secure.MOUNT_UMS_AUTOSTART,
        Settings.Secure.MOUNT_UMS_PROMPT,
        Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED,
        Settings.Secure.DOUBLE_TAP_TO_WAKE,
        Settings.Secure.WAKE_GESTURE_ENABLED,
        Settings.Secure.LONG_PRESS_TIMEOUT,
        Settings.Secure.CAMERA_GESTURE_DISABLED,
        Settings.Secure.ACCESSIBILITY_AUTOCLICK_ENABLED,
        Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
        Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON,
        Settings.Secure.PREFERRED_TTY_MODE,
        Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED,
        Settings.Secure.TTY_MODE_ENABLED,
        Settings.Secure.RTT_CALLING_MODE,
        Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR,
        Settings.Secure.NIGHT_DISPLAY_CUSTOM_START_TIME,
        Settings.Secure.NIGHT_DISPLAY_CUSTOM_END_TIME,
        Settings.Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE,
        Settings.Secure.NIGHT_DISPLAY_AUTO_MODE,
        Settings.Secure.DISPLAY_WHITE_BALANCE_ENABLED,
        Settings.Secure.SYNC_PARENT_SOUNDS,
        Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
        Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
        Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED,
        Settings.Secure.QS_TILES,
        Settings.Secure.DOZE_ENABLED,
        Settings.Secure.DOZE_ALWAYS_ON,
        Settings.Secure.DOZE_PICK_UP_GESTURE,
        Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
        Settings.Secure.DOZE_TAP_SCREEN_GESTURE,
        Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
        Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
        Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT,
        Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
        Settings.Secure.FACE_UNLOCK_KEYGUARD_ENABLED,
        Settings.Secure.SHOW_MEDIA_WHEN_BYPASSING,
        Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD,
        Settings.Secure.FACE_UNLOCK_APP_ENABLED,
        Settings.Secure.FACE_UNLOCK_ALWAYS_REQUIRE_CONFIRMATION,
        Settings.Secure.ASSIST_GESTURE_ENABLED,
        Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED,
        Settings.Secure.ASSIST_GESTURE_WAKE_ENABLED,
        Settings.Secure.VR_DISPLAY_MODE,
        Settings.Secure.NOTIFICATION_BADGING,
        Settings.Secure.NOTIFICATION_BUBBLES,
        Settings.Secure.NOTIFICATION_DISMISS_RTL,
        Settings.Secure.QS_AUTO_ADDED_TILES,
        Settings.Secure.SCREENSAVER_ENABLED,
        Settings.Secure.SCREENSAVER_COMPONENTS,
        Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK,
        Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP,
        Settings.Secure.LOCKDOWN_IN_POWER_MENU,
        Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
        Settings.Secure.VOLUME_HUSH_GESTURE,
        Settings.Secure.MANUAL_RINGER_TOGGLE_COUNT,
        Settings.Secure.HUSH_GESTURE_USED,
        Settings.Secure.IN_CALL_NOTIFICATION_ENABLED,
        Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
        Settings.Secure.LOCK_SCREEN_CUSTOM_CLOCK_FACE,
        Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS,
        Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS,
        Settings.Secure.SHOW_NOTIFICATION_SNOOZE,
        Settings.Secure.ZEN_DURATION,
        Settings.Secure.SHOW_ZEN_UPGRADE_NOTIFICATION,
        Settings.Secure.SHOW_ZEN_SETTINGS_SUGGESTION,
        Settings.Secure.ZEN_SETTINGS_UPDATED,
        Settings.Secure.ZEN_SETTINGS_SUGGESTION_VIEWED,
        Settings.Secure.CHARGING_SOUNDS_ENABLED,
        Settings.Secure.CHARGING_VIBRATION_ENABLED,
        Settings.Secure.ACCESSIBILITY_NON_INTERACTIVE_UI_TIMEOUT_MS,
        Settings.Secure.ACCESSIBILITY_INTERACTIVE_UI_TIMEOUT_MS,
        Settings.Secure.NOTIFICATION_NEW_INTERRUPTION_MODEL,
        Settings.Secure.TRUST_AGENTS_EXTEND_UNLOCK,
        Settings.Secure.UI_NIGHT_MODE,
        Settings.Secure.LOCK_SCREEN_WHEN_TRUST_LOST,
        Settings.Secure.SKIP_GESTURE,
        Settings.Secure.SKIP_DIRECTION,
        Settings.Secure.SILENCE_GESTURE,
        Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
        Settings.Secure.NAVIGATION_MODE,
        Settings.Secure.AWARE_ENABLED,
        Settings.Secure.SKIP_GESTURE_COUNT,
        Settings.Secure.SKIP_TOUCH_COUNT,
        Settings.Secure.SILENCE_ALARMS_GESTURE_COUNT,
        Settings.Secure.SILENCE_CALL_GESTURE_COUNT,
        Settings.Secure.SILENCE_TIMER_GESTURE_COUNT,
        Settings.Secure.SILENCE_ALARMS_TOUCH_COUNT,
        Settings.Secure.SILENCE_CALL_TOUCH_COUNT,
        Settings.Secure.SILENCE_TIMER_TOUCH_COUNT,
        Settings.Secure.DARK_MODE_DIALOG_SEEN,
        Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED,
        Settings.Secure.AWARE_LOCK_ENABLED
    };
}
+88 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.provider.settings.backup;

import android.annotation.UnsupportedAppUsage;
import android.provider.Settings;

/** Information about the system settings to back up */
public class SystemSettings {

    /**
     * Settings to backup.
     *
     * NOTE: Settings are backed up and restored in the order they appear
     *       in this array. If you have one setting depending on another,
     *       make sure that they are ordered appropriately.
     */
    @UnsupportedAppUsage
    public static final String[] SETTINGS_TO_BACKUP = {
        Settings.System.STAY_ON_WHILE_PLUGGED_IN,   // moved to global
        Settings.System.WIFI_USE_STATIC_IP,
        Settings.System.WIFI_STATIC_IP,
        Settings.System.WIFI_STATIC_GATEWAY,
        Settings.System.WIFI_STATIC_NETMASK,
        Settings.System.WIFI_STATIC_DNS1,
        Settings.System.WIFI_STATIC_DNS2,
        Settings.System.BLUETOOTH_DISCOVERABILITY,
        Settings.System.BLUETOOTH_DISCOVERABILITY_TIMEOUT,
        Settings.System.FONT_SCALE,
        Settings.System.DIM_SCREEN,
        Settings.System.SCREEN_OFF_TIMEOUT,
        Settings.System.SCREEN_BRIGHTNESS_MODE,
        Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ,
        Settings.System.SCREEN_BRIGHTNESS_FOR_VR,
        Settings.System.ADAPTIVE_SLEEP,
        Settings.System.VIBRATE_INPUT_DEVICES,
        Settings.System.MODE_RINGER_STREAMS_AFFECTED,
        Settings.System.TEXT_AUTO_REPLACE,
        Settings.System.TEXT_AUTO_CAPS,
        Settings.System.TEXT_AUTO_PUNCTUATE,
        Settings.System.TEXT_SHOW_PASSWORD,
        Settings.System.AUTO_TIME,                  // moved to global
        Settings.System.AUTO_TIME_ZONE,             // moved to global
        Settings.System.TIME_12_24,
        Settings.System.DATE_FORMAT,
        Settings.System.DTMF_TONE_WHEN_DIALING,
        Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,
        Settings.System.HEARING_AID,
        Settings.System.TTY_MODE,
        Settings.System.MASTER_MONO,
        Settings.System.MASTER_BALANCE,
        Settings.System.SOUND_EFFECTS_ENABLED,
        Settings.System.HAPTIC_FEEDBACK_ENABLED,
        Settings.System.POWER_SOUNDS_ENABLED,       // moved to global
        Settings.System.DOCK_SOUNDS_ENABLED,        // moved to global
        Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
        Settings.System.SHOW_WEB_SUGGESTIONS,
        Settings.System.SIP_CALL_OPTIONS,
        Settings.System.SIP_RECEIVE_CALLS,
        Settings.System.POINTER_SPEED,
        Settings.System.VIBRATE_WHEN_RINGING,
        Settings.System.RINGTONE,
        Settings.System.LOCK_TO_APP_ENABLED,
        Settings.System.NOTIFICATION_SOUND,
        Settings.System.ACCELEROMETER_ROTATION,
        Settings.System.SHOW_BATTERY_PERCENT,
        Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
        Settings.System.RING_VIBRATION_INTENSITY,
        Settings.System.HAPTIC_FEEDBACK_INTENSITY,
        Settings.System.DISPLAY_COLOR_MODE,
        Settings.System.ALARM_ALERT,
        Settings.System.NOTIFICATION_LIGHT_PULSE,
    };
}
Loading