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

Commit 5e2c1827 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Disable auto time zone on non-telephony devices" into rvc-dev am:...

Merge "Disable auto time zone on non-telephony devices" into rvc-dev am: 13805dec am: d605c8ed am: dab25d68

Change-Id: I6b53f4d9ae477a903f36198005d163e8f6562743
parents 0f16ba55 dab25d68
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() {