From b6518929e616f3a0e91f5a50e0f0931798195c40 Mon Sep 17 00:00:00 2001 From: Jinyoung Jeong Date: Thu, 14 Oct 2021 09:23:33 +0000 Subject: [PATCH 1/2] IMS RCS API Improvements-DelegateRegistrationState Bug: b/197892699, b/202202874, b/203405794 Test: atest CtsTelephonyTestCases:SipDelegateManagerTest Change-Id: Icfa7fd363ad4f9ad0131d78602c264742cd1785f Merged-In: Icfa7fd363ad4f9ad0131d78602c264742cd1785f --- core/api/system-current.txt | 2 ++ .../ims/DelegateRegistrationState.java | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 91b8786cc615a..ad6f1a0e4b964 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -12884,6 +12884,7 @@ package android.telephony.ims { method @NonNull public java.util.Set getDeregisteredFeatureTags(); method @NonNull public java.util.Set getDeregisteringFeatureTags(); method @NonNull public java.util.Set getRegisteredFeatureTags(); + method @NonNull public java.util.Set getRegisteringFeatureTags(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; field public static final int DEREGISTERED_REASON_NOT_PROVISIONED = 1; // 0x1 @@ -12901,6 +12902,7 @@ package android.telephony.ims { method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addDeregisteringFeatureTag(@NonNull String, int); method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addRegisteredFeatureTag(@NonNull String); method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addRegisteredFeatureTags(@NonNull java.util.Set); + method @NonNull public android.telephony.ims.DelegateRegistrationState.Builder addRegisteringFeatureTags(@NonNull java.util.Set); method @NonNull public android.telephony.ims.DelegateRegistrationState build(); } diff --git a/telephony/java/android/telephony/ims/DelegateRegistrationState.java b/telephony/java/android/telephony/ims/DelegateRegistrationState.java index c00c741a0d60d..1b1040430fd27 100644 --- a/telephony/java/android/telephony/ims/DelegateRegistrationState.java +++ b/telephony/java/android/telephony/ims/DelegateRegistrationState.java @@ -117,6 +117,7 @@ public final class DelegateRegistrationState implements Parcelable { }) public @interface DeregisteringReason {} + private ArraySet mRegisteringTags = new ArraySet<>(); private ArraySet mRegisteredTags = new ArraySet<>(); private final ArraySet mDeregisteringTags = new ArraySet<>(); private final ArraySet mDeregisteredTags = new ArraySet<>(); @@ -133,6 +134,20 @@ public final class DelegateRegistrationState implements Parcelable { mState = new DelegateRegistrationState(); } + /** + * Add the set of feature tags that are associated with this SipDelegate and + * the IMS stack is actively trying to register on the carrier network. + * + * The feature tags will either move to the registered or deregistered state + * depending on the result of the registration. + * @param featureTags The IMS media feature tags that are in the progress of registering. + * @return The in-progress Builder instance for RegistrationState. ] + */ + public @NonNull Builder addRegisteringFeatureTags(@NonNull Set featureTags) { + mState.mRegisteringTags.addAll(featureTags); + return this; + } + /** * Add a feature tag that is currently included in the current network IMS Registration. * @param featureTag The IMS media feature tag included in the current IMS registration. @@ -209,6 +224,17 @@ public final class DelegateRegistrationState implements Parcelable { mRegisteredTags = (ArraySet) source.readArraySet(null); readStateFromParcel(source, mDeregisteringTags); readStateFromParcel(source, mDeregisteredTags); + mRegisteringTags = (ArraySet) source.readArraySet(null); + } + + /** + * Get the feature tags that are associated with this SipDelegate that the IMS stack is actively + * trying to register on the carrier network. + * @return A Set of feature tags associated with this SipDelegate that the IMS service is + * currently trying to register on the carrier network. + */ + public @NonNull Set getRegisteringFeatureTags() { + return new ArraySet<>(mRegisteringTags); } /** @@ -286,6 +312,7 @@ public final class DelegateRegistrationState implements Parcelable { dest.writeArraySet(mRegisteredTags); writeStateToParcel(dest, mDeregisteringTags); writeStateToParcel(dest, mDeregisteredTags); + dest.writeArraySet(mRegisteringTags); } private void writeStateToParcel(Parcel dest, Set state) { @@ -311,19 +338,22 @@ public final class DelegateRegistrationState implements Parcelable { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DelegateRegistrationState that = (DelegateRegistrationState) o; - return mRegisteredTags.equals(that.mRegisteredTags) + return mRegisteringTags.equals(that.mRegisteringTags) + && mRegisteredTags.equals(that.mRegisteredTags) && mDeregisteringTags.equals(that.mDeregisteringTags) && mDeregisteredTags.equals(that.mDeregisteredTags); } @Override public int hashCode() { - return Objects.hash(mRegisteredTags, mDeregisteringTags, mDeregisteredTags); + return Objects.hash(mRegisteringTags, mRegisteredTags, + mDeregisteringTags, mDeregisteredTags); } @Override public String toString() { return "DelegateRegistrationState{ registered={" + mRegisteredTags + + "}, registering={" + mRegisteringTags + "}, deregistering={" + mDeregisteringTags + "}, deregistered={" + mDeregisteredTags + "}}"; } From 0b1a783da652bb48a46c9dd61c6b2304a6f3c381 Mon Sep 17 00:00:00 2001 From: Jinyoung Jeong Date: Tue, 23 Nov 2021 09:58:14 +0000 Subject: [PATCH 2/2] DelegateRegistrationState Improvement adding new states for DelegateRegistrationState: - DEREGISTERING_REASON_LOSING_PDN - DEREGISTERING_REASON_UNSPECIFIED Bug: b/201522903, b/206557578 Test: atest CtsTelephonyTestCases:SipDelegateManagerTest Change-Id: I3675c10a6dba55a49174509796c53b07b929c14f Merged-In: I3675c10a6dba55a49174509796c53b07b929c14f --- core/api/system-current.txt | 2 ++ .../ims/DelegateRegistrationState.java | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index ad6f1a0e4b964..cd1fef9d18ba7 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -12892,8 +12892,10 @@ package android.telephony.ims { field public static final int DEREGISTERED_REASON_UNKNOWN = 0; // 0x0 field public static final int DEREGISTERING_REASON_DESTROY_PENDING = 6; // 0x6 field public static final int DEREGISTERING_REASON_FEATURE_TAGS_CHANGING = 5; // 0x5 + field public static final int DEREGISTERING_REASON_LOSING_PDN = 7; // 0x7 field public static final int DEREGISTERING_REASON_PDN_CHANGE = 3; // 0x3 field public static final int DEREGISTERING_REASON_PROVISIONING_CHANGE = 4; // 0x4 + field public static final int DEREGISTERING_REASON_UNSPECIFIED = 8; // 0x8 } public static final class DelegateRegistrationState.Builder { diff --git a/telephony/java/android/telephony/ims/DelegateRegistrationState.java b/telephony/java/android/telephony/ims/DelegateRegistrationState.java index 1b1040430fd27..c2c9497cef3db 100644 --- a/telephony/java/android/telephony/ims/DelegateRegistrationState.java +++ b/telephony/java/android/telephony/ims/DelegateRegistrationState.java @@ -97,7 +97,24 @@ public final class DelegateRegistrationState implements Parcelable { */ public static final int DEREGISTERING_REASON_DESTROY_PENDING = 6; - /** @hide */ + /** + * This feature tag is deregistering because the PDN that the IMS registration is on + * is being torn down. + *

+ * All open SIP Dialogs associated with this feature tag must be closed + * using {@link SipDelegateConnection#cleanupSession(String)} before this operation can proceed. + */ + public static final int DEREGISTERING_REASON_LOSING_PDN = 7; + + /** + * This feature tag is deregistering because of an unspecified reason. + *

+ * All open SIP Dialogs associated with this feature tag must be closed + * using {@link SipDelegateConnection#cleanupSession(String)} before this operation can proceed. + */ + public static final int DEREGISTERING_REASON_UNSPECIFIED = 8; + +/** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = "DEREGISTERED_REASON_", value = { DEREGISTERED_REASON_UNKNOWN, @@ -113,7 +130,9 @@ public final class DelegateRegistrationState implements Parcelable { DEREGISTERING_REASON_PDN_CHANGE, DEREGISTERING_REASON_PROVISIONING_CHANGE, DEREGISTERING_REASON_FEATURE_TAGS_CHANGING, - DEREGISTERING_REASON_DESTROY_PENDING + DEREGISTERING_REASON_DESTROY_PENDING, + DEREGISTERING_REASON_LOSING_PDN, + DEREGISTERING_REASON_UNSPECIFIED }) public @interface DeregisteringReason {}