Loading src/java/com/android/internal/telephony/MccTable.java +4 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony; import android.app.ActivityManager; import android.app.AlarmManager; import android.content.Context; import android.content.res.Configuration; import android.net.wifi.WifiManager; Loading Loading @@ -359,21 +358,13 @@ public final class MccTable { * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA) */ private static void setTimezoneFromMccIfNeeded(Context context, int mcc) { String timezone = SystemProperties.get(TimeServiceHelper.TIMEZONE_PROPERTY); // timezone.equals("GMT") will be true and only true if the timezone was // set to a default value by the system server (when starting, system server. // sets the persist.sys.timezone to "GMT" if it's not set)."GMT" is not used by // any code that sets it explicitly (in case where something sets GMT explicitly, // "Etc/GMT" Olsen ID would be used). // TODO(b/64056758): Remove "timezone.equals("GMT")" hack when there's a // better way of telling if the value has been defaulted. if (timezone == null || timezone.length() == 0 || timezone.equals("GMT")) { TimeServiceHelper timeServiceHelper = TelephonyComponentFactory.getInstance().makeTimeServiceHelper(context); if (!timeServiceHelper.isTimeZoneSettingInitialized()) { String zoneId = defaultTimeZoneForMcc(mcc); if (zoneId != null && zoneId.length() > 0) { // Set time zone based on MCC AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.setTimeZone(zoneId); timeServiceHelper.setDeviceTimeZone(zoneId); Slog.d(LOG_TAG, "timezone set to " + zoneId); } } Loading src/java/com/android/internal/telephony/TimeServiceHelper.java +10 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public class TimeServiceHelper { void onTimeZoneDetectionChange(boolean enabled); } public static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; private static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; private final Context mContext; private final ContentResolver mCr; Loading Loading @@ -94,8 +94,16 @@ public class TimeServiceHelper { * Returns true if the device has an explicit time zone set. */ public boolean isTimeZoneSettingInitialized() { // timezone.equals("GMT") will be true and only true if the timezone was // set to a default value by the system server (when starting, system server // sets the persist.sys.timezone to "GMT" if it's not set). "GMT" is not used by // any code that sets it explicitly (in case where something sets GMT explicitly, // "Etc/GMT" Olsen ID would be used). // TODO(b/64056758): Remove "timezone.equals("GMT")" hack when there's a // better way of telling if the value has been defaulted. String timeZoneId = SystemProperties.get(TIMEZONE_PROPERTY); return timeZoneId != null && timeZoneId.length() > 0; return timeZoneId != null && timeZoneId.length() > 0 && !timeZoneId.equals("GMT"); } /** Loading Loading
src/java/com/android/internal/telephony/MccTable.java +4 −13 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.internal.telephony; import android.app.ActivityManager; import android.app.AlarmManager; import android.content.Context; import android.content.res.Configuration; import android.net.wifi.WifiManager; Loading Loading @@ -359,21 +358,13 @@ public final class MccTable { * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA) */ private static void setTimezoneFromMccIfNeeded(Context context, int mcc) { String timezone = SystemProperties.get(TimeServiceHelper.TIMEZONE_PROPERTY); // timezone.equals("GMT") will be true and only true if the timezone was // set to a default value by the system server (when starting, system server. // sets the persist.sys.timezone to "GMT" if it's not set)."GMT" is not used by // any code that sets it explicitly (in case where something sets GMT explicitly, // "Etc/GMT" Olsen ID would be used). // TODO(b/64056758): Remove "timezone.equals("GMT")" hack when there's a // better way of telling if the value has been defaulted. if (timezone == null || timezone.length() == 0 || timezone.equals("GMT")) { TimeServiceHelper timeServiceHelper = TelephonyComponentFactory.getInstance().makeTimeServiceHelper(context); if (!timeServiceHelper.isTimeZoneSettingInitialized()) { String zoneId = defaultTimeZoneForMcc(mcc); if (zoneId != null && zoneId.length() > 0) { // Set time zone based on MCC AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.setTimeZone(zoneId); timeServiceHelper.setDeviceTimeZone(zoneId); Slog.d(LOG_TAG, "timezone set to " + zoneId); } } Loading
src/java/com/android/internal/telephony/TimeServiceHelper.java +10 −2 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public class TimeServiceHelper { void onTimeZoneDetectionChange(boolean enabled); } public static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; private static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; private final Context mContext; private final ContentResolver mCr; Loading Loading @@ -94,8 +94,16 @@ public class TimeServiceHelper { * Returns true if the device has an explicit time zone set. */ public boolean isTimeZoneSettingInitialized() { // timezone.equals("GMT") will be true and only true if the timezone was // set to a default value by the system server (when starting, system server // sets the persist.sys.timezone to "GMT" if it's not set). "GMT" is not used by // any code that sets it explicitly (in case where something sets GMT explicitly, // "Etc/GMT" Olsen ID would be used). // TODO(b/64056758): Remove "timezone.equals("GMT")" hack when there's a // better way of telling if the value has been defaulted. String timeZoneId = SystemProperties.get(TIMEZONE_PROPERTY); return timeZoneId != null && timeZoneId.length() > 0; return timeZoneId != null && timeZoneId.length() > 0 && !timeZoneId.equals("GMT"); } /** Loading