Loading src/java/com/android/internal/telephony/NitzStateMachine.java +10 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ public interface NitzStateMachine { * Returns the same value as {@link SystemClock#elapsedRealtime()}. */ long elapsedRealtime(); /** * Returns the same value as {@link System#currentTimeMillis()}. */ long currentTimeMillis(); } /** Loading Loading @@ -169,5 +174,10 @@ public interface NitzStateMachine { public long elapsedRealtime() { return SystemClock.elapsedRealtime(); } @Override public long currentTimeMillis() { return System.currentTimeMillis(); } } } src/java/com/android/internal/telephony/NitzStateMachineImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine { */ private void updateTimeZoneFromNetworkCountryCode(String iso) { CountryResult lookupResult = mTimeZoneLookupHelper.lookupByCountry( iso, mTimeServiceHelper.currentTimeMillis()); iso, mDeviceState.currentTimeMillis()); if (lookupResult != null && lookupResult.allZonesHaveSameOffset) { String logMsg = "updateTimeZoneFromNetworkCountryCode: tz result found" + " iso=" + iso Loading src/java/com/android/internal/telephony/TimeServiceHelper.java +0 −5 Original line number Diff line number Diff line Loading @@ -41,11 +41,6 @@ public interface TimeServiceHelper { */ void setListener(Listener listener); /** * Returns the same value as {@link System#currentTimeMillis()}. */ long currentTimeMillis(); /** * Returns true if the device has an explicit time zone set. */ Loading src/java/com/android/internal/telephony/TimeServiceHelperImpl.java +0 −5 Original line number Diff line number Diff line Loading @@ -68,11 +68,6 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper { }); } @Override public long currentTimeMillis() { return System.currentTimeMillis(); } @Override public boolean isTimeZoneSettingInitialized() { return isTimeZoneSettingInitializedStatic(); Loading tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java +9 −9 Original line number Diff line number Diff line Loading @@ -88,8 +88,8 @@ public class NitzStateMachineImplTest extends TelephonyTest { super.setUp("NitzStateMachineTest"); // In tests we use a fake impls for TimeServiceHelper and DeviceState. mFakeTimeServiceHelper = new FakeTimeServiceHelper(); mFakeDeviceState = new FakeDeviceState(); mFakeTimeServiceHelper = new FakeTimeServiceHelper(mFakeDeviceState); // In tests we use the real TimeZoneLookupHelper. mRealTimeZoneLookupHelper = new TimeZoneLookupHelper(); Loading Loading @@ -750,7 +750,7 @@ public class NitzStateMachineImplTest extends TelephonyTest { } Script initializeSystemClock(long timeMillis) { mFakeTimeServiceHelper.currentTimeMillis = timeMillis; mFakeDeviceState.currentTimeMillis = timeMillis; return this; } Loading Loading @@ -892,22 +892,22 @@ public class NitzStateMachineImplTest extends TelephonyTest { private static class FakeTimeServiceHelper implements TimeServiceHelper { private final FakeDeviceState mFakeDeviceState; public TimeServiceHelper.Listener listener; public boolean timeZoneDetectionEnabled; public long currentTimeMillis; // State we want to track. public TestState<String> deviceTimeZone = new TestState<>(); public TestState<TimestampedValue<Long>> suggestedTime = new TestState<>(); @Override public void setListener(Listener listener) { this.listener = listener; FakeTimeServiceHelper(FakeDeviceState fakeDeviceState) { mFakeDeviceState = fakeDeviceState; } @Override public long currentTimeMillis() { return currentTimeMillis; public void setListener(Listener listener) { this.listener = listener; } @Override Loading @@ -929,7 +929,7 @@ public class NitzStateMachineImplTest extends TelephonyTest { public void suggestDeviceTime(TimestampedValue<Long> deviceTime) { suggestedTime.set(deviceTime); // The fake time service just uses the latest suggestion. currentTimeMillis = deviceTime.getValue(); mFakeDeviceState.currentTimeMillis = deviceTime.getValue(); } void commitState() { Loading Loading
src/java/com/android/internal/telephony/NitzStateMachine.java +10 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ public interface NitzStateMachine { * Returns the same value as {@link SystemClock#elapsedRealtime()}. */ long elapsedRealtime(); /** * Returns the same value as {@link System#currentTimeMillis()}. */ long currentTimeMillis(); } /** Loading Loading @@ -169,5 +174,10 @@ public interface NitzStateMachine { public long elapsedRealtime() { return SystemClock.elapsedRealtime(); } @Override public long currentTimeMillis() { return System.currentTimeMillis(); } } }
src/java/com/android/internal/telephony/NitzStateMachineImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ public final class NitzStateMachineImpl implements NitzStateMachine { */ private void updateTimeZoneFromNetworkCountryCode(String iso) { CountryResult lookupResult = mTimeZoneLookupHelper.lookupByCountry( iso, mTimeServiceHelper.currentTimeMillis()); iso, mDeviceState.currentTimeMillis()); if (lookupResult != null && lookupResult.allZonesHaveSameOffset) { String logMsg = "updateTimeZoneFromNetworkCountryCode: tz result found" + " iso=" + iso Loading
src/java/com/android/internal/telephony/TimeServiceHelper.java +0 −5 Original line number Diff line number Diff line Loading @@ -41,11 +41,6 @@ public interface TimeServiceHelper { */ void setListener(Listener listener); /** * Returns the same value as {@link System#currentTimeMillis()}. */ long currentTimeMillis(); /** * Returns true if the device has an explicit time zone set. */ Loading
src/java/com/android/internal/telephony/TimeServiceHelperImpl.java +0 −5 Original line number Diff line number Diff line Loading @@ -68,11 +68,6 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper { }); } @Override public long currentTimeMillis() { return System.currentTimeMillis(); } @Override public boolean isTimeZoneSettingInitialized() { return isTimeZoneSettingInitializedStatic(); Loading
tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java +9 −9 Original line number Diff line number Diff line Loading @@ -88,8 +88,8 @@ public class NitzStateMachineImplTest extends TelephonyTest { super.setUp("NitzStateMachineTest"); // In tests we use a fake impls for TimeServiceHelper and DeviceState. mFakeTimeServiceHelper = new FakeTimeServiceHelper(); mFakeDeviceState = new FakeDeviceState(); mFakeTimeServiceHelper = new FakeTimeServiceHelper(mFakeDeviceState); // In tests we use the real TimeZoneLookupHelper. mRealTimeZoneLookupHelper = new TimeZoneLookupHelper(); Loading Loading @@ -750,7 +750,7 @@ public class NitzStateMachineImplTest extends TelephonyTest { } Script initializeSystemClock(long timeMillis) { mFakeTimeServiceHelper.currentTimeMillis = timeMillis; mFakeDeviceState.currentTimeMillis = timeMillis; return this; } Loading Loading @@ -892,22 +892,22 @@ public class NitzStateMachineImplTest extends TelephonyTest { private static class FakeTimeServiceHelper implements TimeServiceHelper { private final FakeDeviceState mFakeDeviceState; public TimeServiceHelper.Listener listener; public boolean timeZoneDetectionEnabled; public long currentTimeMillis; // State we want to track. public TestState<String> deviceTimeZone = new TestState<>(); public TestState<TimestampedValue<Long>> suggestedTime = new TestState<>(); @Override public void setListener(Listener listener) { this.listener = listener; FakeTimeServiceHelper(FakeDeviceState fakeDeviceState) { mFakeDeviceState = fakeDeviceState; } @Override public long currentTimeMillis() { return currentTimeMillis; public void setListener(Listener listener) { this.listener = listener; } @Override Loading @@ -929,7 +929,7 @@ public class NitzStateMachineImplTest extends TelephonyTest { public void suggestDeviceTime(TimestampedValue<Long> deviceTime) { suggestedTime.set(deviceTime); // The fake time service just uses the latest suggestion. currentTimeMillis = deviceTime.getValue(); mFakeDeviceState.currentTimeMillis = deviceTime.getValue(); } void commitState() { Loading