diff options
| author | 2019-04-16 14:16:33 +0000 | |
|---|---|---|
| committer | 2019-04-16 14:16:33 +0000 | |
| commit | b1145bd87ed3eab56b3de81f267ff4bf24f20823 (patch) | |
| tree | a4704fa5128a1f74de552ae0500069683baa3554 | |
| parent | 0fd71745d60f92f8ebda3bdcba135e387716cbd2 (diff) | |
| parent | c7d1078468d4f805c86fc8711232b7e73761a7cc (diff) | |
Merge "Add PhoneAccountHandle method to check if 2 accts are from same CS." into qt-dev
| -rw-r--r-- | telecomm/java/android/telecom/PhoneAccountHandle.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/PhoneAccountHandle.java b/telecomm/java/android/telecom/PhoneAccountHandle.java index 71a28b575394..eb568e04ebf3 100644 --- a/telecomm/java/android/telecom/PhoneAccountHandle.java +++ b/telecomm/java/android/telecom/PhoneAccountHandle.java @@ -17,6 +17,7 @@ package android.telecom; import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.os.Build; @@ -174,4 +175,21 @@ public final class PhoneAccountHandle implements Parcelable { in.readString(), UserHandle.CREATOR.createFromParcel(in)); } + + /** + * Determines if two {@link PhoneAccountHandle}s are from the same package. + * + * @param a Phone account handle to check for same {@link ConnectionService} package. + * @param b Other phone account handle to check for same {@link ConnectionService} package. + * @return {@code true} if the two {@link PhoneAccountHandle}s passed in belong to the same + * {@link ConnectionService} / package, {@code false} otherwise. Note: {@code null} phone + * account handles are considered equivalent to other {@code null} phone account handles. + * @hide + */ + public static boolean areFromSamePackage(@Nullable PhoneAccountHandle a, + @Nullable PhoneAccountHandle b) { + String aPackageName = a != null ? a.getComponentName().getPackageName() : null; + String bPackageName = b != null ? b.getComponentName().getPackageName() : null; + return Objects.equals(aPackageName, bPackageName); + } } |