diff options
3 files changed, 35 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/ims/ImsCallSessionListener.java b/telephony/java/android/telephony/ims/ImsCallSessionListener.java index 4836f86fe3e1..5946535ce3af 100644 --- a/telephony/java/android/telephony/ims/ImsCallSessionListener.java +++ b/telephony/java/android/telephony/ims/ImsCallSessionListener.java @@ -35,6 +35,7 @@ import com.android.ims.internal.IImsCallSession; import java.util.ArrayList; import java.util.Objects; import java.util.Set; +import java.util.concurrent.Executor; /** * Listener interface for notifying the Framework's {@link ImsCallSession} for updates to an ongoing @@ -50,6 +51,7 @@ import java.util.Set; public class ImsCallSessionListener { private static final String TAG = "ImsCallSessionListener"; private final IImsCallSessionListener mListener; + private Executor mExecutor = null; /** @hide */ public ImsCallSessionListener(IImsCallSessionListener l) { @@ -247,6 +249,9 @@ public class ImsCallSessionListener { public void callSessionMergeStarted(ImsCallSessionImplBase newSession, ImsCallProfile profile) { try { + if (newSession != null && mExecutor != null) { + newSession.setDefaultExecutor(mExecutor); + } mListener.callSessionMergeStarted(newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { @@ -278,6 +283,9 @@ public class ImsCallSessionListener { */ public void callSessionMergeComplete(ImsCallSessionImplBase newSession) { try { + if (newSession != null && mExecutor != null) { + newSession.setDefaultExecutor(mExecutor); + } mListener.callSessionMergeComplete(newSession != null ? newSession.getServiceImpl() : null); } catch (RemoteException e) { @@ -365,6 +373,9 @@ public class ImsCallSessionListener { public void callSessionConferenceExtended(ImsCallSessionImplBase newSession, ImsCallProfile profile) { try { + if (newSession != null && mExecutor != null) { + newSession.setDefaultExecutor(mExecutor); + } mListener.callSessionConferenceExtended( newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { @@ -410,6 +421,9 @@ public class ImsCallSessionListener { public void callSessionConferenceExtendReceived(ImsCallSessionImplBase newSession, ImsCallProfile profile) { try { + if (newSession != null && mExecutor != null) { + newSession.setDefaultExecutor(mExecutor); + } mListener.callSessionConferenceExtendReceived(newSession != null ? newSession.getServiceImpl() : null, profile); } catch (RemoteException e) { @@ -836,5 +850,19 @@ public class ImsCallSessionListener { e.rethrowFromSystemServer(); } } + + /** + * Set default Executor from ImsService. + * @param executor The default executor to use when executing the methods by the vendor + * implementation of {@link ImsCallSessionImplBase} for conference call. + * This executor is dedicated to set vendor CallSessionImpl + * only when conference call is established. + * @hide + */ + public final void setDefaultExecutor(@NonNull Executor executor) { + if (mExecutor == null) { + mExecutor = executor; + } + } } diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java index 153a951a4feb..746246c64e8c 100644 --- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java +++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java @@ -1141,6 +1141,7 @@ public class MmTelFeature extends ImsFeature { throw new IllegalStateException("Session is not available."); } try { + c.setDefaultExecutor(MmTelFeature.this.mExecutor); listener.onIncomingCall(c.getServiceImpl(), null, extras); } catch (RemoteException e) { throw new RuntimeException(e); @@ -1175,7 +1176,9 @@ public class MmTelFeature extends ImsFeature { IImsCallSessionListener isl = listener.onIncomingCall(c.getServiceImpl(), callId, extras); if (isl != null) { - return new ImsCallSessionListener(isl); + ImsCallSessionListener iCSL = new ImsCallSessionListener(isl); + iCSL.setDefaultExecutor(MmTelFeature.this.mExecutor); + return iCSL; } else { return null; } diff --git a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java index 3ab4ee691e67..30a0684af101 100644 --- a/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java +++ b/telephony/java/android/telephony/ims/stub/ImsCallSessionImplBase.java @@ -220,8 +220,9 @@ public class ImsCallSessionImplBase implements AutoCloseable { @Override public void setListener(IImsCallSessionListener listener) { - executeMethodAsync(() -> ImsCallSessionImplBase.this.setListener( - new ImsCallSessionListener(listener)), "setListener"); + ImsCallSessionListener iCSL = new ImsCallSessionListener(listener); + iCSL.setDefaultExecutor(mExecutor); + executeMethodAsync(() -> ImsCallSessionImplBase.this.setListener(iCSL), "setListener"); } @Override |