Add a setting to support for NITZ retention

Add a setting to support for NITZ retention, see the comments for
details. The comments for related settings have also been updated to
better reflect their meaning / improve consistency with the new setting.

Bug: 204415203
Test: See frameworks/opt/telephony/ change
Change-Id: Idb21dc9ea7a1ad5cbb7a8bd238ab9a71174ee1ff
This commit is contained in:
Neil Fuller
2021-11-01 17:20:46 +00:00
parent 206e10a3a3
commit b9d11bfce5
4 changed files with 55 additions and 22 deletions

View File

@@ -11218,22 +11218,38 @@ public final class Settings {
"night_display_forced_auto_mode_available";
/**
* If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
* to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
* exceeded.
* @hide
*/
* If UTC time between two NITZ signals is greater than this value then the second signal
* cannot be ignored.
*
* <p>This value is in milliseconds. It is used for telephony-based time and time zone
* detection.
* @hide
*/
@Readable
public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
/**
* The length of time in milli-seconds that automatic small adjustments to
* SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
* @hide
*/
* If the elapsed realtime between two NITZ signals is greater than this value then the
* second signal cannot be ignored.
*
* <p>This value is in milliseconds. It is used for telephony-based time and time zone
* detection.
* @hide
*/
@Readable
public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
/**
* If the device connects to a telephony network and was disconnected from a telephony
* network for less than this time, a previously received NITZ signal can be restored.
*
* <p>This value is in milliseconds. It is used for telephony-based time and time zone
* detection.
* @hide
*/
public static final String NITZ_NETWORK_DISCONNECT_RETENTION =
"nitz_network_disconnect_retention";
/** Preferred NTP server. {@hide} */
@Readable
public static final String NTP_SERVER = "ntp_server";

View File

@@ -672,18 +672,31 @@ message GlobalSettingsProto {
optional SettingProto new_contact_aggregator = 79 [ (android.privacy).dest = DEST_AUTOMATIC ];
optional SettingProto night_display_forced_auto_mode_available = 80 [ (android.privacy).dest = DEST_AUTOMATIC ];
message NitzUpdate {
message Nitz {
option (android.msg_privacy).dest = DEST_EXPLICIT;
// If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment to
// SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
// exceeded.
optional SettingProto diff = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
// The length of time in milli-seconds that automatic small adjustments to
// SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
optional SettingProto spacing = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
// If UTC time between two NITZ signals is greater than this value then the second signal
// cannot be ignored.
//
// This value is in milliseconds. It is used for telephony-based time and time zone
// detection.
optional SettingProto update_diff = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
// If the elapsed realtime between two NITZ signals is greater than this value then the
// second signal cannot be ignored.
//
// This value is in milliseconds. It is used for telephony-based time and time zone
// detection.
optional SettingProto update_spacing = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
// If the device connects to a telephony network and was disconnected from a telephony
// network for less than this time, a previously received NITZ signal can be restored.
//
// This value is in milliseconds. It is used for telephony-based time and time zone
// detection.
optional SettingProto network_disconnect_retention = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional NitzUpdate nitz_update = 81;
optional Nitz nitz = 81;
message Notification {
option (android.msg_privacy).dest = DEST_EXPLICIT;

View File

@@ -1085,14 +1085,17 @@ class SettingsProtoDumpUtil {
Settings.Global.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE,
GlobalSettingsProto.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE);
final long nitzUpdateToken = p.start(GlobalSettingsProto.NITZ_UPDATE);
final long nitzToken = p.start(GlobalSettingsProto.NITZ);
dumpSetting(s, p,
Settings.Global.NITZ_UPDATE_DIFF,
GlobalSettingsProto.NitzUpdate.DIFF);
GlobalSettingsProto.Nitz.UPDATE_DIFF);
dumpSetting(s, p,
Settings.Global.NITZ_UPDATE_SPACING,
GlobalSettingsProto.NitzUpdate.SPACING);
p.end(nitzUpdateToken);
GlobalSettingsProto.Nitz.UPDATE_SPACING);
dumpSetting(s, p,
Settings.Global.NITZ_NETWORK_DISCONNECT_RETENTION,
GlobalSettingsProto.Nitz.NETWORK_DISCONNECT_RETENTION);
p.end(nitzToken);
final long notificationToken = p.start(GlobalSettingsProto.NOTIFICATION);
dumpSetting(s, p,

View File

@@ -388,6 +388,7 @@ public class SettingsBackupTest {
Settings.Global.NETWORK_WATCHLIST_ENABLED,
Settings.Global.NEW_CONTACT_AGGREGATOR,
Settings.Global.NIGHT_DISPLAY_FORCED_AUTO_MODE_AVAILABLE,
Settings.Global.NITZ_NETWORK_DISCONNECT_RETENTION,
Settings.Global.NITZ_UPDATE_DIFF,
Settings.Global.NITZ_UPDATE_SPACING,
Settings.Global.NOTIFICATION_SNOOZE_OPTIONS,