Merge "Tweak logged info for time / time zone detection" am: 142a3f86e3
Change-Id: I8346420788fda6617e1eb0db8566a762b7af31d1
This commit is contained in:
@@ -87,11 +87,15 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
|
|||||||
private static final long SYSTEM_CLOCK_PARANOIA_THRESHOLD_MILLIS = 2 * 1000;
|
private static final long SYSTEM_CLOCK_PARANOIA_THRESHOLD_MILLIS = 2 * 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of previous telephony suggestions to keep for each ID (for use during debugging).
|
* The number of suggestions to keep. These are logged in bug reports to assist when debugging
|
||||||
|
* issues with detection.
|
||||||
*/
|
*/
|
||||||
private static final int KEEP_SUGGESTION_HISTORY_SIZE = 30;
|
private static final int KEEP_SUGGESTION_HISTORY_SIZE = 10;
|
||||||
|
|
||||||
// A log for changes made to the system clock and why.
|
/**
|
||||||
|
* A log that records the decisions / decision metadata that affected the device's system clock
|
||||||
|
* time. This is logged in bug reports to assist with debugging issues with detection.
|
||||||
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
private final LocalLog mTimeChangesLog = new LocalLog(30, false /* useLocalTimestamps */);
|
private final LocalLog mTimeChangesLog = new LocalLog(30, false /* useLocalTimestamps */);
|
||||||
|
|
||||||
@@ -140,7 +144,18 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
|
|||||||
if (!validateSuggestionTime(timeSuggestion.getUtcTime(), timeSuggestion)) {
|
if (!validateSuggestionTime(timeSuggestion.getUtcTime(), timeSuggestion)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The caller submits suggestions with the best available information when there are network
|
||||||
|
// changes. The best available information may have been cached and if they were all stored
|
||||||
|
// this would lead to duplicates showing up in the suggestion history. The suggestions may
|
||||||
|
// be made for different reasons but there is not a significant benefit to storing the same
|
||||||
|
// suggestion information again. doAutoTimeDetection() should still be called: this ensures
|
||||||
|
// the suggestion and device state are always re-evaluated, which might produce a different
|
||||||
|
// detected time if, for example, the age of all suggestions are considered.
|
||||||
|
NetworkTimeSuggestion lastNetworkSuggestion = mLastNetworkSuggestion.get();
|
||||||
|
if (lastNetworkSuggestion == null || !lastNetworkSuggestion.equals(timeSuggestion)) {
|
||||||
mLastNetworkSuggestion.set(timeSuggestion);
|
mLastNetworkSuggestion.set(timeSuggestion);
|
||||||
|
}
|
||||||
|
|
||||||
// Now perform auto time detection. The new suggestion may be used to modify the system
|
// Now perform auto time detection. The new suggestion may be used to modify the system
|
||||||
// clock.
|
// clock.
|
||||||
|
|||||||
@@ -161,16 +161,17 @@ public final class TimeZoneDetectorStrategyImpl implements TimeZoneDetectorStrat
|
|||||||
public static final int TELEPHONY_SCORE_USAGE_THRESHOLD = TELEPHONY_SCORE_MEDIUM;
|
public static final int TELEPHONY_SCORE_USAGE_THRESHOLD = TELEPHONY_SCORE_MEDIUM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of previous telephony suggestions to keep for each ID (for use during debugging).
|
* The number of suggestions to keep. These are logged in bug reports to assist when debugging
|
||||||
|
* issues with detection.
|
||||||
*/
|
*/
|
||||||
private static final int KEEP_TELEPHONY_SUGGESTION_HISTORY_SIZE = 30;
|
private static final int KEEP_SUGGESTION_HISTORY_SIZE = 10;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final Callback mCallback;
|
private final Callback mCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A log that records the decisions / decision metadata that affected the device's time zone
|
* A log that records the decisions / decision metadata that affected the device's time zone.
|
||||||
* (for use during debugging).
|
* This is logged in bug reports to assist with debugging issues with detection.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
private final LocalLog mTimeZoneChangesLog = new LocalLog(30, false /* useLocalTimestamps */);
|
private final LocalLog mTimeZoneChangesLog = new LocalLog(30, false /* useLocalTimestamps */);
|
||||||
@@ -182,8 +183,7 @@ public final class TimeZoneDetectorStrategyImpl implements TimeZoneDetectorStrat
|
|||||||
*/
|
*/
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private ArrayMapWithHistory<Integer, QualifiedTelephonyTimeZoneSuggestion>
|
private ArrayMapWithHistory<Integer, QualifiedTelephonyTimeZoneSuggestion>
|
||||||
mSuggestionBySlotIndex =
|
mSuggestionBySlotIndex = new ArrayMapWithHistory<>(KEEP_SUGGESTION_HISTORY_SIZE);
|
||||||
new ArrayMapWithHistory<>(KEEP_TELEPHONY_SUGGESTION_HISTORY_SIZE);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of {@link TimeZoneDetectorStrategyImpl}.
|
* Creates a new instance of {@link TimeZoneDetectorStrategyImpl}.
|
||||||
|
|||||||
Reference in New Issue
Block a user