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

Commit 9a2dc953 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Disable auto time zone on non-telephony devices" am: 2edc5306...

Merge "Merge "Disable auto time zone on non-telephony devices" am: 2edc5306 am: d14160c6 am: 7c93c7bf am: 081b3cf9" into rvc-qpr-dev-plus-aosp
parents 3adfa95c 7580bd34
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.app.AlarmManager;
import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
import android.os.SystemProperties;
import android.provider.Settings;

@@ -40,8 +41,21 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat

    @Override
    public boolean isAutoTimeZoneDetectionEnabled() {
        if (isAutoTimeZoneDetectionSupported()) {
            return Settings.Global.getInt(mCr, Settings.Global.AUTO_TIME_ZONE, 1 /* default */) > 0;
        }
        return false;
    }

    private boolean isAutoTimeZoneDetectionSupported() {
        return deviceHasTelephonyNetwork();
    }

    private boolean deviceHasTelephonyNetwork() {
        // TODO b/150583524 Avoid the use of a deprecated API.
        return mContext.getSystemService(ConnectivityManager.class)
                .isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
    }

    @Override
    public boolean isDeviceTimeZoneInitialized() {