Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 913b325c authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Rename closeDialog to cleanupSession

The current name of SipDelegate[Connection]#closeDialog assumes
there will only be one SIP dialog per SIP session and does not
adequately cover the case where a SIP INVITE has forked and
generated multiple dialogs for the same call-id.

Instead, rename closeDialog to cleanupSession, which is more
accurate and should be called after all SIP dialogs associated
with the SIP session represented by the call-id have closed.

Bug: 184858064
Test: atest CtsTelephonyTestCases
Change-Id: I438dbc45dffbaf33e0cf36ddc61008fd8c18209c
parent a997cf44
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -11884,7 +11884,8 @@ package android.telephony.ims {
  }
  public interface SipDelegateConnection {
    method public void closeDialog(@NonNull String);
    method public default void cleanupSession(@NonNull String);
    method @Deprecated public default void closeDialog(@NonNull String);
    method public void notifyMessageReceiveError(@NonNull String, int);
    method public void notifyMessageReceived(@NonNull String);
    method public void sendMessage(@NonNull android.telephony.ims.SipMessage, long);
@@ -12333,7 +12334,8 @@ package android.telephony.ims.stub {
  }
  public interface SipDelegate {
    method public void closeDialog(@NonNull String);
    method public default void cleanupSession(@NonNull String);
    method @Deprecated public default void closeDialog(@NonNull String);
    method public void notifyMessageReceiveError(@NonNull String, int);
    method public void notifyMessageReceived(@NonNull String);
    method public void sendMessage(@NonNull android.telephony.ims.SipMessage, long);
+4 −4
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public final class DelegateRegistrationState implements Parcelable {
     * This feature tag is being deregistered because the PDN that the IMS registration is on is
     *changing.
     * All open SIP dialogs need to be closed before the PDN change can proceed using
     * {@link SipDelegateConnection#closeDialog(String)}.
     * {@link SipDelegateConnection#cleanupSession(String)}.
     */
    public static final int DEREGISTERING_REASON_PDN_CHANGE = 3;

@@ -74,7 +74,7 @@ public final class DelegateRegistrationState implements Parcelable {
     * a user triggered hange, such as data being enabled/disabled.
     * <p>
     * All open SIP dialogs associated with the new deprovisioned feature tag need to be closed
     * using {@link SipDelegateConnection#closeDialog(String)} before the IMS registration
     * using {@link SipDelegateConnection#cleanupSession(String)} before the IMS registration
     * modification can proceed.
     */
    public static final int DEREGISTERING_REASON_PROVISIONING_CHANGE = 4;
@@ -84,7 +84,7 @@ public final class DelegateRegistrationState implements Parcelable {
     * needs to change its supported feature set.
     * <p>
     * All open SIP Dialogs associated with this feature tag must be  closed
     * using {@link SipDelegateConnection#closeDialog(String)} before this operation can proceed.
     * using {@link SipDelegateConnection#cleanupSession(String)} before this operation can proceed.
     */
    public static final int DEREGISTERING_REASON_FEATURE_TAGS_CHANGING = 5;

@@ -93,7 +93,7 @@ public final class DelegateRegistrationState implements Parcelable {
     * destroyed.
     * <p>
     * All open SIP Dialogs associated with this feature tag must be closed
     * using {@link SipDelegateConnection#closeDialog(String)} before this operation can proceed.
     * using {@link SipDelegateConnection#cleanupSession(String)} before this operation can proceed.
     */
    public static final int DEREGISTERING_REASON_DESTROY_PENDING = 6;

+23 −1
Original line number Diff line number Diff line
@@ -74,8 +74,30 @@ public interface SipDelegateConnection {
     * closed.
     * @param callId The call-ID header value associated with the ongoing SIP Dialog that is
     *         closing.
     * @deprecated closeDialog does not capture INVITE forking. Use {@link #cleanupSession} instead.
     */
    void closeDialog(@NonNull String callId);
    @Deprecated
    default void closeDialog(@NonNull String callId) {
        cleanupSession(callId);
    }

    /**
     * The SIP session associated with the provided Call-ID is being closed and routing resources
     * associated with the session are free to be released. Each SIP session may contain multiple
     * dialogs due to SIP INVITE forking, so this method must be called after all SIP dialogs
     * associated with the session has closed.
     * <p>
     * Calling this method is also mandatory for situations where the framework IMS stack is waiting
     * for pending SIP sessions to be closed before it can perform a handover or apply a
     * provisioning change. See {@link DelegateRegistrationState} for more information about
     * the scenarios where this can occur.
     * <p>
     * This method will need to be called for each SIP session managed by this application when it
     * is closed.
     * @param callId The call-ID header value associated with the ongoing SIP Dialog that is
     *         closing.
     */
    default void cleanupSession(@NonNull String callId) { }

    /**
     * Notify the SIP delegate that the SIP message has been received from
+1 −1
Original line number Diff line number Diff line
@@ -26,5 +26,5 @@ oneway interface ISipDelegate {
    void sendMessage(in SipMessage sipMessage, long configVersion);
    void notifyMessageReceived(in String viaTransactionId);
    void notifyMessageReceiveError(in String viaTransactionId, int reason);
    void closeDialog(in String callId);
    void cleanupSession(in String callId);
}
+2 −2
Original line number Diff line number Diff line
@@ -79,11 +79,11 @@ public class SipDelegateAidlWrapper implements DelegateStateCallback, DelegateMe
        }

        @Override
        public void closeDialog(String callId)  {
        public void cleanupSession(String callId)  {
            SipDelegate d = mDelegate;
            final long token = Binder.clearCallingIdentity();
            try {
                mExecutor.execute(() -> d.closeDialog(callId));
                mExecutor.execute(() -> d.cleanupSession(callId));
            } finally {
                Binder.restoreCallingIdentity(token);
            }
Loading