Add setCallAudioHandler api for dynamic audio switching feature
Bug: 250815288
Bug: 255715090
Test: Build and atest ImsCallingTest#testSetCallAudioHandler
Change-Id: I39ad8fd8756f750aa88595377902d9807f9fb5eb
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 47faa3b..5323bc6 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -15720,9 +15720,12 @@
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
diff --git a/telephony/java/android/telephony/ims/aidl/IImsMmTelListener.aidl b/telephony/java/android/telephony/ims/aidl/IImsMmTelListener.aidl
index 5246470..640426b 100644
--- a/telephony/java/android/telephony/ims/aidl/IImsMmTelListener.aidl
+++ b/telephony/java/android/telephony/ims/aidl/IImsMmTelListener.aidl
@@ -34,4 +34,5 @@
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);
}
diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
index 8184424..95dde1b 100644
--- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java
+++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
@@ -573,6 +573,17 @@
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 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;
/**
@@ -768,6 +802,28 @@
}
/**
+ * 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
* includes a capability A to enable or disable, this method should return the correct enabled