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

Commit 82708642 authored by Hyunho's avatar Hyunho
Browse files

Create a SipDetails file and set it as a variable in ImsRegistrationAttributes.

In order to more quickly debug issues during the registration, the caller should have access to specific SIP signaling information.
To access SIP information, create a class including SIP information and set it as a variable in the class related to IMS registration.

Bug: b/238192631
Test: atest CtsTelephonyTestCases:ImsRegistrationAttributesTest ImsServiceTest
Test: atest ImsRegistrationTests
Change-Id: Idbcd9ac2d5113a64c1d0450e4518780c0a20ed6b
parent 331e4ee4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -45391,6 +45391,7 @@ package android.telephony.ims {
    method public int describeContents();
    method public int getAttributeFlags();
    method @NonNull public java.util.Set<java.lang.String> getFeatureTags();
    method @Nullable public android.telephony.ims.SipDetails getSipDetails();
    method public int getTransportType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field public static final int ATTR_EPDG_OVER_CELL_INTERNET = 1; // 0x1
@@ -45451,6 +45452,22 @@ package android.telephony.ims {
    method public void onUnregistered(@NonNull android.telephony.ims.ImsReasonInfo);
  }
  public final class SipDetails implements android.os.Parcelable {
    method public int describeContents();
    method public int getCSeq();
    method @Nullable public String getCallId();
    method public int getMethod();
    method public int getReasonHeaderCause();
    method @NonNull public String getReasonHeaderText();
    method public int getResponseCode();
    method @NonNull public String getResponsePhrase();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.SipDetails> CREATOR;
    field public static final int METHOD_PUBLISH = 2; // 0x2
    field public static final int METHOD_REGISTER = 1; // 0x1
    field public static final int METHOD_SUBSCRIBE = 3; // 0x3
  }
}
package android.telephony.ims.feature {
+7 −0
Original line number Diff line number Diff line
@@ -15106,6 +15106,7 @@ package android.telephony.ims {
    ctor public ImsRegistrationAttributes.Builder(int);
    method @NonNull public android.telephony.ims.ImsRegistrationAttributes build();
    method @NonNull public android.telephony.ims.ImsRegistrationAttributes.Builder setFeatureTags(@NonNull java.util.Set<java.lang.String>);
    method @NonNull public android.telephony.ims.ImsRegistrationAttributes.Builder setSipDetails(@NonNull android.telephony.ims.SipDetails);
  }
  public class ImsService extends android.app.Service {
@@ -15563,6 +15564,10 @@ package android.telephony.ims {
    field public static final int SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2; // 0x2
  }
  public static class RegistrationManager.RegistrationCallback {
    method public void onUnregistered(@NonNull android.telephony.ims.ImsReasonInfo, @NonNull android.telephony.ims.SipDetails);
  }
  public final class RtpHeaderExtension implements android.os.Parcelable {
    ctor public RtpHeaderExtension(@IntRange(from=1, to=14) int, @NonNull byte[]);
    method public int describeContents();
@@ -15964,6 +15969,8 @@ package android.telephony.ims.stub {
    ctor public ImsRegistrationImplBase(@NonNull java.util.concurrent.Executor);
    method public final void onDeregistered(android.telephony.ims.ImsReasonInfo);
    method public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, int, int);
    method public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, @NonNull android.telephony.ims.SipDetails);
    method public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, int, int, @NonNull android.telephony.ims.SipDetails);
    method public final void onRegistered(int);
    method public final void onRegistered(@NonNull android.telephony.ims.ImsRegistrationAttributes);
    method public final void onRegistering(int);
+53 −5
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public final class ImsRegistrationAttributes implements Parcelable {
    public static final class Builder {
        private final int mRegistrationTech;
        private Set<String> mFeatureTags = Collections.emptySet();
        private @Nullable SipDetails mSipDetails;

        /**
         * Build a new instance of {@link ImsRegistrationAttributes}.
@@ -99,6 +100,15 @@ public final class ImsRegistrationAttributes implements Parcelable {
            return this;
        }

        /**
         * Set the SIP information.
         * @param details The SIP information related to this IMS registration.
         */
        public @NonNull Builder setSipDetails(@NonNull SipDetails details) {
            mSipDetails = details;
            return this;
        }

        /**
         * @return A new instance created from this builder.
         */
@@ -106,7 +116,7 @@ public final class ImsRegistrationAttributes implements Parcelable {
            return new ImsRegistrationAttributes(mRegistrationTech,
                    RegistrationManager.getAccessType(mRegistrationTech),
                    getAttributeFlags(mRegistrationTech),
                    mFeatureTags);
                    mFeatureTags, mSipDetails);
        }

        /**
@@ -125,6 +135,28 @@ public final class ImsRegistrationAttributes implements Parcelable {
    private final int mTransportType;
    private final int mImsAttributeFlags;
    private final ArrayList<String> mFeatureTags;
    private final @Nullable SipDetails mSipDetails;
    /**
     * Create a new {@link ImsRegistrationAttributes} instance.
     * This is for backward compatibility.
     *
     * @param registrationTech The technology that IMS has been registered on.
     * @param transportType The transport type that IMS has been registered on.
     * @param imsAttributeFlags The attributes associated with the IMS registration.
     * @param featureTags The feature tags included in the IMS registration.
     * @hide
     */
    public ImsRegistrationAttributes(
            @ImsRegistrationImplBase.ImsRegistrationTech int registrationTech,
            @AccessNetworkConstants.TransportType int transportType,
            @ImsAttributeFlag int imsAttributeFlags,
            @Nullable Set<String> featureTags) {
        mRegistrationTech = registrationTech;
        mTransportType = transportType;
        mImsAttributeFlags = imsAttributeFlags;
        mFeatureTags = new ArrayList<>(featureTags);
        mSipDetails = null;
    }

    /**
     * Create a new {@link ImsRegistrationAttributes} instance.
@@ -133,6 +165,7 @@ public final class ImsRegistrationAttributes implements Parcelable {
     * @param transportType The transport type that IMS has been registered on.
     * @param imsAttributeFlags The attributes associated with the IMS registration.
     * @param featureTags The feature tags included in the IMS registration.
     * @param details The SIP information associated with the IMS registration.
     * @see Builder
     * @hide
     */
@@ -140,11 +173,13 @@ public final class ImsRegistrationAttributes implements Parcelable {
            @ImsRegistrationImplBase.ImsRegistrationTech int registrationTech,
            @AccessNetworkConstants.TransportType int transportType,
            @ImsAttributeFlag int imsAttributeFlags,
            @Nullable Set<String> featureTags) {
            @Nullable Set<String> featureTags,
            @Nullable SipDetails details) {
        mRegistrationTech = registrationTech;
        mTransportType = transportType;
        mImsAttributeFlags = imsAttributeFlags;
        mFeatureTags = new ArrayList<>(featureTags);
        mSipDetails = details;
    }

    /**@hide*/
@@ -154,6 +189,8 @@ public final class ImsRegistrationAttributes implements Parcelable {
        mImsAttributeFlags = source.readInt();
        mFeatureTags = new ArrayList<>();
        source.readList(mFeatureTags, null /*classloader*/, java.lang.String.class);
        mSipDetails = source.readParcelable(null /*loader*/,
                android.telephony.ims.SipDetails.class);
    }

    /**
@@ -202,6 +239,13 @@ public final class ImsRegistrationAttributes implements Parcelable {
        return new ArraySet<>(mFeatureTags);
    }

    /**
     * @return The SIP information associated with the IMS registration.
     */
    public @Nullable SipDetails getSipDetails() {
        return mSipDetails;
    }

    @Override
    public int describeContents() {
        return 0;
@@ -213,6 +257,7 @@ public final class ImsRegistrationAttributes implements Parcelable {
        dest.writeInt(mTransportType);
        dest.writeInt(mImsAttributeFlags);
        dest.writeList(mFeatureTags);
        dest.writeParcelable(mSipDetails, flags);
    }

    public static final @NonNull Creator<ImsRegistrationAttributes> CREATOR =
@@ -236,17 +281,20 @@ public final class ImsRegistrationAttributes implements Parcelable {
        return mRegistrationTech == that.mRegistrationTech
                && mTransportType == that.mTransportType
                && mImsAttributeFlags == that.mImsAttributeFlags
                && Objects.equals(mFeatureTags, that.mFeatureTags);
                && Objects.equals(mFeatureTags, that.mFeatureTags)
                && Objects.equals(mSipDetails, that.mSipDetails);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mRegistrationTech, mTransportType, mImsAttributeFlags, mFeatureTags);
        return Objects.hash(mRegistrationTech, mTransportType, mImsAttributeFlags, mFeatureTags,
                mSipDetails);
    }

    @Override
    public String toString() {
        return "ImsRegistrationAttributes { transportType= " + mTransportType + ", attributeFlags="
                + mImsAttributeFlags + ", featureTags=[" + mFeatureTags + "]}";
                + mImsAttributeFlags + ", featureTags=[" + mFeatureTags + "]"
                + ",SipDetails=" + mSipDetails + "}";
    }
}
+30 −0
Original line number Diff line number Diff line
@@ -216,6 +216,23 @@ public interface RegistrationManager {
                }
            }

            @Override
            public void onDeregisteredWithDetails(ImsReasonInfo info,
                    @SuggestedAction int suggestedAction,
                    @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech,
                    @NonNull SipDetails details) {
                if (mLocalCallback == null) return;

                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    mExecutor.execute(() -> mLocalCallback.onUnregistered(info, suggestedAction,
                            imsRadioTech));
                    mExecutor.execute(() -> mLocalCallback.onUnregistered(info, details));
                } finally {
                    restoreCallingIdentity(callingIdentity);
                }
            }

            @Override
            public void onTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) {
                if (mLocalCallback == null) return;
@@ -313,6 +330,19 @@ public interface RegistrationManager {
            onUnregistered(info);
        }

        /**
         * Notifies the framework when the IMS Provider is unregistered from the IMS network.
         *
         * @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
         * @param details the {@link SipDetails} related to disconnected Ims registration.
         *
         * @hide
         */
        @SystemApi
        public void onUnregistered(@NonNull ImsReasonInfo info,
                @NonNull SipDetails details) {
        }

        /**
         * A failure has occurred when trying to handover registration to another technology type.
         *
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims;

parcelable SipDetails;
Loading