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

Commit d897e293 authored by Hakjun Choi's avatar Hakjun Choi Committed by Gerrit Code Review
Browse files

Merge "add setDefaultExecutor to ImsCallSessionListener to set the executor...

Merge "add setDefaultExecutor to ImsCallSessionListener to set the executor when a conference call is established"
parents 4ce28e4b 04058658
Loading
Loading
Loading
Loading
+28 −1
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.ims.internal.IImsCallSession;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Objects;
import java.util.Objects;
import java.util.Set;
import java.util.Set;
import java.util.concurrent.Executor;


/**
/**
 * Listener interface for notifying the Framework's {@link ImsCallSession} for updates to an ongoing
 * Listener interface for notifying the Framework's {@link ImsCallSession} for updates to an ongoing
@@ -44,8 +45,8 @@ import java.util.Set;
// ImsCallSessionListenerConverter is also changed.
// ImsCallSessionListenerConverter is also changed.
@SystemApi
@SystemApi
public class ImsCallSessionListener {
public class ImsCallSessionListener {

    private final IImsCallSessionListener mListener;
    private final IImsCallSessionListener mListener;
    private Executor mExecutor = null;


    /** @hide */
    /** @hide */
    public ImsCallSessionListener(IImsCallSessionListener l) {
    public ImsCallSessionListener(IImsCallSessionListener l) {
@@ -243,6 +244,9 @@ public class ImsCallSessionListener {
    public void callSessionMergeStarted(ImsCallSessionImplBase newSession, ImsCallProfile profile)
    public void callSessionMergeStarted(ImsCallSessionImplBase newSession, ImsCallProfile profile)
    {
    {
        try {
        try {
            if (newSession != null && mExecutor != null) {
                newSession.setDefaultExecutor(mExecutor);
            }
            mListener.callSessionMergeStarted(newSession != null ?
            mListener.callSessionMergeStarted(newSession != null ?
                            newSession.getServiceImpl() : null, profile);
                            newSession.getServiceImpl() : null, profile);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
@@ -274,6 +278,9 @@ public class ImsCallSessionListener {
     */
     */
    public void callSessionMergeComplete(ImsCallSessionImplBase newSession) {
    public void callSessionMergeComplete(ImsCallSessionImplBase newSession) {
        try {
        try {
            if (newSession != null && mExecutor != null) {
                newSession.setDefaultExecutor(mExecutor);
            }
            mListener.callSessionMergeComplete(newSession != null ?
            mListener.callSessionMergeComplete(newSession != null ?
                    newSession.getServiceImpl() : null);
                    newSession.getServiceImpl() : null);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
@@ -361,6 +368,9 @@ public class ImsCallSessionListener {
    public void callSessionConferenceExtended(ImsCallSessionImplBase newSession,
    public void callSessionConferenceExtended(ImsCallSessionImplBase newSession,
            ImsCallProfile profile) {
            ImsCallProfile profile) {
        try {
        try {
            if (newSession != null && mExecutor != null) {
                newSession.setDefaultExecutor(mExecutor);
            }
            mListener.callSessionConferenceExtended(
            mListener.callSessionConferenceExtended(
                    newSession != null ? newSession.getServiceImpl() : null, profile);
                    newSession != null ? newSession.getServiceImpl() : null, profile);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
@@ -406,6 +416,9 @@ public class ImsCallSessionListener {
    public void callSessionConferenceExtendReceived(ImsCallSessionImplBase newSession,
    public void callSessionConferenceExtendReceived(ImsCallSessionImplBase newSession,
            ImsCallProfile profile) {
            ImsCallProfile profile) {
        try {
        try {
            if (newSession != null && mExecutor != null) {
                newSession.setDefaultExecutor(mExecutor);
            }
            mListener.callSessionConferenceExtendReceived(newSession != null
            mListener.callSessionConferenceExtendReceived(newSession != null
                    ? newSession.getServiceImpl() : null, profile);
                    ? newSession.getServiceImpl() : null, profile);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
@@ -808,5 +821,19 @@ public class ImsCallSessionListener {
            e.rethrowFromSystemServer();
            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;
        }
    }
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -644,6 +644,7 @@ public class MmTelFeature extends ImsFeature {
            throw new IllegalStateException("Session is not available.");
            throw new IllegalStateException("Session is not available.");
        }
        }
        try {
        try {
            c.setDefaultExecutor(MmTelFeature.this.mExecutor);
            listener.onIncomingCall(c.getServiceImpl(), extras);
            listener.onIncomingCall(c.getServiceImpl(), extras);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw new RuntimeException(e);
            throw new RuntimeException(e);
+3 −2
Original line number Original line Diff line number Diff line
@@ -173,8 +173,9 @@ public class ImsCallSessionImplBase implements AutoCloseable {


        @Override
        @Override
        public void setListener(IImsCallSessionListener listener) {
        public void setListener(IImsCallSessionListener listener) {
            executeMethodAsync(() -> ImsCallSessionImplBase.this.setListener(
            ImsCallSessionListener iCSL = new ImsCallSessionListener(listener);
                    new ImsCallSessionListener(listener)), "setListener");
            iCSL.setDefaultExecutor(mExecutor);
            executeMethodAsync(() -> ImsCallSessionImplBase.this.setListener(iCSL), "setListener");
        }
        }


        @Override
        @Override