Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4c16dc4 authored by Neil Fuller's avatar Neil Fuller Committed by Android (Google) Code Review
Browse files

Merge "Add support for tz detection telephony fallback"

parents 899d9804 0313abd3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -95,6 +95,13 @@ public interface TimeZoneDetector {
     */
    String SHELL_COMMAND_SUGGEST_TELEPHONY_TIME_ZONE = "suggest_telephony_time_zone";

    /**
     * A shell command that enables telephony time zone fallback. See {@link
     * com.android.server.timezonedetector.TimeZoneDetectorStrategy} for details.
     * @hide
     */
    String SHELL_COMMAND_ENABLE_TELEPHONY_FALLBACK = "enable_telephony_fallback";

    /**
     * A shared utility method to create a {@link ManualTimeZoneSuggestion}.
     *
+7 −0
Original line number Diff line number Diff line
@@ -1802,6 +1802,13 @@
         provider services. -->
    <string name="config_secondaryLocationTimeZoneProviderPackageName" translatable="false"></string>

    <!-- Whether the time zone detection logic supports fall back from geolocation suggestions to
         telephony suggestions temporarily in certain circumstances. Reduces time zone detection
         latency during some scenarios like air travel. Only useful when both geolocation and
         telephony time zone detection are supported on a device.
         See com.android.server.timezonedetector.TimeZoneDetectorStrategy for more information. -->
    <bool name="config_supportTelephonyTimeZoneFallback" translatable="false">false</bool>

    <!-- Whether to enable network location overlay which allows network location provider to be
         replaced by an app at run-time. When disabled, only the
         config_networkLocationProviderPackageName package will be searched for network location
+1 −0
Original line number Diff line number Diff line
@@ -2238,6 +2238,7 @@
  <java-symbol type="string" name="config_primaryLocationTimeZoneProviderPackageName" />
  <java-symbol type="bool" name="config_enableSecondaryLocationTimeZoneProvider" />
  <java-symbol type="string" name="config_secondaryLocationTimeZoneProviderPackageName" />
  <java-symbol type="bool" name="config_supportTelephonyTimeZoneFallback" />
  <java-symbol type="bool" name="config_autoResetAirplaneMode" />
  <java-symbol type="string" name="config_notificationAccessConfirmationActivity" />
  <java-symbol type="bool" name="config_killableInputMethods" />
+9 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public final class ServerFlags {
            KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT,
            KEY_TIME_DETECTOR_LOWER_BOUND_MILLIS_OVERRIDE,
            KEY_TIME_DETECTOR_ORIGIN_PRIORITIES_OVERRIDE,
            KEY_TIME_ZONE_DETECTOR_TELEPHONY_FALLBACK_SUPPORTED,
    })
    @Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
    @Retention(RetentionPolicy.SOURCE)
@@ -138,6 +139,14 @@ public final class ServerFlags {
            KEY_LOCATION_TIME_ZONE_DETECTION_SETTING_ENABLED_DEFAULT =
            "location_time_zone_detection_setting_enabled_default";

    /**
     * The key to control support for time zone detection falling back to telephony detection under
     * certain circumstances.
     */
    public static final @DeviceConfigKey String
            KEY_TIME_ZONE_DETECTOR_TELEPHONY_FALLBACK_SUPPORTED =
            "time_zone_detector_telephony_fallback_supported";

    /**
     * The key to override the time detector origin priorities configuration. A comma-separated list
     * of strings that will be passed to {@link TimeDetectorStrategy#stringToOrigin(String)}.
+25 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public final class ConfigurationInternal {

    private final boolean mTelephonyDetectionSupported;
    private final boolean mGeoDetectionSupported;
    private final boolean mTelephonyFallbackSupported;
    private final boolean mAutoDetectionEnabledSetting;
    private final @UserIdInt int mUserId;
    private final boolean mUserConfigAllowed;
@@ -48,6 +49,7 @@ public final class ConfigurationInternal {
    private ConfigurationInternal(Builder builder) {
        mTelephonyDetectionSupported = builder.mTelephonyDetectionSupported;
        mGeoDetectionSupported = builder.mGeoDetectionSupported;
        mTelephonyFallbackSupported = builder.mTelephonyFallbackSupported;
        mAutoDetectionEnabledSetting = builder.mAutoDetectionEnabledSetting;

        mUserId = builder.mUserId;
@@ -71,6 +73,14 @@ public final class ConfigurationInternal {
        return mGeoDetectionSupported;
    }

    /**
     * Returns true if the device supports time zone detection falling back to telephony detection
     * under certain circumstances.
     */
    public boolean isTelephonyFallbackSupported() {
        return mTelephonyFallbackSupported;
    }

    /** Returns the value of the auto time zone detection enabled setting. */
    public boolean getAutoDetectionEnabledSetting() {
        return mAutoDetectionEnabledSetting;
@@ -216,6 +226,7 @@ public final class ConfigurationInternal {
                && mUserConfigAllowed == that.mUserConfigAllowed
                && mTelephonyDetectionSupported == that.mTelephonyDetectionSupported
                && mGeoDetectionSupported == that.mGeoDetectionSupported
                && mTelephonyFallbackSupported == that.mTelephonyFallbackSupported
                && mAutoDetectionEnabledSetting == that.mAutoDetectionEnabledSetting
                && mLocationEnabledSetting == that.mLocationEnabledSetting
                && mGeoDetectionEnabledSetting == that.mGeoDetectionEnabledSetting;
@@ -224,8 +235,8 @@ public final class ConfigurationInternal {
    @Override
    public int hashCode() {
        return Objects.hash(mUserId, mUserConfigAllowed, mTelephonyDetectionSupported,
                mGeoDetectionSupported, mAutoDetectionEnabledSetting, mLocationEnabledSetting,
                mGeoDetectionEnabledSetting);
                mGeoDetectionSupported, mTelephonyFallbackSupported, mAutoDetectionEnabledSetting,
                mLocationEnabledSetting, mGeoDetectionEnabledSetting);
    }

    @Override
@@ -235,6 +246,7 @@ public final class ConfigurationInternal {
                + ", mUserConfigAllowed=" + mUserConfigAllowed
                + ", mTelephonyDetectionSupported=" + mTelephonyDetectionSupported
                + ", mGeoDetectionSupported=" + mGeoDetectionSupported
                + ", mTelephonyFallbackSupported=" + mTelephonyFallbackSupported
                + ", mAutoDetectionEnabledSetting=" + mAutoDetectionEnabledSetting
                + ", mLocationEnabledSetting=" + mLocationEnabledSetting
                + ", mGeoDetectionEnabledSetting=" + mGeoDetectionEnabledSetting
@@ -251,6 +263,7 @@ public final class ConfigurationInternal {
        private boolean mUserConfigAllowed;
        private boolean mTelephonyDetectionSupported;
        private boolean mGeoDetectionSupported;
        private boolean mTelephonyFallbackSupported;
        private boolean mAutoDetectionEnabledSetting;
        private boolean mLocationEnabledSetting;
        private boolean mGeoDetectionEnabledSetting;
@@ -269,6 +282,7 @@ public final class ConfigurationInternal {
            this.mUserId = toCopy.mUserId;
            this.mUserConfigAllowed = toCopy.mUserConfigAllowed;
            this.mTelephonyDetectionSupported = toCopy.mTelephonyDetectionSupported;
            this.mTelephonyFallbackSupported = toCopy.mTelephonyFallbackSupported;
            this.mGeoDetectionSupported = toCopy.mGeoDetectionSupported;
            this.mAutoDetectionEnabledSetting = toCopy.mAutoDetectionEnabledSetting;
            this.mLocationEnabledSetting = toCopy.mLocationEnabledSetting;
@@ -299,6 +313,15 @@ public final class ConfigurationInternal {
            return this;
        }

        /**
         * Sets whether time zone detection supports falling back to telephony detection under
         * certain circumstances.
         */
        public Builder setTelephonyFallbackSupported(boolean supported) {
            mTelephonyFallbackSupported = supported;
            return this;
        }

        /**
         * Sets the value of the automatic time zone detection enabled setting for this device.
         */
Loading