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

Commit 8abaa6a4 authored by Omkar Kolangade's avatar Omkar Kolangade Committed by Gerrit - the friendly Code Review server
Browse files

IMS Call Extras Feature

Adding support to allow OEMs to send
extra information with the Dial Intent all the
way to the IMS service layer and beyond.
Similarly, extras for MT calls are propagated
from IMS Service layer till the UI layer.

Change-Id: I351d32c15494c7df5d00c05053368fd5fa17b49b
CRs-Fixed: 724860
parent 92ad167c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -170,6 +170,11 @@ final class Call implements CreateConnectionResponse {
        }
    };

    // Key used to pack OEM call extras within a Call object's
    // mExtras Bundle. Used by the setCallExtras method in
    // CallsManager.
    public static final String KEY_OEM_EXTRAS = "OEMExtras";

    /** True if this is an incoming call. */
    private final boolean mIsIncoming;

+25 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public final class CallsManager extends Call.ListenerBase {
        void onCallAdded(Call call);
        void onCallRemoved(Call call);
        void onCallStateChanged(Call call, int oldState, int newState);
        void onCallExtrasUpdated(Call call);
        void onConnectionServiceChanged(
                Call call,
                ConnectionServiceWrapper oldService,
@@ -1264,6 +1265,30 @@ public final class CallsManager extends Call.ListenerBase {
        manageMSimInCallTones(false);
    }

    /**
     * Adds OEM extras from lower layers into Call's extras.
     *
     * @param call The call.
     * @param extras OEM call extras.
     */
    void setCallExtras(Call call, Bundle extras) {
        if (extras == null) {
            Log.d(this, "setCallExtras Null extras Bundle");
            return;
        }
        Bundle callExtras = call.getExtras();

        // NOTE: OEM extras are packed "as is" within the Call
        // object's mExtras Bundle so as to preserve the
        // original contents of the mExtras Bundle. We don't
        // want to overwrite mExtras with the OEM extras.
        callExtras.putBundle(Call.KEY_OEM_EXTRAS, extras);

        for (CallsManagerListener listener : mListeners) {
            listener.onCallExtrasUpdated(call);
        }
    }

    /**
     * Checks which call should be visible to the user and have audio focus.
     */
+4 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@ class CallsManagerListenerBase implements CallsManager.CallsManagerListener {
    public void onCallStateChanged(Call call, int oldState, int newState) {
    }

    @Override
    public void onCallExtrasUpdated(Call call) {
    }

    @Override
    public void onConnectionServiceChanged(
            Call call,
+24 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
    private static final int MSG_SET_CALLER_DISPLAY_NAME = 18;
    private static final int MSG_SET_VIDEO_STATE = 19;
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_SET_EXTRAS = 21;
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 22;
    private static final int MSG_SET_PHONE_ACCOUNT = 23;

@@ -108,6 +109,20 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                        //Log.w(this, "setActive, unknown call id: %s", msg.obj);
                    }
                    break;
                case MSG_SET_EXTRAS: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        String callId = (String) args.arg1;
                        Bundle extras = (Bundle) args.arg2;
                        call = mCallIdMapper.getCall(callId);
                        if (call != null) {
                            mCallsManager.setCallExtras(call, extras);
                        }
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                case MSG_SET_RINGING:
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
@@ -419,6 +434,15 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
            }
        }

        @Override
        public void setExtras(String callId, Bundle extras) {
            logIncoming("setExtras size= " + extras.size() + " | callId= " + callId);
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.arg2 = extras;
            mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget();
        }

        @Override
        public void setRinging(String callId) {
            logIncoming("setRinging %s", callId);
+5 −0
Original line number Diff line number Diff line
@@ -186,6 +186,11 @@ public final class InCallController extends CallsManagerListenerBase {
        updateCall(call);
    }

    @Override
    public void onCallExtrasUpdated(Call call) {
        updateCall(call);
    }

    @Override
    public void onConnectionServiceChanged(
            Call call,