Merge "Rename phoneId to slotIndex"
diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt
index eeef074..278a186 100644
--- a/api/module-lib-current.txt
+++ b/api/module-lib-current.txt
@@ -6,7 +6,7 @@
method public void addDebugInfo(@NonNull java.util.List<java.lang.String>);
method public int describeContents();
method @NonNull public java.util.List<java.lang.String> getDebugInfo();
- method public int getPhoneId();
+ method public int getSlotIndex();
method @Nullable public android.os.TimestampedValue<java.lang.Long> getUtcTime();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.timedetector.PhoneTimeSuggestion> CREATOR;
@@ -34,8 +34,8 @@
method public int describeContents();
method @NonNull public java.util.List<java.lang.String> getDebugInfo();
method public int getMatchType();
- method public int getPhoneId();
method public int getQuality();
+ method public int getSlotIndex();
method @Nullable public String getZoneId();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.timezonedetector.PhoneTimeZoneSuggestion> CREATOR;
diff --git a/core/java/android/app/timedetector/PhoneTimeSuggestion.java b/core/java/android/app/timedetector/PhoneTimeSuggestion.java
index bd649f8..eab8838 100644
--- a/core/java/android/app/timedetector/PhoneTimeSuggestion.java
+++ b/core/java/android/app/timedetector/PhoneTimeSuggestion.java
@@ -57,19 +57,19 @@
}
};
- private final int mPhoneId;
+ private final int mSlotIndex;
@Nullable private final TimestampedValue<Long> mUtcTime;
@Nullable private ArrayList<String> mDebugInfo;
private PhoneTimeSuggestion(Builder builder) {
- mPhoneId = builder.mPhoneId;
+ mSlotIndex = builder.mSlotIndex;
mUtcTime = builder.mUtcTime;
mDebugInfo = builder.mDebugInfo != null ? new ArrayList<>(builder.mDebugInfo) : null;
}
private static PhoneTimeSuggestion createFromParcel(Parcel in) {
- int phoneId = in.readInt();
- PhoneTimeSuggestion suggestion = new PhoneTimeSuggestion.Builder(phoneId)
+ int slotIndex = in.readInt();
+ PhoneTimeSuggestion suggestion = new PhoneTimeSuggestion.Builder(slotIndex)
.setUtcTime(in.readParcelable(null /* classLoader */))
.build();
@SuppressWarnings("unchecked")
@@ -87,17 +87,17 @@
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeInt(mPhoneId);
+ dest.writeInt(mSlotIndex);
dest.writeParcelable(mUtcTime, 0);
dest.writeList(mDebugInfo);
}
/**
- * Returns an identifier for the source of this suggestion. When a device has several "phones",
- * i.e. sim slots or equivalent, it is used to identify which one.
+ * Returns an identifier for the source of this suggestion. When a device has several sim slots
+ * or equivalent, it is used to identify which one the suggestion is from.
*/
- public int getPhoneId() {
- return mPhoneId;
+ public int getSlotIndex() {
+ return mSlotIndex;
}
/**
@@ -152,19 +152,19 @@
return false;
}
PhoneTimeSuggestion that = (PhoneTimeSuggestion) o;
- return mPhoneId == that.mPhoneId
+ return mSlotIndex == that.mSlotIndex
&& Objects.equals(mUtcTime, that.mUtcTime);
}
@Override
public int hashCode() {
- return Objects.hash(mPhoneId, mUtcTime);
+ return Objects.hash(mSlotIndex, mUtcTime);
}
@Override
public String toString() {
return "PhoneTimeSuggestion{"
- + "mPhoneId='" + mPhoneId + '\''
+ + "mSlotIndex='" + mSlotIndex + '\''
+ ", mUtcTime=" + mUtcTime
+ ", mDebugInfo=" + mDebugInfo
+ '}';
@@ -177,13 +177,13 @@
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static final class Builder {
- private final int mPhoneId;
+ private final int mSlotIndex;
@Nullable private TimestampedValue<Long> mUtcTime;
@Nullable private List<String> mDebugInfo;
- /** Creates a builder with the specified {@code phoneId}. */
- public Builder(int phoneId) {
- mPhoneId = phoneId;
+ /** Creates a builder with the specified {@code slotIndex}. */
+ public Builder(int slotIndex) {
+ mSlotIndex = slotIndex;
}
/** Returns the builder for call chaining. */
diff --git a/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java b/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java
index d71ffcb..ebaf951 100644
--- a/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java
+++ b/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java
@@ -66,12 +66,12 @@
/**
* Creates an empty time zone suggestion, i.e. one that will cancel previous suggestions with
- * the same {@code phoneId}.
+ * the same {@code slotIndex}.
*/
@NonNull
public static PhoneTimeZoneSuggestion createEmptySuggestion(
- int phoneId, @NonNull String debugInfo) {
- return new Builder(phoneId).addDebugInfo(debugInfo).build();
+ int slotIndex, @NonNull String debugInfo) {
+ return new Builder(slotIndex).addDebugInfo(debugInfo).build();
}
/** @hide */
@@ -135,7 +135,7 @@
* The ID of the phone this suggestion is associated with. For multiple-sim devices this
* helps to establish source so filtering / stickiness can be implemented.
*/
- private final int mPhoneId;
+ private final int mSlotIndex;
/**
* The suggestion. {@code null} means there is no current suggestion and any previous suggestion
@@ -165,7 +165,7 @@
private List<String> mDebugInfo;
private PhoneTimeZoneSuggestion(Builder builder) {
- mPhoneId = builder.mPhoneId;
+ mSlotIndex = builder.mSlotIndex;
mZoneId = builder.mZoneId;
mMatchType = builder.mMatchType;
mQuality = builder.mQuality;
@@ -175,8 +175,8 @@
@SuppressWarnings("unchecked")
private static PhoneTimeZoneSuggestion createFromParcel(Parcel in) {
// Use the Builder so we get validation during build().
- int phoneId = in.readInt();
- PhoneTimeZoneSuggestion suggestion = new Builder(phoneId)
+ int slotIndex = in.readInt();
+ PhoneTimeZoneSuggestion suggestion = new Builder(slotIndex)
.setZoneId(in.readString())
.setMatchType(in.readInt())
.setQuality(in.readInt())
@@ -190,7 +190,7 @@
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
- dest.writeInt(mPhoneId);
+ dest.writeInt(mSlotIndex);
dest.writeString(mZoneId);
dest.writeInt(mMatchType);
dest.writeInt(mQuality);
@@ -203,11 +203,11 @@
}
/**
- * Returns an identifier for the source of this suggestion. When a device has several "phones",
- * i.e. sim slots or equivalent, it is used to identify which one.
+ * Returns an identifier for the source of this suggestion. When a device has several sim slots
+ * or equivalent, it is used to identify which one the suggestion is from.
*/
- public int getPhoneId() {
- return mPhoneId;
+ public int getSlotIndex() {
+ return mSlotIndex;
}
/**
@@ -282,7 +282,7 @@
return false;
}
PhoneTimeZoneSuggestion that = (PhoneTimeZoneSuggestion) o;
- return mPhoneId == that.mPhoneId
+ return mSlotIndex == that.mSlotIndex
&& mMatchType == that.mMatchType
&& mQuality == that.mQuality
&& Objects.equals(mZoneId, that.mZoneId);
@@ -290,13 +290,13 @@
@Override
public int hashCode() {
- return Objects.hash(mPhoneId, mZoneId, mMatchType, mQuality);
+ return Objects.hash(mSlotIndex, mZoneId, mMatchType, mQuality);
}
@Override
public String toString() {
return "PhoneTimeZoneSuggestion{"
- + "mPhoneId=" + mPhoneId
+ + "mSlotIndex=" + mSlotIndex
+ ", mZoneId='" + mZoneId + '\''
+ ", mMatchType=" + mMatchType
+ ", mQuality=" + mQuality
@@ -311,14 +311,14 @@
*/
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public static final class Builder {
- private final int mPhoneId;
+ private final int mSlotIndex;
@Nullable private String mZoneId;
@MatchType private int mMatchType;
@Quality private int mQuality;
@Nullable private List<String> mDebugInfo;
- public Builder(int phoneId) {
- mPhoneId = phoneId;
+ public Builder(int slotIndex) {
+ mSlotIndex = slotIndex;
}
/**
diff --git a/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java b/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java
index ba29a97..d17b635 100644
--- a/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java
+++ b/core/tests/coretests/src/android/app/timedetector/PhoneTimeSuggestionTest.java
@@ -27,17 +27,17 @@
import org.junit.Test;
public class PhoneTimeSuggestionTest {
- private static final int PHONE_ID = 99999;
+ private static final int SLOT_INDEX = 99999;
@Test
public void testEquals() {
- PhoneTimeSuggestion.Builder builder1 = new PhoneTimeSuggestion.Builder(PHONE_ID);
+ PhoneTimeSuggestion.Builder builder1 = new PhoneTimeSuggestion.Builder(SLOT_INDEX);
{
PhoneTimeSuggestion one = builder1.build();
assertEquals(one, one);
}
- PhoneTimeSuggestion.Builder builder2 = new PhoneTimeSuggestion.Builder(PHONE_ID);
+ PhoneTimeSuggestion.Builder builder2 = new PhoneTimeSuggestion.Builder(SLOT_INDEX);
{
PhoneTimeSuggestion one = builder1.build();
PhoneTimeSuggestion two = builder2.build();
@@ -59,7 +59,7 @@
assertEquals(two, one);
}
- PhoneTimeSuggestion.Builder builder3 = new PhoneTimeSuggestion.Builder(PHONE_ID + 1);
+ PhoneTimeSuggestion.Builder builder3 = new PhoneTimeSuggestion.Builder(SLOT_INDEX + 1);
builder3.setUtcTime(new TimestampedValue<>(1111L, 2222L));
{
PhoneTimeSuggestion one = builder1.build();
@@ -80,7 +80,7 @@
@Test
public void testParcelable() {
- PhoneTimeSuggestion.Builder builder = new PhoneTimeSuggestion.Builder(PHONE_ID);
+ PhoneTimeSuggestion.Builder builder = new PhoneTimeSuggestion.Builder(SLOT_INDEX);
assertRoundTripParcelable(builder.build());
builder.setUtcTime(new TimestampedValue<>(1111L, 2222L));
diff --git a/core/tests/coretests/src/android/app/timezonedetector/PhoneTimeZoneSuggestionTest.java b/core/tests/coretests/src/android/app/timezonedetector/PhoneTimeZoneSuggestionTest.java
index 0108a0b..384dbf9 100644
--- a/core/tests/coretests/src/android/app/timezonedetector/PhoneTimeZoneSuggestionTest.java
+++ b/core/tests/coretests/src/android/app/timezonedetector/PhoneTimeZoneSuggestionTest.java
@@ -26,17 +26,17 @@
import org.junit.Test;
public class PhoneTimeZoneSuggestionTest {
- private static final int PHONE_ID = 99999;
+ private static final int SLOT_INDEX = 99999;
@Test
public void testEquals() {
- PhoneTimeZoneSuggestion.Builder builder1 = new PhoneTimeZoneSuggestion.Builder(PHONE_ID);
+ PhoneTimeZoneSuggestion.Builder builder1 = new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX);
{
PhoneTimeZoneSuggestion one = builder1.build();
assertEquals(one, one);
}
- PhoneTimeZoneSuggestion.Builder builder2 = new PhoneTimeZoneSuggestion.Builder(PHONE_ID);
+ PhoneTimeZoneSuggestion.Builder builder2 = new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX);
{
PhoneTimeZoneSuggestion one = builder1.build();
PhoneTimeZoneSuggestion two = builder2.build();
@@ -45,7 +45,7 @@
}
PhoneTimeZoneSuggestion.Builder builder3 =
- new PhoneTimeZoneSuggestion.Builder(PHONE_ID + 1);
+ new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX + 1);
{
PhoneTimeZoneSuggestion one = builder1.build();
PhoneTimeZoneSuggestion three = builder3.build();
@@ -120,7 +120,7 @@
@Test(expected = RuntimeException.class)
public void testBuilderValidates_emptyZone_badMatchType() {
- PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(PHONE_ID);
+ PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX);
// No zone ID, so match type should be left unset.
builder.setMatchType(PhoneTimeZoneSuggestion.MATCH_TYPE_NETWORK_COUNTRY_AND_OFFSET);
builder.build();
@@ -128,7 +128,7 @@
@Test(expected = RuntimeException.class)
public void testBuilderValidates_zoneSet_badMatchType() {
- PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(PHONE_ID);
+ PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX);
builder.setZoneId("Europe/London");
builder.setQuality(PhoneTimeZoneSuggestion.QUALITY_SINGLE_ZONE);
builder.build();
@@ -136,7 +136,7 @@
@Test
public void testParcelable() {
- PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(PHONE_ID);
+ PhoneTimeZoneSuggestion.Builder builder = new PhoneTimeZoneSuggestion.Builder(SLOT_INDEX);
assertRoundTripParcelable(builder.build());
builder.setZoneId("Europe/London");
diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
index e95fc4a..a1e643f 100644
--- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
+++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java
@@ -101,11 +101,12 @@
private TimestampedValue<Long> mLastAutoSystemClockTimeSet;
/**
- * A mapping from phoneId to a time suggestion. We typically expect one or two mappings: devices
- * will have a small number of telephony devices and phoneIds are assumed to be stable.
+ * A mapping from slotIndex to a time suggestion. We typically expect one or two mappings:
+ * devices will have a small number of telephony devices and slotIndexs are assumed to be
+ * stable.
*/
@GuardedBy("this")
- private final ArrayMapWithHistory<Integer, PhoneTimeSuggestion> mSuggestionByPhoneId =
+ private final ArrayMapWithHistory<Integer, PhoneTimeSuggestion> mSuggestionBySlotIndex =
new ArrayMapWithHistory<>(KEEP_SUGGESTION_HISTORY_SIZE);
@GuardedBy("this")
@@ -155,7 +156,7 @@
}
// Perform validation / input filtering and record the validated suggestion against the
- // phoneId.
+ // slotIndex.
if (!validateAndStorePhoneSuggestion(timeSuggestion)) {
return;
}
@@ -202,7 +203,7 @@
ipw.println("Phone suggestion history:");
ipw.increaseIndent(); // level 2
- mSuggestionByPhoneId.dump(ipw);
+ mSuggestionBySlotIndex.dump(ipw);
ipw.decreaseIndent(); // level 2
ipw.println("Network suggestion history:");
@@ -223,8 +224,8 @@
return false;
}
- int phoneId = suggestion.getPhoneId();
- PhoneTimeSuggestion previousSuggestion = mSuggestionByPhoneId.get(phoneId);
+ int slotIndex = suggestion.getSlotIndex();
+ PhoneTimeSuggestion previousSuggestion = mSuggestionBySlotIndex.get(slotIndex);
if (previousSuggestion != null) {
// We can log / discard suggestions with obvious issues with the reference time clock.
if (previousSuggestion.getUtcTime() == null
@@ -249,7 +250,7 @@
}
// Store the latest suggestion.
- mSuggestionByPhoneId.put(phoneId, suggestion);
+ mSuggestionBySlotIndex.put(slotIndex, suggestion);
return true;
}
@@ -323,15 +324,15 @@
//
// [1] https://en.wikipedia.org/wiki/NITZ
//
- // Generally, when there are suggestions from multiple phoneIds they should usually
+ // Generally, when there are suggestions from multiple slotIndexs they should usually
// approximately agree. In cases where signals *are* inaccurate we don't want to vacillate
- // between signals from two phoneIds. However, it is known for NITZ signals to be incorrect
- // occasionally, which means we also don't want to stick forever with one phoneId. Without
- // cross-referencing across sources (e.g. the current device time, NTP), or doing some kind
- // of statistical analysis of consistency within and across phoneIds, we can't know which
- // suggestions are more correct.
+ // between signals from two slotIndexs. However, it is known for NITZ signals to be
+ // incorrect occasionally, which means we also don't want to stick forever with one
+ // slotIndex. Without cross-referencing across sources (e.g. the current device time, NTP),
+ // or doing some kind of statistical analysis of consistency within and across slotIndexs,
+ // we can't know which suggestions are more correct.
//
- // For simplicity, we try to value recency, then consistency of phoneId.
+ // For simplicity, we try to value recency, then consistency of slotIndex.
//
// The heuristic works as follows:
// Recency: The most recent suggestion from each phone is scored. The score is based on a
@@ -339,20 +340,20 @@
// bucket, thus applying a loose reference time ordering. The suggestion with the highest
// score is used.
// Consistency: If there a multiple suggestions with the same score, the suggestion with the
- // lowest phoneId is always taken.
+ // lowest slotIndex is always taken.
//
// In the trivial case with a single ID this will just mean that the latest received
// suggestion is used.
PhoneTimeSuggestion bestSuggestion = null;
int bestScore = PHONE_INVALID_SCORE;
- for (int i = 0; i < mSuggestionByPhoneId.size(); i++) {
- Integer phoneId = mSuggestionByPhoneId.keyAt(i);
- PhoneTimeSuggestion candidateSuggestion = mSuggestionByPhoneId.valueAt(i);
+ for (int i = 0; i < mSuggestionBySlotIndex.size(); i++) {
+ Integer slotIndex = mSuggestionBySlotIndex.keyAt(i);
+ PhoneTimeSuggestion candidateSuggestion = mSuggestionBySlotIndex.valueAt(i);
if (candidateSuggestion == null) {
// Unexpected - null suggestions should never be stored.
- Slog.w(LOG_TAG, "Latest suggestion unexpectedly null for phoneId."
- + " phoneId=" + phoneId);
+ Slog.w(LOG_TAG, "Latest suggestion unexpectedly null for slotIndex."
+ + " slotIndex=" + slotIndex);
continue;
} else if (candidateSuggestion.getUtcTime() == null) {
// Unexpected - we do not store empty suggestions.
@@ -372,10 +373,10 @@
bestSuggestion = candidateSuggestion;
bestScore = candidateScore;
} else if (bestScore == candidateScore) {
- // Tie! Use the suggestion with the lowest phoneId.
- int candidatePhoneId = candidateSuggestion.getPhoneId();
- int bestPhoneId = bestSuggestion.getPhoneId();
- if (candidatePhoneId < bestPhoneId) {
+ // Tie! Use the suggestion with the lowest slotIndex.
+ int candidateSlotIndex = candidateSuggestion.getSlotIndex();
+ int bestSlotIndex = bestSuggestion.getSlotIndex();
+ if (candidateSlotIndex < bestSlotIndex) {
bestSuggestion = candidateSuggestion;
}
}
@@ -396,7 +397,7 @@
}
// The score is based on the age since receipt. Suggestions are bucketed so two
- // suggestions in the same bucket from different phoneIds are scored the same.
+ // suggestions in the same bucket from different slotIndexs are scored the same.
long ageMillis = elapsedRealtimeMillis - utcTime.getReferenceTimeMillis();
// Turn the age into a discrete value: 0 <= bucketIndex < PHONE_BUCKET_COUNT.
@@ -560,8 +561,8 @@
*/
@VisibleForTesting
@Nullable
- public synchronized PhoneTimeSuggestion getLatestPhoneSuggestion(int phoneId) {
- return mSuggestionByPhoneId.get(phoneId);
+ public synchronized PhoneTimeSuggestion getLatestPhoneSuggestion(int slotIndex) {
+ return mSuggestionBySlotIndex.get(slotIndex);
}
/**
diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorStrategy.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorStrategy.java
index b4a4399..b0e0069 100644
--- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorStrategy.java
+++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorStrategy.java
@@ -172,12 +172,12 @@
private final LocalLog mTimeZoneChangesLog = new LocalLog(30, false /* useLocalTimestamps */);
/**
- * A mapping from phoneId to a phone time zone suggestion. We typically expect one or two
- * mappings: devices will have a small number of telephony devices and phoneIds are assumed to
+ * A mapping from slotIndex to a phone time zone suggestion. We typically expect one or two
+ * mappings: devices will have a small number of telephony devices and slotIndexs are assumed to
* be stable.
*/
@GuardedBy("this")
- private ArrayMapWithHistory<Integer, QualifiedPhoneTimeZoneSuggestion> mSuggestionByPhoneId =
+ private ArrayMapWithHistory<Integer, QualifiedPhoneTimeZoneSuggestion> mSuggestionBySlotIndex =
new ArrayMapWithHistory<>(KEEP_PHONE_SUGGESTION_HISTORY_SIZE);
/**
@@ -205,7 +205,7 @@
/**
* Suggests a time zone for the device, or withdraws a previous suggestion if
* {@link PhoneTimeZoneSuggestion#getZoneId()} is {@code null}. The suggestion is scoped to a
- * specific {@link PhoneTimeZoneSuggestion#getPhoneId() phone}.
+ * specific {@link PhoneTimeZoneSuggestion#getSlotIndex() phone}.
* See {@link PhoneTimeZoneSuggestion} for an explanation of the metadata associated with a
* suggestion. The strategy uses suggestions to decide whether to modify the device's time zone
* setting and what to set it to.
@@ -221,8 +221,8 @@
QualifiedPhoneTimeZoneSuggestion scoredSuggestion =
new QualifiedPhoneTimeZoneSuggestion(suggestion, score);
- // Store the suggestion against the correct phoneId.
- mSuggestionByPhoneId.put(suggestion.getPhoneId(), scoredSuggestion);
+ // Store the suggestion against the correct slotIndex.
+ mSuggestionBySlotIndex.put(suggestion.getSlotIndex(), scoredSuggestion);
// Now perform auto time zone detection. The new suggestion may be used to modify the time
// zone setting.
@@ -384,8 +384,9 @@
// and find the best. Note that we deliberately do not look at age: the caller can
// rate-limit so age is not a strong indicator of confidence. Instead, the callers are
// expected to withdraw suggestions they no longer have confidence in.
- for (int i = 0; i < mSuggestionByPhoneId.size(); i++) {
- QualifiedPhoneTimeZoneSuggestion candidateSuggestion = mSuggestionByPhoneId.valueAt(i);
+ for (int i = 0; i < mSuggestionBySlotIndex.size(); i++) {
+ QualifiedPhoneTimeZoneSuggestion candidateSuggestion =
+ mSuggestionBySlotIndex.valueAt(i);
if (candidateSuggestion == null) {
// Unexpected
continue;
@@ -396,10 +397,10 @@
} else if (candidateSuggestion.score > bestSuggestion.score) {
bestSuggestion = candidateSuggestion;
} else if (candidateSuggestion.score == bestSuggestion.score) {
- // Tie! Use the suggestion with the lowest phoneId.
- int candidatePhoneId = candidateSuggestion.suggestion.getPhoneId();
- int bestPhoneId = bestSuggestion.suggestion.getPhoneId();
- if (candidatePhoneId < bestPhoneId) {
+ // Tie! Use the suggestion with the lowest slotIndex.
+ int candidateSlotIndex = candidateSuggestion.suggestion.getSlotIndex();
+ int bestSlotIndex = bestSuggestion.suggestion.getSlotIndex();
+ if (candidateSlotIndex < bestSlotIndex) {
bestSuggestion = candidateSuggestion;
}
}
@@ -455,7 +456,7 @@
ipw.println("Phone suggestion history:");
ipw.increaseIndent(); // level 2
- mSuggestionByPhoneId.dump(ipw);
+ mSuggestionBySlotIndex.dump(ipw);
ipw.decreaseIndent(); // level 2
ipw.decreaseIndent(); // level 1
ipw.flush();
@@ -465,8 +466,8 @@
* A method used to inspect strategy state during tests. Not intended for general use.
*/
@VisibleForTesting
- public synchronized QualifiedPhoneTimeZoneSuggestion getLatestPhoneSuggestion(int phoneId) {
- return mSuggestionByPhoneId.get(phoneId);
+ public synchronized QualifiedPhoneTimeZoneSuggestion getLatestPhoneSuggestion(int slotIndex) {
+ return mSuggestionBySlotIndex.get(slotIndex);
}
/**