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

Commit 370345d9 authored by Yongnam Cha's avatar Yongnam Cha Committed by Android (Google) Code Review
Browse files

Merge "Add the onDeregistered with a throttling time to ImsRegistrationImplBase" into main

parents 5d6037d2 04410675
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18103,6 +18103,7 @@ package android.telephony.ims {
    field public static final int SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK = 1; // 0x1
    field public static final int SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.add_rat_related_suggested_action_to_ims_registration") public static final int SUGGESTED_ACTION_TRIGGER_RAT_BLOCK = 3; // 0x3
    field @FlaggedApi("com.android.internal.telephony.flags.support_throttle_time_for_deregistration") public static final int SUGGESTED_ACTION_TRIGGER_THROTTLE_TIME = 5; // 0x5
  }
  public static class RegistrationManager.RegistrationCallback {
@@ -18574,6 +18575,7 @@ package android.telephony.ims.stub {
    method public final void onDeregistered(android.telephony.ims.ImsReasonInfo);
    method public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, int, int);
    method @FlaggedApi("com.android.internal.telephony.flags.emergency_registration_state") public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, int, @NonNull android.telephony.ims.ImsRegistrationAttributes);
    method @FlaggedApi("com.android.internal.telephony.flags.support_throttle_time_for_deregistration") public final void onDeregistered(@Nullable android.telephony.ims.ImsReasonInfo, int, @NonNull android.telephony.ims.ImsRegistrationAttributes, 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);
+48 −1
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ public interface RegistrationManager {
                SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK,
                SUGGESTED_ACTION_TRIGGER_PLMN_BLOCK_WITH_TIMEOUT,
                SUGGESTED_ACTION_TRIGGER_RAT_BLOCK,
                SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCKS
                SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCKS,
                SUGGESTED_ACTION_TRIGGER_THROTTLE_TIME
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SuggestedAction {}
@@ -136,6 +137,16 @@ public interface RegistrationManager {
    @FlaggedApi(Flags.FLAG_ADD_RAT_RELATED_SUGGESTED_ACTION_TO_IMS_REGISTRATION)
    int SUGGESTED_ACTION_TRIGGER_CLEAR_RAT_BLOCKS = 4;

    /**
     * Indicates whether to apply the registration throttling time.
     * If this action is suggested, the value provided in should be used to delay subsequent
     * IMS registration attempts.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SUPPORT_THROTTLE_TIME_FOR_DEREGISTRATION)
    int SUGGESTED_ACTION_TRIGGER_THROTTLE_TIME = 5;

    /**@hide*/
    // Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
    // and WWAN are more accurate constants.
@@ -242,6 +253,22 @@ public interface RegistrationManager {
                }
            }

            @Override
            public void onDeregisteredWithTime(ImsReasonInfo info,
                    @SuggestedAction int suggestedAction,
                    @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech,
                    int throttlingTimeSec) {
                if (mLocalCallback == null) return;

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

            @Override
            public void onDeregisteredWithDetails(ImsReasonInfo info,
                    @SuggestedAction int suggestedAction,
@@ -356,6 +383,26 @@ public interface RegistrationManager {
            onUnregistered(info);
        }

        /**
         * Notifies the framework when the IMS Provider is unregistered from the IMS network.
         *
         * Since this callback is only required for the communication between telephony framework
         * and ImsService, it is made hidden.
         *
         * @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
         * @param suggestedAction the expected behavior of radio protocol stack.
         * @param imsRadioTech the network type on which IMS registration has failed.
         * @param throttlingTimeSec The registration throttling time in seconds.
         * @hide
         */
        public void onUnregistered(@NonNull ImsReasonInfo info,
                @SuggestedAction int suggestedAction,
                @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech,
                int throttlingTimeSec) {
            // Default impl to keep backwards compatibility with old implementations
            onUnregistered(info);
        }

        /**
         * Notifies the framework when the IMS Provider is unregistered from the IMS network.
         *
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ oneway interface IImsRegistrationCallback {
   void onRegistered(in ImsRegistrationAttributes attr);
   void onRegistering(in ImsRegistrationAttributes attr);
   void onDeregistered(in ImsReasonInfo info, int suggestedAction, int imsRadioTech);
   void onDeregisteredWithTime(in ImsReasonInfo info, int suggestedAction, int imsRadioTech, int throttlingTimeSec);
   void onDeregisteredWithDetails(in ImsReasonInfo info, int suggestedAction, int imsRadioTech, in SipDetails detail);
   void onTechnologyChangeFailed(int imsRadioTech, in ImsReasonInfo info);
   void onSubscriberAssociatedUriChanged(in Uri[] uris);
+57 −0
Original line number Diff line number Diff line
@@ -180,6 +180,14 @@ public class ImsRegistrationImplBase {
     */
    public static final int REASON_VOPS_NOT_SUPPORTED = 7;

    /**
     * The default throttling time in seconds to wait before attempting IMS registration after
     * an IMS deregistration event. This value is used by default when a more specific throttling
     * duration is not otherwise specified.
     * @hide
     */
    public static final int DEFAULT_THROTTLE_SEC = 0;

    private Executor mExecutor;

    /**
@@ -619,6 +627,55 @@ public class ImsRegistrationImplBase {
        }, isEmergency);
    }

    /**
     * Notify the framework that the device is disconnected from the IMS network.
     * <p>
     * Note: Prior to calling {@link #onDeregistered(ImsReasonInfo,int)}, you should ensure that any
     * changes to {@link android.telephony.ims.feature.ImsFeature} capability availability is sent
     * to the framework.  For example,
     * {@link android.telephony.ims.feature.MmTelFeature.MmTelCapabilities#CAPABILITY_TYPE_VIDEO}
     * and
     * {@link android.telephony.ims.feature.MmTelFeature.MmTelCapabilities#CAPABILITY_TYPE_VOICE}
     * may be set to unavailable to ensure the framework knows these services are no longer
     * available due to de-registration.  If you do not report capability changes impacted by
     * de-registration, the framework will not know which features are no longer available as a
     * result.
     *
     * @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
     * @param suggestedAction the expected behavior of radio protocol stack.
     * @param attributes The attributes associated with the IMS registration
     * @param throttlingTimeSec The registration throttling time in seconds.
     * @hide This API is not part of the Android public SDK API
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SUPPORT_THROTTLE_TIME_FOR_DEREGISTRATION)
    public final void onDeregistered(@Nullable ImsReasonInfo info,
            @RegistrationManager.SuggestedAction int suggestedAction,
            @NonNull ImsRegistrationAttributes attributes, int throttlingTimeSec) {
        boolean isEmergency = isEmergency(attributes);
        int imsRadioTech = attributes.getRegistrationTechnology();
        if (isEmergency) {
            updateToDisconnectedEmergencyState(info, suggestedAction, imsRadioTech);
        } else {
            updateToDisconnectedState(info, suggestedAction, imsRadioTech);
        }
        // ImsReasonInfo should never be null.
        final ImsReasonInfo reasonInfo = (info != null) ? info : new ImsReasonInfo();

        broadcastToCallbacksLocked((c) -> {
            try {
                if (isEmergency) {
                    c.onDeregistered(reasonInfo, suggestedAction, imsRadioTech);
                } else {
                    c.onDeregisteredWithTime(
                            reasonInfo, suggestedAction, imsRadioTech, throttlingTimeSec);
                }
            } catch (RemoteException e) {
                Log.w(LOG_TAG, e + "onDeregistered() - Skipping callback.");
            }
        }, isEmergency);
    }

    /**
     * Notify the framework that the device is disconnected from the IMS network.
     * <p>