• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.settings.backup;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.provider.Settings;
21 
22 import com.android.server.display.feature.flags.Flags;
23 
24 import java.util.ArrayList;
25 import java.util.List;
26 
27 /** Information about the system settings to back up */
28 public class SystemSettings {
29 
30     /**
31      * Settings to back up.
32      *
33      * NOTE: Settings are backed up and restored in the order they appear
34      *       in this array. If you have one setting depending on another,
35      *       make sure that they are ordered appropriately.
36      */
37     @UnsupportedAppUsage
38     public static final String[] SETTINGS_TO_BACKUP = getSettingsToBackUp();
39 
getSettingsToBackUp()40     private static String[] getSettingsToBackUp() {
41         List<String> settings = new ArrayList<>(List.of(
42                 Settings.System.STAY_ON_WHILE_PLUGGED_IN,   // moved to global
43                 Settings.System.WIFI_USE_STATIC_IP,
44                 Settings.System.WIFI_STATIC_IP,
45                 Settings.System.WIFI_STATIC_GATEWAY,
46                 Settings.System.WIFI_STATIC_NETMASK,
47                 Settings.System.WIFI_STATIC_DNS1,
48                 Settings.System.WIFI_STATIC_DNS2,
49                 Settings.System.BLUETOOTH_DISCOVERABILITY,
50                 Settings.System.BLUETOOTH_DISCOVERABILITY_TIMEOUT,
51                 Settings.System.FONT_SCALE,
52                 Settings.System.DIM_SCREEN,
53                 Settings.System.SCREEN_OFF_TIMEOUT,
54                 Settings.System.SCREEN_BRIGHTNESS_MODE,
55                 Settings.System.ADAPTIVE_SLEEP,             // moved to secure
56                 Settings.System.APPLY_RAMPING_RINGER,
57                 Settings.System.VIBRATE_INPUT_DEVICES,
58                 Settings.System.MODE_RINGER_STREAMS_AFFECTED,
59                 Settings.System.TEXT_AUTO_REPLACE,
60                 Settings.System.TEXT_AUTO_CAPS,
61                 Settings.System.TEXT_AUTO_PUNCTUATE,
62                 Settings.System.TEXT_SHOW_PASSWORD,
63                 Settings.System.AUTO_TIME,                  // moved to global
64                 Settings.System.AUTO_TIME_ZONE,             // moved to global
65                 Settings.System.TIME_12_24,
66                 Settings.System.DTMF_TONE_WHEN_DIALING,
67                 Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,
68                 Settings.System.HEARING_AID,
69                 Settings.System.TTY_MODE,
70                 Settings.System.MASTER_MONO,
71                 Settings.System.MASTER_BALANCE,
72                 Settings.System.FOLD_LOCK_BEHAVIOR,
73                 Settings.System.SOUND_EFFECTS_ENABLED,
74                 Settings.System.HAPTIC_FEEDBACK_ENABLED,
75                 Settings.System.POWER_SOUNDS_ENABLED,       // moved to global
76                 Settings.System.DOCK_SOUNDS_ENABLED,        // moved to global
77                 Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
78                 Settings.System.SHOW_WEB_SUGGESTIONS,
79                 Settings.System.SIP_CALL_OPTIONS,
80                 Settings.System.SIP_RECEIVE_CALLS,
81                 Settings.System.POINTER_SPEED,
82                 Settings.System.POINTER_FILL_STYLE,
83                 Settings.System.POINTER_SCALE,
84                 Settings.System.VIBRATE_ON,
85                 Settings.System.VIBRATE_WHEN_RINGING,
86                 Settings.System.RINGTONE,
87                 Settings.System.LOCK_TO_APP_ENABLED,
88                 Settings.System.NOTIFICATION_SOUND,
89                 Settings.System.ACCELEROMETER_ROTATION,
90                 Settings.System.SHOW_BATTERY_PERCENT,
91                 Settings.System.ALARM_VIBRATION_INTENSITY,
92                 Settings.System.MEDIA_VIBRATION_INTENSITY,
93                 Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
94                 Settings.System.RING_VIBRATION_INTENSITY,
95                 Settings.System.HAPTIC_FEEDBACK_INTENSITY,
96                 Settings.System.HARDWARE_HAPTIC_FEEDBACK_INTENSITY,
97                 Settings.System.KEYBOARD_VIBRATION_ENABLED,
98                 Settings.System.HAPTIC_FEEDBACK_ENABLED,
99                 Settings.System.DISPLAY_COLOR_MODE_VENDOR_HINT, // must precede DISPLAY_COLOR_MODE
100                 Settings.System.DISPLAY_COLOR_MODE,
101                 Settings.System.ALARM_ALERT,
102                 Settings.System.NOTIFICATION_LIGHT_PULSE,
103                 Settings.System.WEAR_ACCESSIBILITY_GESTURE_ENABLED,
104                 Settings.System.CLOCKWORK_BLUETOOTH_SETTINGS_PREF,
105                 Settings.System.UNREAD_NOTIFICATION_DOT_INDICATOR,
106                 Settings.System.AUTO_LAUNCH_MEDIA_CONTROLS,
107                 Settings.System.LOCALE_PREFERENCES,
108                 Settings.System.TOUCHPAD_POINTER_SPEED,
109                 Settings.System.TOUCHPAD_NATURAL_SCROLLING,
110                 Settings.System.TOUCHPAD_TAP_TO_CLICK,
111                 Settings.System.TOUCHPAD_TAP_DRAGGING,
112                 Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE,
113                 Settings.System.CAMERA_FLASH_NOTIFICATION,
114                 Settings.System.SCREEN_FLASH_NOTIFICATION,
115                 Settings.System.SCREEN_FLASH_NOTIFICATION_COLOR,
116                 Settings.System.NOTIFICATION_COOLDOWN_ENABLED,
117                 Settings.System.NOTIFICATION_COOLDOWN_ALL,
118                 Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED
119         ));
120         if (Flags.backUpSmoothDisplayAndForcePeakRefreshRate()) {
121             settings.add(Settings.System.PEAK_REFRESH_RATE);
122             settings.add(Settings.System.MIN_REFRESH_RATE);
123         }
124         return settings.toArray(new String[0]);
125     }
126 }
127