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

Commit 331e4ee4 authored by Hakjun Choi's avatar Hakjun Choi Committed by Android (Google) Code Review
Browse files

Merge "Unable to accept incoming call when using main Executor in MmTelFeature"

parents 9be37e28 17846472
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -15770,7 +15770,8 @@ package android.telephony.ims.feature {
    method @NonNull public android.telephony.ims.stub.ImsSmsImplBase getSmsImplementation();
    method @NonNull public android.telephony.ims.stub.ImsUtImplBase getUt();
    method public final void notifyCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
    method public final void notifyIncomingCall(@NonNull android.telephony.ims.stub.ImsCallSessionImplBase, @NonNull android.os.Bundle);
    method @Deprecated public final void notifyIncomingCall(@NonNull android.telephony.ims.stub.ImsCallSessionImplBase, @NonNull android.os.Bundle);
    method @Nullable public final android.telephony.ims.ImsCallSessionListener notifyIncomingCall(@NonNull android.telephony.ims.stub.ImsCallSessionImplBase, @NonNull String, @NonNull android.os.Bundle);
    method public final void notifyRejectedCall(@NonNull android.telephony.ims.ImsCallProfile, @NonNull android.telephony.ims.ImsReasonInfo);
    method public void notifySrvccCanceled();
    method public void notifySrvccCompleted();
@@ -15880,7 +15881,7 @@ package android.telephony.ims.stub {
    method public void sendRttModifyRequest(android.telephony.ims.ImsCallProfile);
    method public void sendRttModifyResponse(boolean);
    method public void sendUssd(String);
    method public void setListener(android.telephony.ims.ImsCallSessionListener);
    method @Deprecated public void setListener(android.telephony.ims.ImsCallSessionListener);
    method public void setMute(boolean);
    method public void start(String, android.telephony.ims.ImsCallProfile);
    method public void startConference(String[], android.telephony.ims.ImsCallProfile);
+34 −13
Original line number Diff line number Diff line
@@ -18,10 +18,12 @@ package android.telephony.ims;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Bundle;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.CallQuality;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.stub.ImsCallSessionImplBase;
import android.util.ArraySet;
import android.util.Log;

@@ -99,7 +101,6 @@ public class ImsCallSession {
     * Listener for events relating to an IMS session, such as when a session is being
     * recieved ("on ringing") or a call is outgoing ("on calling").
     * <p>Many of these events are also received by {@link ImsCall.Listener}.</p>
     * @hide
     */
    public static class Listener {
        /**
@@ -523,16 +524,18 @@ public class ImsCallSession {

    private final IImsCallSession miSession;
    private boolean mClosed = false;
    private String mCallId = null;
    private Listener mListener;
    private Executor mListenerExecutor = Runnable::run;
    private IImsCallSessionListenerProxy mIImsCallSessionListenerProxy = null;

    /** @hide */
    public ImsCallSession(IImsCallSession iSession) {
        miSession = iSession;
        mIImsCallSessionListenerProxy = new IImsCallSessionListenerProxy();

        if (iSession != null) {
            try {
                iSession.setListener(new IImsCallSessionListenerProxy());
                iSession.setListener(mIImsCallSessionListenerProxy);
            } catch (RemoteException e) {
            }
        } else {
@@ -540,12 +543,18 @@ public class ImsCallSession {
        }
    }

    /** @hide */
    public ImsCallSession(IImsCallSession iSession, Listener listener, Executor executor) {
        this(iSession);
        setListener(listener, executor);
    }

    /**
     * returns the IImsCallSessionListenerProxy for the ImsCallSession
     */
    public final IImsCallSessionListenerProxy getIImsCallSessionListenerProxy() {
        return mIImsCallSessionListenerProxy;
    }

    /**
     * Closes this object. This object is not usable after being closed.
     */
@@ -573,12 +582,29 @@ public class ImsCallSession {
            return null;
        }

        if (mCallId != null) {
            return mCallId;
        } else {
            try {
            return miSession.getCallId();
                return mCallId = miSession.getCallId();
            } catch (RemoteException e) {
                return null;
            }
        }
    }

    /**
     * Sets the call ID of the session.
     *
     * @param callId Call ID of the session, which is transferred from
     * {@link android.telephony.ims.feature.MmTelFeature#notifyIncomingCall(
     * ImsCallSessionImplBase, String, Bundle)}
     */
    public void setCallId(String callId) {
        if (callId != null) {
            mCallId = callId;
        }
    }

    /**
     * Gets the call profile that this session is associated with
@@ -635,7 +661,6 @@ public class ImsCallSession {
     * Gets the video call provider for the session.
     *
     * @return The video call provider.
     * @hide
     */
    public IImsVideoCallProvider getVideoCallProvider() {
        if (mClosed) {
@@ -712,7 +737,6 @@ public class ImsCallSession {

    /**
     * Gets the native IMS call session.
     * @hide
     */
    public IImsCallSession getSession() {
        return miSession;
@@ -742,7 +766,6 @@ public class ImsCallSession {
     *
     * @param listener to listen to the session events of this object
     * @param executor an Executor that will execute callbacks
     * @hide
     */
    public void setListener(Listener listener, Executor executor) {
        mListener = listener;
@@ -1706,8 +1729,6 @@ public class ImsCallSession {
        StringBuilder sb = new StringBuilder();
        sb.append("[ImsCallSession objId:");
        sb.append(System.identityHashCode(this));
        sb.append(" state:");
        sb.append(State.toString(getState()));
        sb.append(" callId:");
        sb.append(getCallId());
        sb.append("]");
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import android.os.Bundle;

import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsReasonInfo;

import android.telephony.ims.aidl.IImsCallSessionListener;
import com.android.ims.internal.IImsCallSession;

/**
@@ -31,7 +31,7 @@ import com.android.ims.internal.IImsCallSession;
 // processed by telephony before the control flow returns to the ImsService to perform
 // operations on the IImsCallSession.
interface IImsMmTelListener {
    void onIncomingCall(IImsCallSession c, in Bundle extras);
    IImsCallSessionListener onIncomingCall(in IImsCallSession c, in String callId, in Bundle extras);
    void onRejectedCall(in ImsCallProfile callProfile, in ImsReasonInfo reason);
    oneway void onVoiceMessageCountUpdate(int count);
    oneway void onAudioModeIsVoipChanged(int imsAudioHandler);
+54 −5
Original line number Diff line number Diff line
@@ -27,11 +27,13 @@ import android.os.ServiceSpecificException;
import android.telecom.TelecomManager;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsCallSession;
import android.telephony.ims.ImsCallSessionListener;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsService;
import android.telephony.ims.RtpHeaderExtensionType;
import android.telephony.ims.SrvccCall;
import android.telephony.ims.aidl.IImsCallSessionListener;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsMmTelListener;
@@ -552,11 +554,19 @@ public class MmTelFeature extends ImsFeature {
        /**
         * Called when the IMS provider receives an incoming call.
         * @param c The {@link ImsCallSession} associated with the new call.
         * @param callId The call ID of the session of the new incoming call.
         * @param extras A bundle containing extra parameters related to the call. See
         * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.
         * @return the listener to listen to the session events. An {@link ImsCallSession} can only
         *         hold one listener at a time. see {@link ImsCallSessionListener}.
         *         If this method returns {@code null}, then the call could not be placed.
         * @hide
         */
        @Override
        public void onIncomingCall(IImsCallSession c, Bundle extras) {

        @Nullable
        public IImsCallSessionListener onIncomingCall(IImsCallSession c,
                String callId, Bundle extras) {
            return null;
        }

        /**
@@ -780,7 +790,10 @@ public class MmTelFeature extends ImsFeature {
     * @param extras A bundle containing extra parameters related to the call. See
     * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.
     * @hide
     *
     * @deprecated use {@link #notifyIncomingCall(ImsCallSessionImplBase, String, Bundle)} instead
     */
    @Deprecated
    @SystemApi
    public final void notifyIncomingCall(@NonNull ImsCallSessionImplBase c,
            @NonNull Bundle extras) {
@@ -792,9 +805,45 @@ public class MmTelFeature extends ImsFeature {
        if (listener == null) {
            throw new IllegalStateException("Session is not available.");
        }
        try {
            listener.onIncomingCall(c.getServiceImpl(), null, extras);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Notify the framework of an incoming call.
     * @param c The {@link ImsCallSessionImplBase} of the new incoming call.
     * @param callId The call ID of the session of the new incoming call.
     * @param extras A bundle containing extra parameters related to the call. See
     * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.
     * @return The listener used by the framework to listen to call session events created
     *         from the ImsService.
     *         If this method returns {@code null}, then the call could not be placed.
     * @hide
     */
    @SystemApi
    @Nullable
    public final ImsCallSessionListener notifyIncomingCall(
            @NonNull ImsCallSessionImplBase c, @NonNull String callId, @NonNull Bundle extras) {
        if (c == null || callId == null || extras == null) {
            throw new IllegalArgumentException("ImsCallSessionImplBase, callId, and Bundle can "
                    + "not be null.");
        }
        IImsMmTelListener listener = getListener();
        if (listener == null) {
            throw new IllegalStateException("Session is not available.");
        }
        try {
            c.setDefaultExecutor(MmTelFeature.this.mExecutor);
            listener.onIncomingCall(c.getServiceImpl(), extras);
            IImsCallSessionListener isl =
                    listener.onIncomingCall(c.getServiceImpl(), callId, extras);
            if (isl != null) {
                return new ImsCallSessionListener(isl);
            } else {
                return null;
            }
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
@@ -836,7 +885,7 @@ public class MmTelFeature extends ImsFeature {
            throw new IllegalStateException("Session is not available.");
        }
        try {
            listener.onIncomingCall(c, extras);
            listener.onIncomingCall(c, null, extras);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        }
+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telephony.ims.stub;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.ims.ImsCallProfile;
@@ -366,7 +367,11 @@ public class ImsCallSessionImplBase implements AutoCloseable {
     *
     * @param listener {@link ImsCallSessionListener} used to notify the framework of updates
     * to the ImsCallSession

     * @deprecated use {@link android.telephony.ims.feature.MmTelFeature#notifyIncomingCall(
     * ImsCallSessionImplBase, String, Bundle)} to get the listener instead
     */
    @Deprecated
    public void setListener(ImsCallSessionListener listener) {
    }

Loading