Merge "Remove Settings.System.DATE_FORMAT" into sc-dev

This commit is contained in:
Neil Fuller
2021-04-21 20:09:40 +00:00
committed by Android (Google) Code Review
8 changed files with 5 additions and 30 deletions

View File

@@ -35359,7 +35359,7 @@ package android.provider {
field @Deprecated public static final String BLUETOOTH_ON = "bluetooth_on";
field public static final android.net.Uri CONTENT_URI;
field @Deprecated public static final String DATA_ROAMING = "data_roaming";
field public static final String DATE_FORMAT = "date_format";
field @Deprecated public static final String DATE_FORMAT = "date_format";
field @Deprecated public static final String DEBUG_APP = "debug_app";
field public static final android.net.Uri DEFAULT_ALARM_ALERT_URI;
field public static final android.net.Uri DEFAULT_NOTIFICATION_URI;

View File

@@ -4666,11 +4666,9 @@ public final class Settings {
public static final String TIME_12_24 = "time_12_24";
/**
* Date format string
* mm/dd/yyyy
* dd/mm/yyyy
* yyyy/mm/dd
* @deprecated No longer used. Use {@link #TIME_12_24} instead.
*/
@Deprecated
@Readable
public static final String DATE_FORMAT = "date_format";

View File

@@ -52,7 +52,8 @@ message SystemSettingsProto {
}
optional Bluetooth bluetooth = 4;
optional SettingProto date_format = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
reserved 5; // date_format is not used
optional SettingProto display_color_mode = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
message DevOptions {

View File

@@ -56,7 +56,6 @@ public class SystemSettings {
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,

View File

@@ -25,7 +25,6 @@ import android.text.TextUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Locale;
/**
@@ -192,18 +191,6 @@ public class SettingsValidators {
public static final Validator TILE_LIST_VALIDATOR = new TileListValidator();
static final Validator DATE_FORMAT_VALIDATOR = value -> {
try {
if (value == null) {
return true;
}
new SimpleDateFormat(value);
return true;
} catch (IllegalArgumentException | NullPointerException e) {
return false;
}
};
static final Validator COLON_SEPARATED_COMPONENT_LIST_VALIDATOR =
new ComponentNameListValidator(":");

View File

@@ -19,7 +19,6 @@ package android.provider.settings.validators;
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.DATE_FORMAT_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.LENIENT_IP_ADDRESS_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.NON_NEGATIVE_INTEGER_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.URI_VALIDATOR;
@@ -146,7 +145,6 @@ public class SystemSettingsValidators {
});
VALIDATORS.put(
System.TIME_12_24, new DiscreteValueValidator(new String[] {"12", "24", null}));
VALIDATORS.put(System.DATE_FORMAT, DATE_FORMAT_VALIDATOR);
VALIDATORS.put(System.SETUP_WIZARD_HAS_RUN, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.ACCELEROMETER_ROTATION, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.USER_ROTATION, new InclusiveIntegerRangeValidator(0, 3));

View File

@@ -2704,9 +2704,6 @@ class SettingsProtoDumpUtil {
SystemSettingsProto.Bluetooth.DISCOVERABILITY_TIMEOUT_SECS);
p.end(bluetoothToken);
dumpSetting(s, p,
Settings.System.DATE_FORMAT,
SystemSettingsProto.DATE_FORMAT);
dumpSetting(s, p,
Settings.System.DISPLAY_COLOR_MODE,
SystemSettingsProto.DISPLAY_COLOR_MODE);

View File

@@ -219,11 +219,6 @@ public class SettingsValidatorsTest {
assertFalse(v.validate(null));
}
@Test
public void dateFormatValidator_onNullValue_returnsTrue() {
assertTrue(SettingsValidators.DATE_FORMAT_VALIDATOR.validate(null));
}
@Test
public void testJSONObjectValidator() throws JSONException {
Validator v = SettingsValidators.JSON_OBJECT_VALIDATOR;