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

Commit 5922028e authored by Helen's avatar Helen
Browse files

Add setCallAudioHandler api for dynamic audio switching feature

Bug: 250815288
Bug: 255715090
Test: Build and atest ImsCallingTest#testSetCallAudioHandler

Change-Id: I39ad8fd8756f750aa88595377902d9807f9fb5eb
parent 4c3f1666
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15720,9 +15720,12 @@ package android.telephony.ims.feature {
    method public void onFeatureRemoved();
    method public boolean queryCapabilityConfiguration(int, int);
    method @NonNull public final android.telephony.ims.feature.MmTelFeature.MmTelCapabilities queryCapabilityStatus();
    method public final void setCallAudioHandler(int);
    method public void setTerminalBasedCallWaitingStatus(boolean);
    method public void setUiTtyMode(int, @Nullable android.os.Message);
    method public int shouldProcessCall(@NonNull String[]);
    field public static final int AUDIO_HANDLER_ANDROID = 0; // 0x0
    field public static final int AUDIO_HANDLER_BASEBAND = 1; // 0x1
    field public static final String EXTRA_IS_UNKNOWN_CALL = "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";
    field public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD";
    field public static final int PROCESS_CALL_CSFB = 1; // 0x1
+1 −0
Original line number Diff line number Diff line
@@ -34,4 +34,5 @@ interface IImsMmTelListener {
    void onIncomingCall(IImsCallSession c, in Bundle extras);
    void onRejectedCall(in ImsCallProfile callProfile, in ImsReasonInfo reason);
    oneway void onVoiceMessageCountUpdate(int count);
    oneway void onAudioModeIsVoipChanged(int imsAudioHandler);
}
+56 −0
Original line number Diff line number Diff line
@@ -573,6 +573,17 @@ public class MmTelFeature extends ImsFeature {
        public void onVoiceMessageCountUpdate(int count) {

        }

        /**
         * Called to set the audio handler for this connection.
         * @param imsAudioHandler an {@link ImsAudioHandler} used to handle the audio
         *        for this IMS call.
         * @hide
         */
        @Override
        public void onAudioModeIsVoipChanged(int imsAudioHandler) {

        }
    }

    /**
@@ -622,6 +633,29 @@ public class MmTelFeature extends ImsFeature {
    public static final String EXTRA_IS_UNKNOWN_CALL =
            "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";

    /** @hide */
    @IntDef(flag = true,
            value = {
                    AUDIO_HANDLER_ANDROID,
                    AUDIO_HANDLER_BASEBAND
            })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ImsAudioHandler {}

    /**
    * Audio Handler - Android
    * @hide
    */
    @SystemApi
    public static final int AUDIO_HANDLER_ANDROID = 0;

    /**
    * Audio Handler - Baseband
    * @hide
    */
    @SystemApi
    public static final int AUDIO_HANDLER_BASEBAND = 1;

    private IImsMmTelListener mListener;

    /**
@@ -767,6 +801,28 @@ public class MmTelFeature extends ImsFeature {
        }
    }

    /**
     * Sets the audio handler for this connection. The vendor IMS stack will invoke this API
     * to inform Telephony/Telecom layers about which audio handlers i.e. either Android or Modem
     * shall be used for handling the IMS call audio.
     *
     * @param imsAudioHandler {@link MmTelFeature#ImsAudioHandler} used to handle the audio
     *        for this IMS call.
     * @hide
     */
    @SystemApi
    public final void setCallAudioHandler(@ImsAudioHandler int imsAudioHandler) {
        IImsMmTelListener listener = getListener();
        if (listener == null) {
            throw new IllegalStateException("Session is not available.");
        }
        try {
            listener.onAudioModeIsVoipChanged(imsAudioHandler);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Provides the MmTelFeature with the ability to return the framework Capability Configuration
     * for a provided Capability. If the framework calls {@link #changeEnabledCapabilities} and