From 91f89d0a8befb56b96c468c2bc9b582f669b0347 Mon Sep 17 00:00:00 2001 From: Al Sutton Date: Fri, 16 Aug 2019 12:56:57 +0100 Subject: [PATCH 1/2] Move the validators out of the settings class Currently the validators static initialiser gets triggered when the relevant settings class is accessed. Moving them out to the SettingsBackupAgent (which is the only place they're used) has two main advantages; 1) All apps accessing the Settings classes no longer trigger the static initialisers and so are faster. 2) Putting them in SettingsBackupAgent gets them off the bootclasspath of all apps and makes the framework jars smaller. Bug: 139449903 Test: atest SettingsProviderTest RunBackupFrameworksServicesRoboTests CtsBackupTestCases CtsBackupHostTestCases GtsBackupTestCases GtsBackupHostTestCases Change-Id: Ie740c1ea25a01c715964175094677af2e3328732 --- core/java/android/provider/Settings.java | 1138 ----------------- packages/SettingsProvider/Android.bp | 3 + .../ComponentNameListValidator.java | 0 .../validators/DiscreteValueValidator.java | 0 .../validators/GlobalSettingsValidators.java | 152 +++ .../InclusiveFloatRangeValidator.java | 4 +- .../InclusiveIntegerRangeValidator.java | 4 +- .../settings/validators/ListValidator.java | 0 .../validators/PackageNameListValidator.java | 4 +- .../validators/SecureSettingsValidators.java | 231 ++++ .../validators/SettingsValidators.java | 24 + .../validators/SystemSettingsValidators.java | 220 ++++ .../settings/validators/TTSListValidator.java | 0 .../validators/TileListValidator.java | 0 .../settings/validators/Validator.java | 0 .../settings/SettingsBackupAgent.java | 9 +- .../providers/settings/SettingsProvider.java | 3 +- .../validators/SettingsValidatorsTest.java | 12 +- 18 files changed, 650 insertions(+), 1154 deletions(-) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/ComponentNameListValidator.java (100%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/DiscreteValueValidator.java (100%) create mode 100644 packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/InclusiveFloatRangeValidator.java (90%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/InclusiveIntegerRangeValidator.java (89%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/ListValidator.java (100%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/PackageNameListValidator.java (89%) create mode 100644 packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/SettingsValidators.java (87%) create mode 100644 packages/SettingsProvider/src/android/provider/settings/validators/SystemSettingsValidators.java rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/TTSListValidator.java (100%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/TileListValidator.java (100%) rename {core/java => packages/SettingsProvider/src}/android/provider/settings/validators/Validator.java (100%) rename {core/tests/coretests => packages/SettingsProvider/test}/src/android/provider/settings/validators/SettingsValidatorsTest.java (95%) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index f573d87711781..fecb7f15a021b 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -16,20 +16,6 @@ package android.provider; -import static android.provider.settings.validators.SettingsValidators.ANY_INTEGER_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.COMPONENT_NAME_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.JSON_OBJECT_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.LENIENT_IP_ADDRESS_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.LOCALE_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.NON_NEGATIVE_INTEGER_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.NULLABLE_COMPONENT_NAME_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.PACKAGE_NAME_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.TILE_LIST_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.TTS_LIST_VALIDATOR; -import static android.provider.settings.validators.SettingsValidators.URI_VALIDATOR; - import android.Manifest; import android.annotation.IntDef; import android.annotation.IntRange; @@ -63,9 +49,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.database.SQLException; -import android.hardware.display.ColorDisplayManager; import android.location.LocationManager; -import android.media.AudioFormat; import android.net.ConnectivityManager; import android.net.NetworkScoreManager; import android.net.Uri; @@ -83,12 +67,6 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.os.UserHandle; -import android.provider.settings.validators.ComponentNameListValidator; -import android.provider.settings.validators.DiscreteValueValidator; -import android.provider.settings.validators.InclusiveFloatRangeValidator; -import android.provider.settings.validators.InclusiveIntegerRangeValidator; -import android.provider.settings.validators.PackageNameListValidator; -import android.provider.settings.validators.Validator; import android.speech.tts.TextToSpeech; import android.telephony.SubscriptionManager; import android.text.TextUtils; @@ -106,7 +84,6 @@ import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.net.URISyntaxException; -import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; @@ -3120,30 +3097,6 @@ public final class Settings { @Deprecated public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN; - private static final Validator STAY_ON_WHILE_PLUGGED_IN_VALIDATOR = new Validator() { - @Override - public boolean validate(String value) { - try { - int val = Integer.parseInt(value); - return (val == 0) - || (val == BatteryManager.BATTERY_PLUGGED_AC) - || (val == BatteryManager.BATTERY_PLUGGED_USB) - || (val == BatteryManager.BATTERY_PLUGGED_WIRELESS) - || (val == (BatteryManager.BATTERY_PLUGGED_AC - | BatteryManager.BATTERY_PLUGGED_USB)) - || (val == (BatteryManager.BATTERY_PLUGGED_AC - | BatteryManager.BATTERY_PLUGGED_WIRELESS)) - || (val == (BatteryManager.BATTERY_PLUGGED_USB - | BatteryManager.BATTERY_PLUGGED_WIRELESS)) - || (val == (BatteryManager.BATTERY_PLUGGED_AC - | BatteryManager.BATTERY_PLUGGED_USB - | BatteryManager.BATTERY_PLUGGED_WIRELESS)); - } catch (NumberFormatException e) { - return false; - } - } - }; - /** * What happens when the user presses the end call button if they're not * on a call.
@@ -3156,9 +3109,6 @@ public final class Settings { */ public static final String END_BUTTON_BEHAVIOR = "end_button_behavior"; - private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 3); - /** * END_BUTTON_BEHAVIOR value for "go home". * @hide @@ -3183,8 +3133,6 @@ public final class Settings { */ public static final String ADVANCED_SETTINGS = "advanced_settings"; - private static final Validator ADVANCED_SETTINGS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * ADVANCED_SETTINGS default value. * @hide @@ -3285,8 +3233,6 @@ public final class Settings { @Deprecated public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip"; - private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = BOOLEAN_VALIDATOR; - /** * The static IP address. *

@@ -3297,8 +3243,6 @@ public final class Settings { @Deprecated public static final String WIFI_STATIC_IP = "wifi_static_ip"; - private static final Validator WIFI_STATIC_IP_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR; - /** * If using static IP, the gateway's IP address. *

@@ -3309,8 +3253,6 @@ public final class Settings { @Deprecated public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway"; - private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR; - /** * If using static IP, the net mask. *

@@ -3321,8 +3263,6 @@ public final class Settings { @Deprecated public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask"; - private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR; - /** * If using static IP, the primary DNS's IP address. *

@@ -3333,8 +3273,6 @@ public final class Settings { @Deprecated public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1"; - private static final Validator WIFI_STATIC_DNS1_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR; - /** * If using static IP, the secondary DNS's IP address. *

@@ -3345,8 +3283,6 @@ public final class Settings { @Deprecated public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; - private static final Validator WIFI_STATIC_DNS2_VALIDATOR = LENIENT_IP_ADDRESS_VALIDATOR; - /** * Determines whether remote devices may discover and/or connect to * this device. @@ -3358,9 +3294,6 @@ public final class Settings { public static final String BLUETOOTH_DISCOVERABILITY = "bluetooth_discoverability"; - private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 2); - /** * Bluetooth discoverability timeout. If this value is nonzero, then * Bluetooth becomes discoverable for a certain number of seconds, @@ -3369,9 +3302,6 @@ public final class Settings { public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = "bluetooth_discoverability_timeout"; - private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED} * instead @@ -3404,32 +3334,11 @@ public final class Settings { @Deprecated public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted"; - private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() { - private static final int MAX_LENGTH = 1000; - - @Override - public boolean validate(String value) { - // TODO: No idea what the correct format is. - return value == null || value.length() < MAX_LENGTH; - } - }; - /** * Scaling factor for fonts, float. */ public static final String FONT_SCALE = "font_scale"; - private static final Validator FONT_SCALE_VALIDATOR = new Validator() { - @Override - public boolean validate(@Nullable String value) { - try { - return Float.parseFloat(value) >= 0; - } catch (NumberFormatException | NullPointerException e) { - return false; - } - } - }; - /** * The serialized system locale value. * @@ -3466,34 +3375,12 @@ public final class Settings { @Deprecated public static final String DIM_SCREEN = "dim_screen"; - private static final Validator DIM_SCREEN_VALIDATOR = BOOLEAN_VALIDATOR; - /** * The display color mode. * @hide */ public static final String DISPLAY_COLOR_MODE = "display_color_mode"; - private static final Validator DISPLAY_COLOR_MODE_VALIDATOR = new Validator() { - @Override - public boolean validate(@Nullable String value) { - // Assume the actual validation that this device can properly handle this kind of - // color mode further down in ColorDisplayManager / ColorDisplayService. - try { - final int setting = Integer.parseInt(value); - final boolean isInFrameworkRange = - setting >= ColorDisplayManager.COLOR_MODE_NATURAL - && setting <= ColorDisplayManager.COLOR_MODE_AUTOMATIC; - final boolean isInVendorRange = - setting >= ColorDisplayManager.VENDOR_COLOR_MODE_RANGE_MIN - && setting <= ColorDisplayManager.VENDOR_COLOR_MODE_RANGE_MAX; - return isInFrameworkRange || isInVendorRange; - } catch (NumberFormatException | NullPointerException e) { - return false; - } - } - }; - /** * The user selected min refresh rate in frames per second. * @@ -3510,9 +3397,6 @@ public final class Settings { */ public static final String PEAK_REFRESH_RATE = "peak_refresh_rate"; - private static final Validator PEAK_REFRESH_RATE_VALIDATOR = - new InclusiveFloatRangeValidator(24f, Float.MAX_VALUE); - /** * The amount of time in milliseconds before the device goes to sleep or begins * to dream after a period of inactivity. This value is also known as the @@ -3525,9 +3409,6 @@ public final class Settings { */ public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout"; - private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * The screen backlight brightness between 0 and 255. */ @@ -3539,16 +3420,11 @@ public final class Settings { */ public static final String SCREEN_BRIGHTNESS_FOR_VR = "screen_brightness_for_vr"; - private static final Validator SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 255); - /** * Control whether to enable automatic brightness mode. */ public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode"; - private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Adjustment to auto-brightness to make it generally more (>0.0 <1.0) * or less (<0.0 >-1.0) bright. @@ -3557,9 +3433,6 @@ public final class Settings { @UnsupportedAppUsage public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj"; - private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR = - new InclusiveFloatRangeValidator(-1, 1); - /** * SCREEN_BRIGHTNESS_MODE value for manual mode. */ @@ -3576,8 +3449,6 @@ public final class Settings { */ public static final String ADAPTIVE_SLEEP = "adaptive_sleep"; - private static final Validator ADAPTIVE_SLEEP_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Control whether the process CPU usage meter should be shown. * @@ -3604,9 +3475,6 @@ public final class Settings { */ public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected"; - private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * Determines which streams are affected by mute. The * stream type's bit should be set to 1 if it should be muted when a mute request @@ -3614,17 +3482,12 @@ public final class Settings { */ public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected"; - private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * Whether vibrate is on for different events. This is used internally, * changing this value will not change the vibrate. See AudioManager. */ public static final String VIBRATE_ON = "vibrate_on"; - private static final Validator VIBRATE_ON_VALIDATOR = BOOLEAN_VALIDATOR; - /** * If 1, redirects the system vibrator to all currently attached input devices * that support vibration. If there are no such input devices, then the system @@ -3639,8 +3502,6 @@ public final class Settings { */ public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices"; - private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = BOOLEAN_VALIDATOR; - /** * The intensity of notification vibrations, if configurable. * @@ -3691,9 +3552,6 @@ public final class Settings { public static final String HAPTIC_FEEDBACK_INTENSITY = "haptic_feedback_intensity"; - private static final Validator VIBRATION_INTENSITY_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 3); - /** * Ringer volume. This is used internally, changing this value will not * change the volume. See AudioManager. @@ -3772,8 +3630,6 @@ public final class Settings { @UnsupportedAppUsage public static final String MASTER_MONO = "master_mono"; - private static final Validator MASTER_MONO_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Master balance (float -1.f = 100% left, 0.f = dead center, 1.f = 100% right). * @@ -3781,9 +3637,6 @@ public final class Settings { */ public static final String MASTER_BALANCE = "master_balance"; - private static final Validator MASTER_BALANCE_VALIDATOR = - new InclusiveFloatRangeValidator(-1.f, 1.f); - /** * Whether the notifications should use the ring volume (value of 1) or * a separate notification volume (value of 0). In most cases, users @@ -3802,8 +3655,6 @@ public final class Settings { public static final String NOTIFICATIONS_USE_RING_VOLUME = "notifications_use_ring_volume"; - private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether silent mode should allow vibration feedback. This is used * internally in AudioService and the Sound settings activity to @@ -3819,8 +3670,6 @@ public final class Settings { @UnsupportedAppUsage public static final String VIBRATE_IN_SILENT = "vibrate_in_silent"; - private static final Validator VIBRATE_IN_SILENT_VALIDATOR = BOOLEAN_VALIDATOR; - /** * The mapping of stream type (integer) to its setting. * @@ -3867,8 +3716,6 @@ public final class Settings { */ public static final String RINGTONE = "ringtone"; - private static final Validator RINGTONE_VALIDATOR = URI_VALIDATOR; - /** * A {@link Uri} that will point to the current default ringtone at any * given time. @@ -3892,8 +3739,6 @@ public final class Settings { */ public static final String NOTIFICATION_SOUND = "notification_sound"; - private static final Validator NOTIFICATION_SOUND_VALIDATOR = URI_VALIDATOR; - /** * A {@link Uri} that will point to the current default notification * sound at any given time. @@ -3915,8 +3760,6 @@ public final class Settings { */ public static final String ALARM_ALERT = "alarm_alert"; - private static final Validator ALARM_ALERT_VALIDATOR = URI_VALIDATOR; - /** * A {@link Uri} that will point to the current default alarm alert at * any given time. @@ -3937,42 +3780,30 @@ public final class Settings { */ public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver"; - private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = COMPONENT_NAME_VALIDATOR; - /** * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off */ public static final String TEXT_AUTO_REPLACE = "auto_replace"; - private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off */ public static final String TEXT_AUTO_CAPS = "auto_caps"; - private static final Validator TEXT_AUTO_CAPS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This * feature converts two spaces to a "." and space. */ public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate"; - private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting to showing password characters in text editors. 1 = On, 0 = Off */ public static final String TEXT_SHOW_PASSWORD = "show_password"; - private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = BOOLEAN_VALIDATOR; - public static final String SHOW_GTALK_SERVICE_STATUS = "SHOW_GTALK_SERVICE_STATUS"; - private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Name of activity to use for wallpaper on the home screen. * @@ -3981,18 +3812,6 @@ public final class Settings { @Deprecated public static final String WALLPAPER_ACTIVITY = "wallpaper_activity"; - private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() { - private static final int MAX_LENGTH = 1000; - - @Override - public boolean validate(String value) { - if (value != null && value.length() > MAX_LENGTH) { - return false; - } - return ComponentName.unflattenFromString(value) != null; - } - }; - /** * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME} * instead @@ -4000,8 +3819,6 @@ public final class Settings { @Deprecated public static final String AUTO_TIME = Global.AUTO_TIME; - private static final Validator AUTO_TIME_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE} * instead @@ -4009,8 +3826,6 @@ public final class Settings { @Deprecated public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; - private static final Validator AUTO_TIME_ZONE_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Display times as 12 or 24 hours * 12 @@ -4018,10 +3833,6 @@ public final class Settings { */ public static final String TIME_12_24 = "time_12_24"; - /** @hide */ - public static final Validator TIME_12_24_VALIDATOR = - new DiscreteValueValidator(new String[] {"12", "24", null}); - /** * Date format string * mm/dd/yyyy @@ -4030,19 +3841,6 @@ public final class Settings { */ public static final String DATE_FORMAT = "date_format"; - /** @hide */ - public static final Validator DATE_FORMAT_VALIDATOR = new Validator() { - @Override - public boolean validate(@Nullable String value) { - try { - new SimpleDateFormat(value); - return true; - } catch (IllegalArgumentException | NullPointerException e) { - return false; - } - } - }; - /** * Whether the setup wizard has been run before (on first boot), or if * it still needs to be run. @@ -4052,9 +3850,6 @@ public final class Settings { */ public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run"; - /** @hide */ - public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Scaling factor for normal window animations. Setting to 0 will disable window * animations. @@ -4091,9 +3886,6 @@ public final class Settings { */ public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation"; - /** @hide */ - public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Default screen rotation when no other policy applies. * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a @@ -4104,10 +3896,6 @@ public final class Settings { */ public static final String USER_ROTATION = "user_rotation"; - /** @hide */ - public static final Validator USER_ROTATION_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 3); - /** * Control whether the rotation lock toggle in the System UI should be hidden. * Typically this is done for accessibility purposes to make it harder for @@ -4123,10 +3911,6 @@ public final class Settings { public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY = "hide_rotation_lock_toggle_for_accessibility"; - /** @hide */ - public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Whether the phone vibrates when it is ringing due to an incoming call. This will * be used by Phone and Setting apps; it shouldn't affect other apps. @@ -4139,9 +3923,6 @@ public final class Settings { */ public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing"; - /** @hide */ - public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = BOOLEAN_VALIDATOR; - /** * When {@code 1}, Telecom enhanced call blocking functionality is enabled. When * {@code 0}, enhanced call blocking functionality is disabled. @@ -4156,9 +3937,6 @@ public final class Settings { */ public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone"; - /** @hide */ - public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = BOOLEAN_VALIDATOR; - /** * CDMA only settings * DTMF tone type played by the dialer when dialing. @@ -4167,9 +3945,6 @@ public final class Settings { */ public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type"; - /** @hide */ - public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether the hearing aid is enabled. The value is * boolean (1 or 0). @@ -4178,9 +3953,6 @@ public final class Settings { @UnsupportedAppUsage public static final String HEARING_AID = "hearing_aid"; - /** @hide */ - public static final Validator HEARING_AID_VALIDATOR = BOOLEAN_VALIDATOR; - /** * CDMA only settings * TTY Mode @@ -4193,28 +3965,18 @@ public final class Settings { @UnsupportedAppUsage public static final String TTY_MODE = "tty_mode"; - /** @hide */ - public static final Validator TTY_MODE_VALIDATOR = - new InclusiveIntegerRangeValidator(0, 3); - /** * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is * boolean (1 or 0). */ public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled"; - /** @hide */ - public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether haptic feedback (Vibrate on tap) is enabled. The value is * boolean (1 or 0). */ public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled"; - /** @hide */ - public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Each application that shows web suggestions should have its own * setting for this. @@ -4222,9 +3984,6 @@ public final class Settings { @Deprecated public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions"; - /** @hide */ - public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether the notification LED should repeatedly flash when a notification is * pending. The value is boolean (1 or 0). @@ -4233,9 +3992,6 @@ public final class Settings { @UnsupportedAppUsage public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; - /** @hide */ - public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Show pointer location on screen? * 0 = no @@ -4245,9 +4001,6 @@ public final class Settings { @UnsupportedAppUsage public static final String POINTER_LOCATION = "pointer_location"; - /** @hide */ - public static final Validator POINTER_LOCATION_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Show touch positions on screen? * 0 = no @@ -4257,9 +4010,6 @@ public final class Settings { @UnsupportedAppUsage public static final String SHOW_TOUCHES = "show_touches"; - /** @hide */ - public static final Validator SHOW_TOUCHES_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Log raw orientation data from * {@link com.android.server.policy.WindowOrientationListener} for use with the @@ -4271,9 +4021,6 @@ public final class Settings { public static final String WINDOW_ORIENTATION_LISTENER_LOG = "window_orientation_listener_log"; - /** @hide */ - public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED} * instead @@ -4282,8 +4029,6 @@ public final class Settings { @Deprecated public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED; - private static final Validator POWER_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED} * instead @@ -4293,8 +4038,6 @@ public final class Settings { @UnsupportedAppUsage public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED; - private static final Validator DOCK_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether to play sounds when the keyguard is shown and dismissed. * @hide @@ -4302,18 +4045,12 @@ public final class Settings { @UnsupportedAppUsage public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled"; - /** @hide */ - public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether the lockscreen should be completely disabled. * @hide */ public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled"; - /** @hide */ - public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} * instead @@ -4384,9 +4121,6 @@ public final class Settings { */ public static final String SIP_RECEIVE_CALLS = "sip_receive_calls"; - /** @hide */ - public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Call Preference String. * "SIP_ALWAYS" : Always use SIP with network access @@ -4395,29 +4129,18 @@ public final class Settings { */ public static final String SIP_CALL_OPTIONS = "sip_call_options"; - /** @hide */ - public static final Validator SIP_CALL_OPTIONS_VALIDATOR = - new DiscreteValueValidator( - new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"}); - /** * One of the sip call options: Always use SIP with network access. * @hide */ public static final String SIP_ALWAYS = "SIP_ALWAYS"; - /** @hide */ - public static final Validator SIP_ALWAYS_VALIDATOR = BOOLEAN_VALIDATOR; - /** * One of the sip call options: Only if destination is a SIP address. * @hide */ public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY"; - /** @hide */ - public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that * the user should be prompted each time a call is made whether it should be placed using @@ -4428,9 +4151,6 @@ public final class Settings { @Deprecated public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME"; - /** @hide */ - public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Pointer speed setting. * This is an integer value in a range between -7 and +7, so there are 15 possible values. @@ -4442,19 +4162,12 @@ public final class Settings { @UnsupportedAppUsage public static final String POINTER_SPEED = "pointer_speed"; - /** @hide */ - public static final Validator POINTER_SPEED_VALIDATOR = - new InclusiveFloatRangeValidator(-7, 7); - /** * Whether lock-to-app will be triggered by long-press on recents. * @hide */ public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled"; - /** @hide */ - public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * I am the lolrus. *

@@ -4464,18 +4177,6 @@ public final class Settings { */ public static final String EGG_MODE = "egg_mode"; - /** @hide */ - public static final Validator EGG_MODE_VALIDATOR = new Validator() { - @Override - public boolean validate(@Nullable String value) { - try { - return Long.parseLong(value) >= 0; - } catch (NumberFormatException e) { - return false; - } - } - }; - /** * Setting to determine whether or not to show the battery percentage in the status bar. * 0 - Don't show percentage @@ -4484,9 +4185,6 @@ public final class Settings { */ public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; - /** @hide */ - private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = BOOLEAN_VALIDATOR; - /** * IMPORTANT: If you add a new public settings you also have to add it to * PUBLIC_SETTINGS below. If the new setting is hidden you have to add @@ -4680,99 +4378,6 @@ public final class Settings { PRIVATE_SETTINGS.add(DISPLAY_COLOR_MODE); } - /** - * These are all public system settings - * - * All settings in {@link SETTINGS_TO_BACKUP} array *must* have a non-null validator, - * otherwise they won't be restored. - * - * @hide - */ - @UnsupportedAppUsage - public static final Map VALIDATORS = new ArrayMap<>(); - static { - VALIDATORS.put(STAY_ON_WHILE_PLUGGED_IN, STAY_ON_WHILE_PLUGGED_IN_VALIDATOR); - VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); - VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); - VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR); - VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT, - BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR); - VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR); - VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR); - VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR); - VALIDATORS.put(DISPLAY_COLOR_MODE, DISPLAY_COLOR_MODE_VALIDATOR); - VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR); - VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR); - VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR); - VALIDATORS.put(ADAPTIVE_SLEEP, ADAPTIVE_SLEEP_VALIDATOR); - VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR); - VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR); - VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR); - VALIDATORS.put(NOTIFICATION_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); - VALIDATORS.put(RING_VIBRATION_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); - VALIDATORS.put(HAPTIC_FEEDBACK_INTENSITY, VIBRATION_INTENSITY_VALIDATOR); - VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR); - VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR); - VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR); - VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR); - VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR); - VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR); - VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR); - VALIDATORS.put(AUTO_TIME, AUTO_TIME_VALIDATOR); - VALIDATORS.put(AUTO_TIME_ZONE, AUTO_TIME_ZONE_VALIDATOR); - VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR); - VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR); - VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR); - VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR); - VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR); - VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR); - VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR); - VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR); - VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR); - VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR); - VALIDATORS.put(POWER_SOUNDS_ENABLED, POWER_SOUNDS_ENABLED_VALIDATOR); - VALIDATORS.put(DOCK_SOUNDS_ENABLED, DOCK_SOUNDS_ENABLED_VALIDATOR); - VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR); - VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR); - VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR); - VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR); - VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR); - VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR); - VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR); - VALIDATORS.put(MASTER_BALANCE, MASTER_BALANCE_VALIDATOR); - VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR); - VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR); - VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR); - VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, - HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR); - VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR); - VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR); - VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR); - VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR); - VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR); - VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR); - VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR); - VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG, - WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR); - VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR); - VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR); - VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR); - VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR); - VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR); - VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR); - VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR); - VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR); - VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR); - VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR); - VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR); - VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR); - VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR); - VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR); - VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR); - VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR); - VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR); - } - /** * These entries are considered common between the personal and the managed profile, * since the managed profile doesn't get to change them. @@ -4859,8 +4464,6 @@ public final class Settings { @Deprecated public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; - private static final Validator BLUETOOTH_ON_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead */ @@ -4938,8 +4541,6 @@ public final class Settings { @Deprecated public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; - private static final Validator USB_MASS_STORAGE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead */ @@ -4969,9 +4570,6 @@ public final class Settings { public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON; - private static final Validator WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * @deprecated Use * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead @@ -4980,9 +4578,6 @@ public final class Settings { public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY; - private static final Validator WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT} * instead @@ -4990,9 +4585,6 @@ public final class Settings { @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT; - private static final Validator WIFI_NUM_OPEN_NETWORKS_KEPT_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead */ @@ -5757,8 +5349,6 @@ public final class Settings { @Deprecated public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu"; - private static final Validator BUGREPORT_IN_POWER_MENU_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead */ @@ -5776,8 +5366,6 @@ public final class Settings { @Deprecated public static final String ALLOW_MOCK_LOCATION = "mock_location"; - private static final Validator ALLOW_MOCK_LOCATION_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting to indicate that on device captions are enabled. * @@ -5786,8 +5374,6 @@ public final class Settings { @SystemApi public static final String ODI_CAPTIONS_ENABLED = "odi_captions_enabled"; - private static final Validator ODI_CAPTIONS_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * On Android 8.0 (API level 26) and higher versions of the platform, * a 64-bit number (expressed as a hexadecimal string), unique to @@ -5833,8 +5419,6 @@ public final class Settings { @Deprecated public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON; - private static final Validator BLUETOOTH_ON_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead */ @@ -5882,9 +5466,6 @@ public final class Settings { @TestApi public static final String AUTOFILL_SERVICE = "autofill_service"; - private static final Validator AUTOFILL_SERVICE_VALIDATOR = - NULLABLE_COMPONENT_NAME_VALIDATOR; - /** * Boolean indicating if Autofill supports field classification. * @@ -6098,8 +5679,6 @@ public final class Settings { */ public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard"; - private static final Validator SHOW_IME_WITH_HARD_KEYBOARD_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Host name and port for global http proxy. Uses ':' seperator for * between host and port. @@ -6367,9 +5946,6 @@ public final class Settings { */ public static final String LOCK_SCREEN_CUSTOM_CLOCK_FACE = "lock_screen_custom_clock_face"; - private static final Validator LOCK_SCREEN_CUSTOM_CLOCK_FACE_VALIDATOR = - JSON_OBJECT_VALIDATOR; - /** * Indicates which clock face to show on lock screen and AOD while docked. * @hide @@ -6435,8 +6011,6 @@ public final class Settings { @Deprecated public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED; - private static final Validator USB_MASS_STORAGE_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead */ @@ -6448,8 +6022,6 @@ public final class Settings { */ public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled"; - private static final Validator ACCESSIBILITY_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting specifying if the accessibility shortcut is enabled. * @hide @@ -6457,8 +6029,6 @@ public final class Settings { public static final String ACCESSIBILITY_SHORTCUT_ENABLED = "accessibility_shortcut_enabled"; - private static final Validator ACCESSIBILITY_SHORTCUT_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Setting specifying if the accessibility shortcut is enabled. * @hide @@ -6466,9 +6036,6 @@ public final class Settings { public static final String ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN = "accessibility_shortcut_on_lock_screen"; - private static final Validator ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Setting specifying if the accessibility shortcut dialog has been shown to this user. * @hide @@ -6476,9 +6043,6 @@ public final class Settings { public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN = "accessibility_shortcut_dialog_shown"; - private static final Validator ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Setting specifying the accessibility service to be toggled via the accessibility * shortcut. Must be its flattened {@link ComponentName}. @@ -6488,9 +6052,6 @@ public final class Settings { public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE = "accessibility_shortcut_target_service"; - private static final Validator ACCESSIBILITY_SHORTCUT_TARGET_SERVICE_VALIDATOR = - NULLABLE_COMPONENT_NAME_VALIDATOR; - /** * Setting specifying the accessibility service or feature to be toggled via the * accessibility button in the navigation bar. This is either a flattened @@ -6501,32 +6062,17 @@ public final class Settings { public static final String ACCESSIBILITY_BUTTON_TARGET_COMPONENT = "accessibility_button_target_component"; - private static final Validator ACCESSIBILITY_BUTTON_TARGET_COMPONENT_VALIDATOR = - new Validator() { - @Override - public boolean validate(@Nullable String value) { - // technically either ComponentName or class name, but there's proper value - // validation at callsites, so allow any non-null string - return value != null; - } - }; - /** * If touch exploration is enabled. */ public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled"; - private static final Validator TOUCH_EXPLORATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * List of the enabled accessibility providers. */ public static final String ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services"; - private static final Validator ENABLED_ACCESSIBILITY_SERVICES_VALIDATOR = - new ComponentNameListValidator(":"); - /** * List of the accessibility services to which the user has granted * permission to put the device into touch exploration mode. @@ -6536,17 +6082,12 @@ public final class Settings { public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES = "touch_exploration_granted_accessibility_services"; - private static final Validator TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES_VALIDATOR = - new ComponentNameListValidator(":"); - /** * Whether the Global Actions Panel is enabled. * @hide */ public static final String GLOBAL_ACTIONS_PANEL_ENABLED = "global_actions_panel_enabled"; - private static final Validator GLOBAL_ACTIONS_PANEL_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Whether the Global Actions Panel can be toggled on or off in Settings. * @hide @@ -6568,17 +6109,12 @@ public final class Settings { @SystemApi public static final String HUSH_GESTURE_USED = "hush_gesture_used"; - private static final Validator HUSH_GESTURE_USED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Number of times the user has manually clicked the ringer toggle * @hide */ public static final String MANUAL_RINGER_TOGGLE_COUNT = "manual_ringer_toggle_count"; - private static final Validator MANUAL_RINGER_TOGGLE_COUNT_VALIDATOR = - NON_NEGATIVE_INTEGER_VALIDATOR; - /** * Whether to play a sound for charging events. * @hide @@ -6600,8 +6136,6 @@ public final class Settings { */ public static final String ZEN_DURATION = "zen_duration"; - private static final Validator ZEN_DURATION_VALIDATOR = ANY_INTEGER_VALIDATOR; - /** @hide */ public static final int ZEN_DURATION_PROMPT = -1; /** @hide */ public static final int ZEN_DURATION_FOREVER = 0; @@ -6637,8 +6171,6 @@ public final class Settings { */ public static final String IN_CALL_NOTIFICATION_ENABLED = "in_call_notification_enabled"; - private static final Validator IN_CALL_NOTIFICATION_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR; - /** * Uri of the slice that's presented on the keyguard. * Defaults to a slice with the date and next alarm. @@ -6665,9 +6197,6 @@ public final class Settings { public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED = "high_text_contrast_enabled"; - private static final Validator ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Setting that specifies whether the display magnification is enabled via a system-wide * triple tap gesture. Display magnifications allows the user to zoom in the display content @@ -6680,9 +6209,6 @@ public final class Settings { public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = "accessibility_display_magnification_enabled"; - private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Setting that specifies whether the display magnification is enabled via a shortcut * affordance within the system's navigation area. Display magnifications allows the user to @@ -6695,9 +6221,6 @@ public final class Settings { public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED = "accessibility_display_magnification_navbar_enabled"; - private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED_VALIDATOR - = BOOLEAN_VALIDATOR; - /** * Setting that specifies what the display magnification scale is. * Display magnifications allows the user to zoom in the display @@ -6711,9 +6234,6 @@ public final class Settings { public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE = "accessibility_display_magnification_scale"; - private static final Validator ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE_VALIDATOR = - new InclusiveFloatRangeValidator(1.0f, Float.MAX_VALUE); - /** * Unused mangnification setting * @@ -6766,9 +6286,6 @@ public final class Settings { public static final String ACCESSIBILITY_CAPTIONING_ENABLED = "accessibility_captioning_enabled"; - private static final Validator ACCESSIBILITY_CAPTIONING_ENABLED_VALIDATOR = - BOOLEAN_VALIDATOR; - /** * Setting that specifies the language for captions as a locale string, * e.g. en_US. @@ -6779,8 +6296,6 @@ public final class Settings { public static final String ACCESSIBILITY_CAPTIONING_LOCALE = "accessibility_captioning_locale"; - private static final Validator ACCESSIBILITY_CAPTIONING_LOCALE_VALIDATOR = LOCALE_VALIDATOR; - /** * Integer property that specifies the preset style for captions, one * of: @@ -6795,10 +6310,6 @@ public final class Settings { public static final String ACCESSIBILITY_CAPTIONING_PRESET = "accessibility_captioning_preset"; - private static final Validator ACCESSIBILITY_CAPTIONING_PRESET_VALIDATOR = - new DiscreteValueValidator(new String[]{"-1", "0", "1", "2", - "3", "4"}); - /** * Integer property that specifes the background color for captions as a * packed 32-bit color. @@ -6809,9 +6320,6 @@ public final class Settings { public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR = "accessibility_captioning_background_color"; - private static final Validator ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR_VALIDATOR = - ANY_INTEGER_VALIDATOR; - /** * Integer property that specifes the foreground color for captions as a * packed 32-bit color. @@ -6822,9 +6330,6 @@ public final class Settings { public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR = "accessibility_captioning_foreground_color"; - private static final Validator ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR_VALIDATOR = - ANY_INTEGER_VALIDATOR; - /** * Integer property that specifes the edge type for captions, one of: *