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

Commit 2cc1003b authored by Suresh Kumar Sugguna's avatar Suresh Kumar Sugguna Committed by Linux Build Service Account
Browse files

IMS: Deflect call feature

Code changes to support IMS Deflect call feature.

CRs-Fixed: 713856

Conflicts:
telecomm/java/android/telecomm/ConnectionService.java
telecomm/java/android/telecom/InCallAdapter.java
Change-Id: I74b7fd34cad8d49f660fb05bd33becf6ae1de5d2
parent c9f43e91
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -421,6 +421,15 @@ public final class Call {
        mInCallAdapter.answerCall(mTelecomCallId, videoState);
    }

    /**
     * Instructs this {@link #STATE_RINGING} {@code Call} to deflect.
     * @param number The number to which the call will be deflected.
     */
    /** @hide */
    public void deflectCall(String number) {
        mInCallAdapter.deflectCall(mTelecommCallId, number);
    }

    /**
     * Instructs this {@link #STATE_RINGING} {@code Call} to reject.
     *
+7 −0
Original line number Diff line number Diff line
@@ -1050,6 +1050,13 @@ public abstract class Connection {

    /**
     * Notifies this Connection, which is in {@link #STATE_RINGING}, of
     * a request to deflect.
     */
    /** @hide */
    public void onDeflect(String number) {}

    /**
     * Notifies this Connection, which is in {@link State#RINGING}, of
     * a request to reject.
     */
    public void onReject() {}
+25 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public abstract class ConnectionService extends Service {
    private static final int MSG_SWAP_CONFERENCE = 19;
    private static final int MSG_SET_LOCAL_HOLD = 20;
    private static final int MSG_SET_ACTIVE_SUB = 21;
    private static final int MSG_DEFLECT = 22;

    private static Connection sNullConnection;

@@ -138,6 +139,14 @@ public abstract class ConnectionService extends Service {
            mHandler.obtainMessage(MSG_ANSWER, callId).sendToTarget();
        }

        @Override
        public void deflect(String callId, String number) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.arg2 = number;
            mHandler.obtainMessage(MSG_DEFLECT, args).sendToTarget();
        }

        @Override
        public void reject(String callId) {
            mHandler.obtainMessage(MSG_REJECT, callId).sendToTarget();
@@ -359,6 +368,17 @@ public abstract class ConnectionService extends Service {
                    }
                    break;
                }
                case MSG_DEFLECT: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        String callId = (String) args.arg1;
                        String number = (String) args.arg2;
                        deflect(callId, number);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                default:
                    break;
            }
@@ -656,6 +676,11 @@ public abstract class ConnectionService extends Service {
        findConnectionForAction(callId, "answer").onAnswer();
    }

    private void deflect(String callId, String number) {
        Log.d(this, "deflect %s - %s", callId, number);
        findConnectionForAction(callId, "deflect").onDeflect(number);
    }

    private void reject(String callId) {
        Log.d(this, "reject %s", callId);
        findConnectionForAction(callId, "reject").onReject();
+16 −0
Original line number Diff line number Diff line
@@ -56,6 +56,22 @@ public final class InCallAdapter {
        }
    }

    /**
     * Instructs Telecomm to deflect the specified call.
     *
     * @param callId The identifier of the call to deflect.
     * @param deflectNumber The number to deflect.
     */
    /**
     * {@hide}
     */
    public void deflectCall(String callId, String deflectNumber) {
        try {
            mAdapter.deflectCall(callId, deflectNumber);
        } catch (RemoteException e) {
        }
    }

    /**
     * Instructs Telecom to reject the specified call.
     *
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ oneway interface IConnectionService {

    void answer(String callId);

    void deflect(String callId, String number);

    void reject(String callId);

    void disconnect(String callId);
Loading