Loading src/java/com/android/internal/telephony/NitzStateMachine.java +7 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ContentResolver; import android.content.Context; import android.os.SystemClock; Loading Loading @@ -60,7 +62,7 @@ public interface NitzStateMachine { /** * Handle a new NITZ signal being received. */ void handleNitzReceived(TimestampedValue<NitzData> nitzSignal); void handleNitzReceived(@NonNull TimestampedValue<NitzData> nitzSignal); /** * Handle the user putting the device into or out of airplane mode Loading @@ -81,6 +83,7 @@ public interface NitzStateMachine { /** * Returns the last NITZ data that was cached. */ @Nullable NitzData getCachedNitzData(); /** Loading @@ -106,7 +109,7 @@ public interface NitzStateMachine { */ boolean getIgnoreNitz(); String getNetworkCountryIsoForPhone(); @Nullable String getNetworkCountryIsoForPhone(); /** * Returns the same value as {@link SystemClock#elapsedRealtime()}. Loading Loading @@ -135,7 +138,7 @@ public interface NitzStateMachine { private final TelephonyManager mTelephonyManager; private final ContentResolver mCr; DeviceStateImpl(GsmCdmaPhone phone) { public DeviceStateImpl(GsmCdmaPhone phone) { mPhone = phone; Context context = phone.getContext(); Loading Loading @@ -166,6 +169,7 @@ public interface NitzStateMachine { } @Override @Nullable public String getNetworkCountryIsoForPhone() { return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); } Loading src/java/com/android/internal/telephony/NitzStateMachineImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -204,8 +204,8 @@ public final class NitzStateMachineImpl implements NitzStateMachine { zoneId = null; } else { OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry( nitzData, isoCountryCode); OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry(nitzData, isoCountryCode); if (DBG) { Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" + " lookupByNitzCountry(nitzData, isoCountryCode)," Loading src/java/com/android/internal/telephony/TimeZoneLookupHelper.java +0 −17 Original line number Diff line number Diff line Loading @@ -165,8 +165,6 @@ public class TimeZoneLookupHelper { } } private static final int MS_PER_HOUR = 60 * 60 * 1000; /** The last CountryTimeZones object retrieved. */ private CountryTimeZones mLastCountryTimeZones; Loading Loading @@ -296,21 +294,6 @@ public class TimeZoneLookupHelper { return countryTimeZones == null ? null : countryTimeZones.getDefaultTimeZoneId(); } /** * Finds a time zone using only information present in the supplied {@link NitzData} object. * This is a static method for use by {@link ServiceStateTracker}. * * <p><em>Note:</em> Because multiple time zones can have the same offset / DST state at a given * time this process is error prone; an arbitrary match is returned when there are multiple * candidates. The algorithm can also return a non-exact match by assuming that the DST * information provided by NITZ is incorrect. This method can return {@code null} if no matching * time zones are found. */ static TimeZone guessZoneByNitzStatic(NitzData nitzData) { OffsetResult result = lookupByNitzStatic(nitzData); return result != null ? result.getTimeZone() : null; } private static OffsetResult lookupByNitzStatic(NitzData nitzData) { int utcOffsetMillis = nitzData.getLocalOffsetMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); Loading Loading
src/java/com/android/internal/telephony/NitzStateMachine.java +7 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ContentResolver; import android.content.Context; import android.os.SystemClock; Loading Loading @@ -60,7 +62,7 @@ public interface NitzStateMachine { /** * Handle a new NITZ signal being received. */ void handleNitzReceived(TimestampedValue<NitzData> nitzSignal); void handleNitzReceived(@NonNull TimestampedValue<NitzData> nitzSignal); /** * Handle the user putting the device into or out of airplane mode Loading @@ -81,6 +83,7 @@ public interface NitzStateMachine { /** * Returns the last NITZ data that was cached. */ @Nullable NitzData getCachedNitzData(); /** Loading @@ -106,7 +109,7 @@ public interface NitzStateMachine { */ boolean getIgnoreNitz(); String getNetworkCountryIsoForPhone(); @Nullable String getNetworkCountryIsoForPhone(); /** * Returns the same value as {@link SystemClock#elapsedRealtime()}. Loading Loading @@ -135,7 +138,7 @@ public interface NitzStateMachine { private final TelephonyManager mTelephonyManager; private final ContentResolver mCr; DeviceStateImpl(GsmCdmaPhone phone) { public DeviceStateImpl(GsmCdmaPhone phone) { mPhone = phone; Context context = phone.getContext(); Loading Loading @@ -166,6 +169,7 @@ public interface NitzStateMachine { } @Override @Nullable public String getNetworkCountryIsoForPhone() { return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); } Loading
src/java/com/android/internal/telephony/NitzStateMachineImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -204,8 +204,8 @@ public final class NitzStateMachineImpl implements NitzStateMachine { zoneId = null; } else { OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry( nitzData, isoCountryCode); OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry(nitzData, isoCountryCode); if (DBG) { Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" + " lookupByNitzCountry(nitzData, isoCountryCode)," Loading
src/java/com/android/internal/telephony/TimeZoneLookupHelper.java +0 −17 Original line number Diff line number Diff line Loading @@ -165,8 +165,6 @@ public class TimeZoneLookupHelper { } } private static final int MS_PER_HOUR = 60 * 60 * 1000; /** The last CountryTimeZones object retrieved. */ private CountryTimeZones mLastCountryTimeZones; Loading Loading @@ -296,21 +294,6 @@ public class TimeZoneLookupHelper { return countryTimeZones == null ? null : countryTimeZones.getDefaultTimeZoneId(); } /** * Finds a time zone using only information present in the supplied {@link NitzData} object. * This is a static method for use by {@link ServiceStateTracker}. * * <p><em>Note:</em> Because multiple time zones can have the same offset / DST state at a given * time this process is error prone; an arbitrary match is returned when there are multiple * candidates. The algorithm can also return a non-exact match by assuming that the DST * information provided by NITZ is incorrect. This method can return {@code null} if no matching * time zones are found. */ static TimeZone guessZoneByNitzStatic(NitzData nitzData) { OffsetResult result = lookupByNitzStatic(nitzData); return result != null ? result.getTimeZone() : null; } private static OffsetResult lookupByNitzStatic(NitzData nitzData) { int utcOffsetMillis = nitzData.getLocalOffsetMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); Loading