diff options
author | 2018-12-10 18:38:11 -0800 | |
---|---|---|
committer | 2018-12-17 15:27:48 -0800 | |
commit | 7ddcfd698e838efa5e7bd65093dfca05d74b1a5c (patch) | |
tree | 3fe2840e01fc34b92924340aaa14a5cdac4e1fc9 | |
parent | c47570d5d0debbb6cbc51ee0e29381b83fd357bd (diff) |
Enable CTS testing for phone account suggestions
Add TestApi annotation on PhoneAccountSuggestionService and add sensible
equals and hashCode methods to PhoneAccountSuggestions
Bug: 111455117
Test: CTS
Change-Id: I112e350cc637cb086252c53be5e08596e743537d
-rw-r--r-- | api/test-current.txt | 8 | ||||
-rw-r--r-- | telecomm/java/android/telecom/PhoneAccountSuggestion.java | 16 | ||||
-rw-r--r-- | telecomm/java/android/telecom/PhoneAccountSuggestionService.java | 2 |
3 files changed, 26 insertions, 0 deletions
diff --git a/api/test-current.txt b/api/test-current.txt index b5b128a94727..dfa1c1652bff 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -967,6 +967,14 @@ package android.telecom { ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean); } + public class PhoneAccountSuggestionService extends android.app.Service { + ctor public PhoneAccountSuggestionService(); + method public void onAccountSuggestionRequest(java.lang.String); + method public android.os.IBinder onBind(android.content.Intent); + method public final void suggestPhoneAccounts(java.lang.String, java.util.List<android.telecom.PhoneAccountSuggestion>); + field public static final java.lang.String SERVICE_INTERFACE = "android.telecom.PhoneAccountSuggestionService"; + } + } package android.telephony { diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestion.java b/telecomm/java/android/telecom/PhoneAccountSuggestion.java index 4e6a178c8170..b401bcf0f876 100644 --- a/telecomm/java/android/telecom/PhoneAccountSuggestion.java +++ b/telecomm/java/android/telecom/PhoneAccountSuggestion.java @@ -24,6 +24,7 @@ import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Objects; public final class PhoneAccountSuggestion implements Parcelable { @@ -132,4 +133,19 @@ public final class PhoneAccountSuggestion implements Parcelable { dest.writeInt(mReason); dest.writeByte((byte) (mShouldAutoSelect ? 1 : 0)); } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PhoneAccountSuggestion that = (PhoneAccountSuggestion) o; + return mReason == that.mReason + && mShouldAutoSelect == that.mShouldAutoSelect + && Objects.equals(mHandle, that.mHandle); + } + + @Override + public int hashCode() { + return Objects.hash(mHandle, mReason, mShouldAutoSelect); + } } diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestionService.java b/telecomm/java/android/telecom/PhoneAccountSuggestionService.java index 8a91b9e9ee81..ba3822cb9951 100644 --- a/telecomm/java/android/telecom/PhoneAccountSuggestionService.java +++ b/telecomm/java/android/telecom/PhoneAccountSuggestionService.java @@ -19,6 +19,7 @@ package android.telecom; import android.annotation.NonNull; import android.annotation.SdkConstant; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.app.Service; import android.content.Intent; import android.os.IBinder; @@ -56,6 +57,7 @@ import java.util.Map; * @hide */ @SystemApi +@TestApi public class PhoneAccountSuggestionService extends Service { /** * The {@link Intent} that must be declared in the {@code intent-filter} element of the |