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

Commit a3be625f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "IMS Call Extras Feature"

parents c56762b4 8abaa6a4
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -173,6 +173,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. */
    /** True if this is an incoming call. */
    private final boolean mIsIncoming;
    private final boolean mIsIncoming;


+25 −0
Original line number Original line Diff line number Diff line
@@ -65,6 +65,7 @@ public final class CallsManager extends Call.ListenerBase {
        void onCallAdded(Call call);
        void onCallAdded(Call call);
        void onCallRemoved(Call call);
        void onCallRemoved(Call call);
        void onCallStateChanged(Call call, int oldState, int newState);
        void onCallStateChanged(Call call, int oldState, int newState);
        void onCallExtrasUpdated(Call call);
        void onConnectionServiceChanged(
        void onConnectionServiceChanged(
                Call call,
                Call call,
                ConnectionServiceWrapper oldService,
                ConnectionServiceWrapper oldService,
@@ -1273,6 +1274,30 @@ public final class CallsManager extends Call.ListenerBase {
        manageMSimInCallTones(false);
        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.
     * Checks which call should be visible to the user and have audio focus.
     */
     */
+4 −0
Original line number Original line Diff line number Diff line
@@ -34,6 +34,10 @@ class CallsManagerListenerBase implements CallsManager.CallsManagerListener {
    public void onCallStateChanged(Call call, int oldState, int newState) {
    public void onCallStateChanged(Call call, int oldState, int newState) {
    }
    }


    @Override
    public void onCallExtrasUpdated(Call call) {
    }

    @Override
    @Override
    public void onConnectionServiceChanged(
    public void onConnectionServiceChanged(
            Call call,
            Call call,
+24 −0
Original line number Original line 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_CALLER_DISPLAY_NAME = 18;
    private static final int MSG_SET_VIDEO_STATE = 19;
    private static final int MSG_SET_VIDEO_STATE = 19;
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    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_DISCONNECTED_WITH_SUPP_NOTIFICATION = 22;
    private static final int MSG_SET_PHONE_ACCOUNT = 23;
    private static final int MSG_SET_PHONE_ACCOUNT = 23;
    private static final int MSG_SET_CALL_SUBSTATE = 24;
    private static final int MSG_SET_CALL_SUBSTATE = 24;
@@ -109,6 +110,20 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                        //Log.w(this, "setActive, unknown call id: %s", msg.obj);
                        //Log.w(this, "setActive, unknown call id: %s", msg.obj);
                    }
                    }
                    break;
                    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:
                case MSG_SET_RINGING:
                    call = mCallIdMapper.getCall(msg.obj);
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
                    if (call != null) {
@@ -427,6 +442,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
        @Override
        public void setRinging(String callId) {
        public void setRinging(String callId) {
            logIncoming("setRinging %s", callId);
            logIncoming("setRinging %s", callId);
+5 −0
Original line number Original line Diff line number Diff line
@@ -191,6 +191,11 @@ public final class InCallController extends CallsManagerListenerBase {
        updateCall(call);
        updateCall(call);
    }
    }


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

    @Override
    @Override
    public void onConnectionServiceChanged(
    public void onConnectionServiceChanged(
            Call call,
            Call call,