Merge "Disable auto time zone on non-telephony devices" into rvc-dev
This commit is contained in:
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
|
|||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
@@ -40,7 +41,20 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAutoTimeZoneDetectionEnabled() {
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user