Loading src/java/com/android/internal/telephony/NitzStateMachineImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.app.timedetector.PhoneTimeSuggestion; import android.content.Context; import android.os.PowerManager; import android.telephony.Rlog; Loading Loading @@ -428,7 +429,11 @@ public final class NitzStateMachineImpl implements NitzStateMachine { Rlog.d(LOG_TAG, logMsg); } mTimeLog.log(logMsg); mTimeServiceHelper.suggestDeviceTime(newNitzTime); PhoneTimeSuggestion phoneTimeSuggestion = new PhoneTimeSuggestion(mPhone.getPhoneId(), newNitzTime); phoneTimeSuggestion.addDebugInfo(logMsg); mTimeServiceHelper.suggestDeviceTime(phoneTimeSuggestion); TelephonyMetrics.getInstance().writeNITZEvent( mPhone.getPhoneId(), newNitzTime.getValue()); Loading src/java/com/android/internal/telephony/TimeServiceHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.internal.telephony; import android.app.timedetector.PhoneTimeSuggestion; import android.app.timedetector.TimeDetector; import android.util.TimestampedValue; /** * An interface to various time / time zone detection behaviors that should be centralized into a Loading Loading @@ -62,8 +62,8 @@ public interface TimeServiceHelper { /** * Suggest the time to the {@link TimeDetector}. * * @param signalTimeMillis the signal time as received from the network * @param phoneTimeSuggestion the suggested time */ void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis); void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion); } src/java/com/android/internal/telephony/TimeServiceHelperImpl.java +3 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ package com.android.internal.telephony; import android.app.AlarmManager; import android.app.timedetector.PhoneTimeSuggestion; import android.app.timedetector.TimeDetector; import android.app.timedetector.TimeSignal; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; Loading @@ -27,7 +27,6 @@ import android.os.Handler; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.util.TimestampedValue; /** * An interface to various time / time zone detection behaviors that should be centralized into a Loading Loading @@ -89,9 +88,8 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper { } @Override public void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis) { TimeSignal timeSignal = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, signalTimeMillis); mTimeDetector.suggestTime(timeSignal); public void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion) { mTimeDetector.suggestPhoneTime(phoneTimeSuggestion); } /** Loading tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java +132 −92 File changed.Preview size limit exceeded, changes collapsed. Show changes tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java +8 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony; import static org.junit.Assert.fail; import android.app.timedetector.PhoneTimeSuggestion; import android.icu.util.Calendar; import android.icu.util.GregorianCalendar; import android.icu.util.TimeZone; Loading Loading @@ -260,6 +261,13 @@ public final class NitzStateMachineTestSupport { return cal.getTimeInMillis(); } public static PhoneTimeSuggestion createTimeSuggestionFromNitzSignal( int phoneId, TimestampedValue<NitzData> nitzSignal) { PhoneTimeSuggestion timeSuggestion = new PhoneTimeSuggestion(phoneId, createTimeSignalFromNitzSignal(nitzSignal)); return timeSuggestion; } public static TimestampedValue<Long> createTimeSignalFromNitzSignal( TimestampedValue<NitzData> nitzSignal) { return new TimestampedValue<>( Loading Loading
src/java/com/android/internal/telephony/NitzStateMachineImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony; import android.app.timedetector.PhoneTimeSuggestion; import android.content.Context; import android.os.PowerManager; import android.telephony.Rlog; Loading Loading @@ -428,7 +429,11 @@ public final class NitzStateMachineImpl implements NitzStateMachine { Rlog.d(LOG_TAG, logMsg); } mTimeLog.log(logMsg); mTimeServiceHelper.suggestDeviceTime(newNitzTime); PhoneTimeSuggestion phoneTimeSuggestion = new PhoneTimeSuggestion(mPhone.getPhoneId(), newNitzTime); phoneTimeSuggestion.addDebugInfo(logMsg); mTimeServiceHelper.suggestDeviceTime(phoneTimeSuggestion); TelephonyMetrics.getInstance().writeNITZEvent( mPhone.getPhoneId(), newNitzTime.getValue()); Loading
src/java/com/android/internal/telephony/TimeServiceHelper.java +3 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.internal.telephony; import android.app.timedetector.PhoneTimeSuggestion; import android.app.timedetector.TimeDetector; import android.util.TimestampedValue; /** * An interface to various time / time zone detection behaviors that should be centralized into a Loading Loading @@ -62,8 +62,8 @@ public interface TimeServiceHelper { /** * Suggest the time to the {@link TimeDetector}. * * @param signalTimeMillis the signal time as received from the network * @param phoneTimeSuggestion the suggested time */ void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis); void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion); }
src/java/com/android/internal/telephony/TimeServiceHelperImpl.java +3 −5 Original line number Diff line number Diff line Loading @@ -17,8 +17,8 @@ package com.android.internal.telephony; import android.app.AlarmManager; import android.app.timedetector.PhoneTimeSuggestion; import android.app.timedetector.TimeDetector; import android.app.timedetector.TimeSignal; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; Loading @@ -27,7 +27,6 @@ import android.os.Handler; import android.os.SystemProperties; import android.os.UserHandle; import android.provider.Settings; import android.util.TimestampedValue; /** * An interface to various time / time zone detection behaviors that should be centralized into a Loading Loading @@ -89,9 +88,8 @@ public final class TimeServiceHelperImpl implements TimeServiceHelper { } @Override public void suggestDeviceTime(TimestampedValue<Long> signalTimeMillis) { TimeSignal timeSignal = new TimeSignal(TimeSignal.SOURCE_ID_NITZ, signalTimeMillis); mTimeDetector.suggestTime(timeSignal); public void suggestDeviceTime(PhoneTimeSuggestion phoneTimeSuggestion) { mTimeDetector.suggestPhoneTime(phoneTimeSuggestion); } /** Loading
tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineImplTest.java +132 −92 File changed.Preview size limit exceeded, changes collapsed. Show changes
tests/telephonytests/src/com/android/internal/telephony/NitzStateMachineTestSupport.java +8 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.telephony; import static org.junit.Assert.fail; import android.app.timedetector.PhoneTimeSuggestion; import android.icu.util.Calendar; import android.icu.util.GregorianCalendar; import android.icu.util.TimeZone; Loading Loading @@ -260,6 +261,13 @@ public final class NitzStateMachineTestSupport { return cal.getTimeInMillis(); } public static PhoneTimeSuggestion createTimeSuggestionFromNitzSignal( int phoneId, TimestampedValue<NitzData> nitzSignal) { PhoneTimeSuggestion timeSuggestion = new PhoneTimeSuggestion(phoneId, createTimeSignalFromNitzSignal(nitzSignal)); return timeSuggestion; } public static TimestampedValue<Long> createTimeSignalFromNitzSignal( TimestampedValue<NitzData> nitzSignal) { return new TimestampedValue<>( Loading