Loading src/java/com/android/internal/telephony/NitzStateMachine.java +7 −3 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.os.SystemClock; import android.os.SystemClock; Loading Loading @@ -60,7 +62,7 @@ public interface NitzStateMachine { /** /** * Handle a new NITZ signal being received. * 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 * 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. * Returns the last NITZ data that was cached. */ */ @Nullable NitzData getCachedNitzData(); NitzData getCachedNitzData(); /** /** Loading @@ -106,7 +109,7 @@ public interface NitzStateMachine { */ */ boolean getIgnoreNitz(); boolean getIgnoreNitz(); String getNetworkCountryIsoForPhone(); @Nullable String getNetworkCountryIsoForPhone(); /** /** * Returns the same value as {@link SystemClock#elapsedRealtime()}. * Returns the same value as {@link SystemClock#elapsedRealtime()}. Loading Loading @@ -135,7 +138,7 @@ public interface NitzStateMachine { private final TelephonyManager mTelephonyManager; private final TelephonyManager mTelephonyManager; private final ContentResolver mCr; private final ContentResolver mCr; DeviceStateImpl(GsmCdmaPhone phone) { public DeviceStateImpl(GsmCdmaPhone phone) { mPhone = phone; mPhone = phone; Context context = phone.getContext(); Context context = phone.getContext(); Loading Loading @@ -166,6 +169,7 @@ public interface NitzStateMachine { } } @Override @Override @Nullable public String getNetworkCountryIsoForPhone() { public String getNetworkCountryIsoForPhone() { return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); } } Loading src/java/com/android/internal/telephony/NitzStateMachineImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -204,8 +204,8 @@ public final class NitzStateMachineImpl implements NitzStateMachine { zoneId = null; zoneId = null; } else { } else { OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry( OffsetResult lookupResult = nitzData, isoCountryCode); mTimeZoneLookupHelper.lookupByNitzCountry(nitzData, isoCountryCode); if (DBG) { if (DBG) { Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" + " lookupByNitzCountry(nitzData, isoCountryCode)," + " lookupByNitzCountry(nitzData, isoCountryCode)," Loading src/java/com/android/internal/telephony/TimeZoneLookupHelper.java +0 −17 Original line number Original line 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. */ /** The last CountryTimeZones object retrieved. */ private CountryTimeZones mLastCountryTimeZones; private CountryTimeZones mLastCountryTimeZones; Loading Loading @@ -296,21 +294,6 @@ public class TimeZoneLookupHelper { return countryTimeZones == null ? null : countryTimeZones.getDefaultTimeZoneId(); 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) { private static OffsetResult lookupByNitzStatic(NitzData nitzData) { int utcOffsetMillis = nitzData.getLocalOffsetMillis(); int utcOffsetMillis = nitzData.getLocalOffsetMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); Loading Loading
src/java/com/android/internal/telephony/NitzStateMachine.java +7 −3 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.internal.telephony; package com.android.internal.telephony; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.Context; import android.content.Context; import android.os.SystemClock; import android.os.SystemClock; Loading Loading @@ -60,7 +62,7 @@ public interface NitzStateMachine { /** /** * Handle a new NITZ signal being received. * 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 * 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. * Returns the last NITZ data that was cached. */ */ @Nullable NitzData getCachedNitzData(); NitzData getCachedNitzData(); /** /** Loading @@ -106,7 +109,7 @@ public interface NitzStateMachine { */ */ boolean getIgnoreNitz(); boolean getIgnoreNitz(); String getNetworkCountryIsoForPhone(); @Nullable String getNetworkCountryIsoForPhone(); /** /** * Returns the same value as {@link SystemClock#elapsedRealtime()}. * Returns the same value as {@link SystemClock#elapsedRealtime()}. Loading Loading @@ -135,7 +138,7 @@ public interface NitzStateMachine { private final TelephonyManager mTelephonyManager; private final TelephonyManager mTelephonyManager; private final ContentResolver mCr; private final ContentResolver mCr; DeviceStateImpl(GsmCdmaPhone phone) { public DeviceStateImpl(GsmCdmaPhone phone) { mPhone = phone; mPhone = phone; Context context = phone.getContext(); Context context = phone.getContext(); Loading Loading @@ -166,6 +169,7 @@ public interface NitzStateMachine { } } @Override @Override @Nullable public String getNetworkCountryIsoForPhone() { public String getNetworkCountryIsoForPhone() { return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); return mTelephonyManager.getNetworkCountryIsoForPhone(mPhone.getPhoneId()); } } Loading
src/java/com/android/internal/telephony/NitzStateMachineImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -204,8 +204,8 @@ public final class NitzStateMachineImpl implements NitzStateMachine { zoneId = null; zoneId = null; } else { } else { OffsetResult lookupResult = mTimeZoneLookupHelper.lookupByNitzCountry( OffsetResult lookupResult = nitzData, isoCountryCode); mTimeZoneLookupHelper.lookupByNitzCountry(nitzData, isoCountryCode); if (DBG) { if (DBG) { Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" Rlog.d(LOG_TAG, "updateTimeZoneFromCountryAndNitz: using" + " lookupByNitzCountry(nitzData, isoCountryCode)," + " lookupByNitzCountry(nitzData, isoCountryCode)," Loading
src/java/com/android/internal/telephony/TimeZoneLookupHelper.java +0 −17 Original line number Original line 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. */ /** The last CountryTimeZones object retrieved. */ private CountryTimeZones mLastCountryTimeZones; private CountryTimeZones mLastCountryTimeZones; Loading Loading @@ -296,21 +294,6 @@ public class TimeZoneLookupHelper { return countryTimeZones == null ? null : countryTimeZones.getDefaultTimeZoneId(); 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) { private static OffsetResult lookupByNitzStatic(NitzData nitzData) { int utcOffsetMillis = nitzData.getLocalOffsetMillis(); int utcOffsetMillis = nitzData.getLocalOffsetMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); long timeMillis = nitzData.getCurrentTimeInMillis(); Loading