Loading services/core/java/com/android/server/timedetector/ServerFlags.java +20 −20 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import com.android.internal.annotations.GuardedBy; import com.android.server.timezonedetector.ConfigurationChangeListener; import com.android.server.timezonedetector.ServiceConfigAccessor; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.time.DateTimeException; import java.time.Duration; import java.time.Instant; Loading Loading @@ -63,6 +65,7 @@ public final class ServerFlags { KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE, KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE, }) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @Retention(RetentionPolicy.SOURCE) @interface DeviceConfigKey {} Loading @@ -72,40 +75,39 @@ public final class ServerFlags { * {@link ServiceConfigAccessor#isGeoTimeZoneDetectionFeatureSupportedInConfig()} and {@link * ServiceConfigAccessor#isGeoTimeZoneDetectionFeatureSupported()}. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_FEATURE_SUPPORTED = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_FEATURE_SUPPORTED = "location_time_zone_detection_feature_supported"; /** * The key for the server flag that can override the device config for whether the primary * location time zone provider is enabled, disabled, or (for testing) in simulation mode. */ @DeviceConfigKey public static final String KEY_PRIMARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = public static final @DeviceConfigKey String KEY_PRIMARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = "primary_location_time_zone_provider_mode_override"; /** * The key for the server flag that can override the device config for whether the secondary * location time zone provider is enabled or disabled, or (for testing) in simulation mode. */ @DeviceConfigKey public static final String KEY_SECONDARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = public static final @DeviceConfigKey String KEY_SECONDARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = "secondary_location_time_zone_provider_mode_override"; /** * The key for the minimum delay after location time zone detection has been enabled before the * location time zone manager can report it is uncertain about the time zone. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_UNCERTAINTY_DELAY_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_UNCERTAINTY_DELAY_MILLIS = "location_time_zone_detection_uncertainty_delay_millis"; /** * The key for the timeout passed to a location time zone provider that tells it how long it has * to provide an explicit first suggestion without being declared uncertain. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS = "ltpz_init_timeout_millis"; /** Loading @@ -113,8 +115,8 @@ public final class ServerFlags { * #KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS} by the location time zone * manager before the location time zone provider will actually be declared uncertain. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_FUZZ_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_FUZZ_MILLIS = "ltpz_init_timeout_fuzz_millis"; /** Loading @@ -123,16 +125,16 @@ public final class ServerFlags { * disable the feature by turning off the master location switch, or by disabling automatic time * zone detection. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_OVERRIDE = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_OVERRIDE = "location_time_zone_detection_setting_enabled_override"; /** * The key for the default value used to determine whether location time zone detection is * enabled when the user hasn't explicitly set it yet. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT = "location_time_zone_detection_setting_enabled_default"; /** Loading @@ -140,16 +142,14 @@ public final class ServerFlags { * of strings that will be passed to {@link TimeDetectorStrategy#stringToOrigin(String)}. * All values must be recognized or the override value will be ignored. */ @DeviceConfigKey public static final String KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE = public static final @DeviceConfigKey String KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE = "time_detector_origin_priorities_override"; /** * The key to override the time detector lower bound configuration. The values is the number of * milliseconds since the beginning of the Unix epoch. */ @DeviceConfigKey public static final String KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE = public static final @DeviceConfigKey String KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE = "time_detector_lower_bound_millis_override"; @GuardedBy("mListeners") Loading services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java +5 −10 Original line number Diff line number Diff line Loading @@ -53,24 +53,19 @@ public interface TimeDetectorStrategy extends Dumpable { @interface Origin {} /** Used when a time value originated from a telephony signal. */ @Origin int ORIGIN_TELEPHONY = 1; @Origin int ORIGIN_TELEPHONY = 1; /** Used when a time value originated from a user / manual settings. */ @Origin int ORIGIN_MANUAL = 2; @Origin int ORIGIN_MANUAL = 2; /** Used when a time value originated from a network signal. */ @Origin int ORIGIN_NETWORK = 3; @Origin int ORIGIN_NETWORK = 3; /** Used when a time value originated from a gnss signal. */ @Origin int ORIGIN_GNSS = 4; @Origin int ORIGIN_GNSS = 4; /** Used when a time value originated from an externally specified signal. */ @Origin int ORIGIN_EXTERNAL = 5; @Origin int ORIGIN_EXTERNAL = 5; /** Processes the suggested time from telephony sources. */ void suggestTelephonyTime(@NonNull TelephonyTimeSuggestion timeSuggestion); Loading services/core/java/com/android/server/timezonedetector/MetricsTimeZoneDetectorState.java +10 −8 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import android.app.timezonedetector.TelephonyTimeZoneSuggestion; import android.util.proto.ProtoOutputStream; import java.io.ByteArrayOutputStream; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List; import java.util.Objects; Loading @@ -44,14 +48,13 @@ public final class MetricsTimeZoneDetectorState { @IntDef(prefix = "DETECTION_MODE_", value = { DETECTION_MODE_MANUAL, DETECTION_MODE_GEO, DETECTION_MODE_TELEPHONY}) @Retention(RetentionPolicy.SOURCE) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @interface DetectionMode {}; @DetectionMode public static final int DETECTION_MODE_MANUAL = 0; @DetectionMode public static final int DETECTION_MODE_GEO = 1; @DetectionMode public static final int DETECTION_MODE_TELEPHONY = 2; public static final @DetectionMode int DETECTION_MODE_MANUAL = 0; public static final @DetectionMode int DETECTION_MODE_GEO = 1; public static final @DetectionMode int DETECTION_MODE_TELEPHONY = 2; @NonNull private final ConfigurationInternal mConfigurationInternal; Loading Loading @@ -132,8 +135,7 @@ public final class MetricsTimeZoneDetectorState { * Returns the detection mode the device is currently using, which can be influenced by various * things besides the user's setting. */ @DetectionMode public int getDetectionMode() { public @DetectionMode int getDetectionMode() { if (!mConfigurationInternal.getAutoDetectionEnabledBehavior()) { return DETECTION_MODE_MANUAL; } else if (mConfigurationInternal.getGeoDetectionEnabledBehavior()) { Loading services/core/java/com/android/server/timezonedetector/OrdinalGenerator.java +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.function.Function; class OrdinalGenerator<T> { private final ArraySet<T> mKnownIds = new ArraySet<>(); private final @NonNull Function<T, T> mCanonicalizationFunction; @NonNull private final Function<T, T> mCanonicalizationFunction; OrdinalGenerator(@NonNull Function<T, T> canonicalizationFunction) { mCanonicalizationFunction = Objects.requireNonNull(canonicalizationFunction); Loading services/core/java/com/android/server/timezonedetector/ServiceConfigAccessor.java +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public final class ServiceConfigAccessor { @StringDef(prefix = "PROVIDER_MODE_", value = { PROVIDER_MODE_SIMULATED, PROVIDER_MODE_DISABLED, PROVIDER_MODE_ENABLED}) @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE_USE) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @interface ProviderMode {} /** Loading Loading
services/core/java/com/android/server/timedetector/ServerFlags.java +20 −20 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import com.android.internal.annotations.GuardedBy; import com.android.server.timezonedetector.ConfigurationChangeListener; import com.android.server.timezonedetector.ServiceConfigAccessor; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.time.DateTimeException; import java.time.Duration; import java.time.Instant; Loading Loading @@ -63,6 +65,7 @@ public final class ServerFlags { KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE, KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE, }) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @Retention(RetentionPolicy.SOURCE) @interface DeviceConfigKey {} Loading @@ -72,40 +75,39 @@ public final class ServerFlags { * {@link ServiceConfigAccessor#isGeoTimeZoneDetectionFeatureSupportedInConfig()} and {@link * ServiceConfigAccessor#isGeoTimeZoneDetectionFeatureSupported()}. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_FEATURE_SUPPORTED = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_FEATURE_SUPPORTED = "location_time_zone_detection_feature_supported"; /** * The key for the server flag that can override the device config for whether the primary * location time zone provider is enabled, disabled, or (for testing) in simulation mode. */ @DeviceConfigKey public static final String KEY_PRIMARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = public static final @DeviceConfigKey String KEY_PRIMARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = "primary_location_time_zone_provider_mode_override"; /** * The key for the server flag that can override the device config for whether the secondary * location time zone provider is enabled or disabled, or (for testing) in simulation mode. */ @DeviceConfigKey public static final String KEY_SECONDARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = public static final @DeviceConfigKey String KEY_SECONDARY_LOCATION_TIME_ZONE_PROVIDER_MODE_OVERRIDE = "secondary_location_time_zone_provider_mode_override"; /** * The key for the minimum delay after location time zone detection has been enabled before the * location time zone manager can report it is uncertain about the time zone. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_UNCERTAINTY_DELAY_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_UNCERTAINTY_DELAY_MILLIS = "location_time_zone_detection_uncertainty_delay_millis"; /** * The key for the timeout passed to a location time zone provider that tells it how long it has * to provide an explicit first suggestion without being declared uncertain. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS = "ltpz_init_timeout_millis"; /** Loading @@ -113,8 +115,8 @@ public final class ServerFlags { * #KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_MILLIS} by the location time zone * manager before the location time zone provider will actually be declared uncertain. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_FUZZ_MILLIS = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_PROVIDER_INITIALIZATION_TIMEOUT_FUZZ_MILLIS = "ltpz_init_timeout_fuzz_millis"; /** Loading @@ -123,16 +125,16 @@ public final class ServerFlags { * disable the feature by turning off the master location switch, or by disabling automatic time * zone detection. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_OVERRIDE = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_OVERRIDE = "location_time_zone_detection_setting_enabled_override"; /** * The key for the default value used to determine whether location time zone detection is * enabled when the user hasn't explicitly set it yet. */ @DeviceConfigKey public static final String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT = public static final @DeviceConfigKey String KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT = "location_time_zone_detection_setting_enabled_default"; /** Loading @@ -140,16 +142,14 @@ public final class ServerFlags { * of strings that will be passed to {@link TimeDetectorStrategy#stringToOrigin(String)}. * All values must be recognized or the override value will be ignored. */ @DeviceConfigKey public static final String KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE = public static final @DeviceConfigKey String KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE = "time_detector_origin_priorities_override"; /** * The key to override the time detector lower bound configuration. The values is the number of * milliseconds since the beginning of the Unix epoch. */ @DeviceConfigKey public static final String KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE = public static final @DeviceConfigKey String KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE = "time_detector_lower_bound_millis_override"; @GuardedBy("mListeners") Loading
services/core/java/com/android/server/timedetector/TimeDetectorStrategy.java +5 −10 Original line number Diff line number Diff line Loading @@ -53,24 +53,19 @@ public interface TimeDetectorStrategy extends Dumpable { @interface Origin {} /** Used when a time value originated from a telephony signal. */ @Origin int ORIGIN_TELEPHONY = 1; @Origin int ORIGIN_TELEPHONY = 1; /** Used when a time value originated from a user / manual settings. */ @Origin int ORIGIN_MANUAL = 2; @Origin int ORIGIN_MANUAL = 2; /** Used when a time value originated from a network signal. */ @Origin int ORIGIN_NETWORK = 3; @Origin int ORIGIN_NETWORK = 3; /** Used when a time value originated from a gnss signal. */ @Origin int ORIGIN_GNSS = 4; @Origin int ORIGIN_GNSS = 4; /** Used when a time value originated from an externally specified signal. */ @Origin int ORIGIN_EXTERNAL = 5; @Origin int ORIGIN_EXTERNAL = 5; /** Processes the suggested time from telephony sources. */ void suggestTelephonyTime(@NonNull TelephonyTimeSuggestion timeSuggestion); Loading
services/core/java/com/android/server/timezonedetector/MetricsTimeZoneDetectorState.java +10 −8 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import android.app.timezonedetector.TelephonyTimeZoneSuggestion; import android.util.proto.ProtoOutputStream; import java.io.ByteArrayOutputStream; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List; import java.util.Objects; Loading @@ -44,14 +48,13 @@ public final class MetricsTimeZoneDetectorState { @IntDef(prefix = "DETECTION_MODE_", value = { DETECTION_MODE_MANUAL, DETECTION_MODE_GEO, DETECTION_MODE_TELEPHONY}) @Retention(RetentionPolicy.SOURCE) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @interface DetectionMode {}; @DetectionMode public static final int DETECTION_MODE_MANUAL = 0; @DetectionMode public static final int DETECTION_MODE_GEO = 1; @DetectionMode public static final int DETECTION_MODE_TELEPHONY = 2; public static final @DetectionMode int DETECTION_MODE_MANUAL = 0; public static final @DetectionMode int DETECTION_MODE_GEO = 1; public static final @DetectionMode int DETECTION_MODE_TELEPHONY = 2; @NonNull private final ConfigurationInternal mConfigurationInternal; Loading Loading @@ -132,8 +135,7 @@ public final class MetricsTimeZoneDetectorState { * Returns the detection mode the device is currently using, which can be influenced by various * things besides the user's setting. */ @DetectionMode public int getDetectionMode() { public @DetectionMode int getDetectionMode() { if (!mConfigurationInternal.getAutoDetectionEnabledBehavior()) { return DETECTION_MODE_MANUAL; } else if (mConfigurationInternal.getGeoDetectionEnabledBehavior()) { Loading
services/core/java/com/android/server/timezonedetector/OrdinalGenerator.java +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.function.Function; class OrdinalGenerator<T> { private final ArraySet<T> mKnownIds = new ArraySet<>(); private final @NonNull Function<T, T> mCanonicalizationFunction; @NonNull private final Function<T, T> mCanonicalizationFunction; OrdinalGenerator(@NonNull Function<T, T> canonicalizationFunction) { mCanonicalizationFunction = Objects.requireNonNull(canonicalizationFunction); Loading
services/core/java/com/android/server/timezonedetector/ServiceConfigAccessor.java +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public final class ServiceConfigAccessor { @StringDef(prefix = "PROVIDER_MODE_", value = { PROVIDER_MODE_SIMULATED, PROVIDER_MODE_DISABLED, PROVIDER_MODE_ENABLED}) @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE_USE) @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER }) @interface ProviderMode {} /** Loading