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

Commit 8d4de13c authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

add routing for explicit call transfer



Ref: CYNGNOS-1010

Change-Id: Ifd4150ce5589bdb586b3d840e967cc10be19fec4
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 11d3a2dc
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -230,8 +230,14 @@ public final class Call {
         */
        public static final int CAPABILITY_ADD_PARTICIPANT = 0x02000000;

        /**
         * Remote device supports call transfers.
         * @hide
         */
        public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000;

        //******************************************************************************************
        // Next CAPABILITY value: 0x04000000
        // Next CAPABILITY value: 0x08000000
        //******************************************************************************************

        /**
@@ -400,6 +406,9 @@ public final class Call {
            if (can(capabilities, CAPABILITY_ADD_PARTICIPANT)) {
                builder.append(" CAPABILITY_ADD_PARTICIPANT");
            }
            if (can(capabilities, CAPABILITY_SUPPORTS_TRANSFER)) {
                builder.append(" CAPABILITY_SUPPORTS_TRANSFER");
            }
            builder.append("]");
            return builder.toString();
        }
@@ -927,6 +936,15 @@ public final class Call {
        mInCallAdapter.mergeConference(mTelecomCallId);
    }

    /**
     * Instructs this {@code Call} to connect the current active call and the call on hold.
     * The current call will then disconnect.  See {@link Details#CAPABILITY_SUPPORTS_TRANSFER}.
     * @hide
     */
    public void transferCall() {
        mInCallAdapter.transferCall(mTelecomCallId);
    }

    /**
     * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}.
     */
+12 −1
Original line number Diff line number Diff line
@@ -272,8 +272,14 @@ public abstract class Connection extends Conferenceable {
      */
    public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE = 0x01000000;

    /**
     * Remote device supports call transfers.
     * @hide
     */
    public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000;

    //**********************************************************************************************
    // Next CAPABILITY value: 0x04000000
    // Next CAPABILITY value: 0x08000000
    //**********************************************************************************************

    /**
@@ -1944,6 +1950,11 @@ public abstract class Connection extends Conferenceable {
     */
    public void onReject() {}

    /**
     * Transfers the current call.
     */
    public void onTransfer() { }

    /**
     * Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes.
     */
+14 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public abstract class ConnectionService extends Service {
    private static final int MSG_MERGE_CONFERENCE = 18;
    private static final int MSG_SWAP_CONFERENCE = 19;
    private static final int MSG_SET_LOCAL_HOLD = 20;
    private static final int MSG_EXPLICIT_TRANSFER = 21;
    //Proprietary values starts after this.
    private static final int MSG_ADD_PARTICIPANT_WITH_CONFERENCE = 30;

@@ -247,6 +248,11 @@ public abstract class ConnectionService extends Service {
            args.argi1 = proceed ? 1 : 0;
            mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
        }

        @Override
        public void explicitTransfer(String callId) {
            mHandler.obtainMessage(MSG_EXPLICIT_TRANSFER, callId).sendToTarget();
        }
    };

    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -394,6 +400,9 @@ public abstract class ConnectionService extends Service {
                    }
                    break;
                }
                case MSG_EXPLICIT_TRANSFER:
                    transfer((String) msg.obj);
                    break;
                default:
                    break;
            }
@@ -766,6 +775,11 @@ public abstract class ConnectionService extends Service {
        }
    }

    private void transfer(String callId) {
        Log.d(this, "transfer %s", callId);
        findConnectionForAction(callId, "transfer").onTransfer();
    }

    private void unhold(String callId) {
        Log.d(this, "unhold %s", callId);
        if (mConnectionById.containsKey(callId)) {
+7 −0
Original line number Diff line number Diff line
@@ -240,6 +240,13 @@ public final class InCallAdapter {
        }
    }

    public void transferCall(String callId) {
        try {
            mAdapter.transferCall(callId);
        } catch (RemoteException ignored) {
        }
    }

    /**
     * Instructs Telecom to swap the child calls of the specified conference call.
     */
+2 −0
Original line number Diff line number Diff line
@@ -75,4 +75,6 @@ oneway interface IConnectionService {
    void setLocalCallHold(String callId, boolean lchState);

    void addParticipantWithConference(String callId, String recipients);

    void explicitTransfer(String callId);
}
Loading