From d8da3387c44c1b702b399f46ff60d4b35be7992d Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Fri, 31 Jan 2020 09:39:52 +0000 Subject: Rename phoneId to slotIndex Rename phoneId to slotIndex. Some of the classes are being put in an API surface and phoneId is an internal concept. slotIndex is its replacement and should be identical. Bug: 148403082 Test: treehugger build only Change-Id: Iecbf347c9d13877f2e3f74b6daa22661bade257a --- .../app/timedetector/PhoneTimeSuggestion.java | 32 +++++++++---------- .../timezonedetector/PhoneTimeZoneSuggestion.java | 36 +++++++++++----------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'core/java') diff --git a/core/java/android/app/timedetector/PhoneTimeSuggestion.java b/core/java/android/app/timedetector/PhoneTimeSuggestion.java index bd649f88f40a..eab88383fa1d 100644 --- a/core/java/android/app/timedetector/PhoneTimeSuggestion.java +++ b/core/java/android/app/timedetector/PhoneTimeSuggestion.java @@ -57,19 +57,19 @@ public final class PhoneTimeSuggestion implements Parcelable { } }; - private final int mPhoneId; + private final int mSlotIndex; @Nullable private final TimestampedValue mUtcTime; @Nullable private ArrayList 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 @@ public final class PhoneTimeSuggestion implements Parcelable { @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 @@ public final class PhoneTimeSuggestion implements Parcelable { 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 @@ public final class PhoneTimeSuggestion implements Parcelable { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) public static final class Builder { - private final int mPhoneId; + private final int mSlotIndex; @Nullable private TimestampedValue mUtcTime; @Nullable private List 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 d71ffcb9f772..ebaf951130ca 100644 --- a/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java +++ b/core/java/android/app/timezonedetector/PhoneTimeZoneSuggestion.java @@ -66,12 +66,12 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { /** * 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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { * 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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { private List mDebugInfo; private PhoneTimeZoneSuggestion(Builder builder) { - mPhoneId = builder.mPhoneId; + mSlotIndex = builder.mSlotIndex; mZoneId = builder.mZoneId; mMatchType = builder.mMatchType; mQuality = builder.mQuality; @@ -175,8 +175,8 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { @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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { @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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { } /** - * 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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { 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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { @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 @@ public final class PhoneTimeZoneSuggestion implements Parcelable { */ @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 mDebugInfo; - public Builder(int phoneId) { - mPhoneId = phoneId; + public Builder(int slotIndex) { + mSlotIndex = slotIndex; } /** -- cgit v1.2.3