Merge "Merge "Disable auto time zone on non-telephony devices" am: 2edc5306da am: d14160c658 am: 7c93c7bf34 am: 081b3cf9c3" into rvc-qpr-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2020-03-04 17:57:40 +00:00
committed by Android (Google) Code Review

View File

@@ -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,7 +41,20 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat
@Override
public boolean isAutoTimeZoneDetectionEnabled() {
return Settings.Global.getInt(mCr, Settings.Global.AUTO_TIME_ZONE, 1 /* default */) > 0;
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