From dfa685c683e0f5223ffe4a0eaf86cfa953dc36ce Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Tue, 20 Apr 2021 13:15:23 +0100 Subject: [PATCH] Update settings for Date / Time / Zone Update SettingsProtoDumpUtil / secure.proto to reference the new (user scoped) location_time_zone_detection_enabled setting that has been added for S. This has been added in a "DateTime" message to reflect the SettingsUI structure. For consistency with secure.proto and the settings strings, global.proto and the associated SettingsProtoDumpUtil code has updated to rename the "Auto.time" and "Auto.time_zone" proto fields to "DateTime.auto_time" and "DateTime.auto_time_zone". This is a binary compatible change as the field IDs have not been changed. Note: The "time_12_24" and "date_format" settings, which are user-scoped settings from "Settings.System" have been left for a future release besides some minor docs improvements. See bug 185884644. This change also improve the docs for settings that are associated with date and time. Bug: 151304765 Bug: 185884644 Test: build / treehugger Change-Id: If2daf3f530bd1add7a0a5cc3260221ea3ad8952d --- core/java/android/provider/Settings.java | 18 ++++++++------ .../android/providers/settings/global.proto | 16 ++++++------- .../android/providers/settings/secure.proto | 9 ++++++- .../settings/SettingsProtoDumpUtil.java | 24 ++++++++++++------- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 2616a6676db11..03e6d389d95fa 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4658,9 +4658,12 @@ public final class Settings { public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE; /** - * Display times as 12 or 24 hours - * 12 - * 24 + * Display the user's times, e.g. in the status bar, as 12 or 24 hours. + * */ @Readable public static final String TIME_12_24 = "time_12_24"; @@ -10227,15 +10230,16 @@ public final class Settings { public static final int WIFI_SLEEP_POLICY_NEVER = 2; /** - * Value to specify if the user prefers the date, time and time zone - * to be automatically fetched from the network (NITZ). 1=yes, 0=no + * Value to specify if the device's UTC system clock should be set automatically, e.g. using + * telephony signals like NITZ, or other sources like GNSS or NTP. 1=yes, 0=no (manual) */ @Readable public static final String AUTO_TIME = "auto_time"; /** - * Value to specify if the user prefers the time zone - * to be automatically fetched from the network (NITZ). 1=yes, 0=no + * Value to specify if the device's time zone system property should be set automatically, + * e.g. using telephony signals like MCC and NITZ, or other mechanisms like the location. + * 1=yes, 0=no (manual). */ @Readable public static final String AUTO_TIME_ZONE = "auto_time_zone"; diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto index ad1d25208a9a6..8ee0e397191c2 100644 --- a/core/proto/android/providers/settings/global.proto +++ b/core/proto/android/providers/settings/global.proto @@ -89,14 +89,6 @@ message GlobalSettingsProto { optional SettingProto assisted_gps_enabled = 14 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto audio_safe_volume_state = 15 [ (android.privacy).dest = DEST_AUTOMATIC ]; - message Auto { - option (android.msg_privacy).dest = DEST_EXPLICIT; - - optional SettingProto time = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; - optional SettingProto time_zone = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; - } - optional Auto auto = 16; - reserved 17; // Used to be autofill_compat_mode_allowed_packages message Autofill { @@ -253,6 +245,14 @@ message GlobalSettingsProto { } optional Database database = 36; + message DateTime { + option (android.msg_privacy).dest = DEST_EXPLICIT; + + optional SettingProto auto_time = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto auto_time_zone = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; + } + optional DateTime date_time = 16; + message Debug { option (android.msg_privacy).dest = DEST_EXPLICIT; diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index 530cb44d3aae8..ae6dcfdc2817b 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -217,6 +217,13 @@ message SecureSettingsProto { optional SettingProto display_density_forced = 19 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto double_tap_to_wake = 20 [ (android.privacy).dest = DEST_AUTOMATIC ]; + message DateTime { + option (android.msg_privacy).dest = DEST_EXPLICIT; + + optional SettingProto location_time_zone_detection_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; + } + optional DateTime date_time = 90; + message Doze { option (android.msg_privacy).dest = DEST_EXPLICIT; @@ -656,5 +663,5 @@ message SecureSettingsProto { // Please insert fields in alphabetical order and group them into messages // if possible (to avoid reaching the method limit). - // Next tag = 90; + // Next tag = 91; } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 4119dc9f22063..de6969d38c685 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -242,15 +242,6 @@ class SettingsProtoDumpUtil { Settings.Global.AUDIO_SAFE_VOLUME_STATE, GlobalSettingsProto.AUDIO_SAFE_VOLUME_STATE); - final long autoToken = p.start(GlobalSettingsProto.AUTO); - dumpSetting(s, p, - Settings.Global.AUTO_TIME, - GlobalSettingsProto.Auto.TIME); - dumpSetting(s, p, - Settings.Global.AUTO_TIME_ZONE, - GlobalSettingsProto.Auto.TIME_ZONE); - p.end(autoToken); - final long autofillToken = p.start(GlobalSettingsProto.AUTOFILL); dumpSetting(s, p, Settings.Global.AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES, @@ -509,6 +500,15 @@ class SettingsProtoDumpUtil { GlobalSettingsProto.Database.CREATION_BUILDID); p.end(databaseToken); + final long dateTimeToken = p.start(GlobalSettingsProto.DATE_TIME); + dumpSetting(s, p, + Settings.Global.AUTO_TIME, + GlobalSettingsProto.DateTime.AUTO_TIME); + dumpSetting(s, p, + Settings.Global.AUTO_TIME_ZONE, + GlobalSettingsProto.DateTime.AUTO_TIME_ZONE); + p.end(dateTimeToken); + final long debugToken = p.start(GlobalSettingsProto.DEBUG); dumpSetting(s, p, Settings.Global.DEBUG_APP, @@ -2022,6 +2022,12 @@ class SettingsProtoDumpUtil { SecureSettingsProto.Controls.ENABLED); p.end(controlsToken); + final long dateTimeToken = p.start(SecureSettingsProto.DATE_TIME); + dumpSetting(s, p, + Settings.Secure.LOCATION_TIME_ZONE_DETECTION_ENABLED, + SecureSettingsProto.DateTime.LOCATION_TIME_ZONE_DETECTION_ENABLED); + p.end(dateTimeToken); + dumpSetting(s, p, Settings.Secure.DEVICE_PAIRED, SecureSettingsProto.DEVICE_PAIRED);