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

Commit e2d08048 authored by Sanket Padawe's avatar Sanket Padawe Committed by Gerrit Code Review
Browse files

Merge "Implement Call handover initiation side APIs."

parents cbeea238 85291f63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -39099,6 +39099,7 @@ package android.telecom {
    field public static final int HANDOVER_FAILURE_DEST_INVALID_PERM = 3; // 0x3
    field public static final int HANDOVER_FAILURE_DEST_NOT_SUPPORTED = 2; // 0x2
    field public static final int HANDOVER_FAILURE_DEST_USER_REJECTED = 4; // 0x4
    field public static final int HANDOVER_FAILURE_ONGOING_EMERG_CALL = 5; // 0x5
  }
  public static class Call.Details {
+17 −1
Original line number Diff line number Diff line
@@ -868,7 +868,8 @@ public final class Call {
         * @hide
         */
        @IntDef({HANDOVER_FAILURE_DEST_APP_REJECTED, HANDOVER_FAILURE_DEST_NOT_SUPPORTED,
                HANDOVER_FAILURE_DEST_INVALID_PERM, HANDOVER_FAILURE_DEST_USER_REJECTED})
                HANDOVER_FAILURE_DEST_INVALID_PERM, HANDOVER_FAILURE_DEST_USER_REJECTED,
                HANDOVER_FAILURE_ONGOING_EMERG_CALL})
        @Retention(RetentionPolicy.SOURCE)
        public @interface HandoverFailureErrors {}

@@ -896,6 +897,12 @@ public final class Call {
         */
        public static final int HANDOVER_FAILURE_DEST_USER_REJECTED = 4;

        /**
         * Handover failure reason returned via {@link #onHandoverFailed(Call, int)} when there
         * is ongoing emergency call.
         */
        public static final int HANDOVER_FAILURE_ONGOING_EMERG_CALL = 5;


        /**
         * Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
@@ -1945,6 +1952,15 @@ public final class Call {
        }
    }

    /** {@hide} */
    final void internalOnHandoverFailed(int error) {
        for (CallbackRecord<Callback> record : mCallbackRecords) {
            final Call call = this;
            final Callback callback = record.getCallback();
            record.getHandler().post(() -> callback.onHandoverFailed(call, error));
        }
    }

    private void fireStateChanged(final int newState) {
        for (CallbackRecord<Callback> record : mCallbackRecords) {
            final Call call = this;
+13 −3
Original line number Diff line number Diff line
@@ -1371,9 +1371,19 @@ public abstract class ConnectionService extends Service {
                isIncoming,
                isUnknown);

        Connection connection = isUnknown ? onCreateUnknownConnection(callManagerAccount, request)
        Connection connection = null;
        if (request.getExtras() != null && request.getExtras().getBoolean(
                TelecomManager.EXTRA_IS_HANDOVER,false)) {
            if (!isIncoming) {
                connection = onCreateOutgoingHandoverConnection(callManagerAccount, request);
            } else {
                // Todo: Call onCreateIncommingHandoverConnection()
            }
        } else {
            connection = isUnknown ? onCreateUnknownConnection(callManagerAccount, request)
                    : isIncoming ? onCreateIncomingConnection(callManagerAccount, request)
                    : onCreateOutgoingConnection(callManagerAccount, request);
        }
        Log.d(this, "createConnection, connection: %s", connection);
        if (connection == null) {
            connection = Connection.createFailedConnection(
+12 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public abstract class InCallService extends Service {
    private static final int MSG_ON_CONNECTION_EVENT = 9;
    private static final int MSG_ON_RTT_UPGRADE_REQUEST = 10;
    private static final int MSG_ON_RTT_INITIATION_FAILURE = 11;
    private static final int MSG_ON_HANDOVER_FAILED = 12;

    /** Default Handler used to consolidate binder method calls onto a single thread. */
    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -150,6 +151,12 @@ public abstract class InCallService extends Service {
                    mPhone.internalOnRttInitiationFailure(callId, reason);
                    break;
                }
                case MSG_ON_HANDOVER_FAILED: {
                    String callId = (String) msg.obj;
                    int error = msg.arg1;
                    mPhone.internalOnHandoverFailed(callId, error);
                    break;
                }
                default:
                    break;
            }
@@ -225,6 +232,11 @@ public abstract class InCallService extends Service {
        public void onRttInitiationFailure(String callId, int reason) {
            mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, callId).sendToTarget();
        }

        @Override
        public void onHandoverFailed(String callId, int error) {
            mHandler.obtainMessage(MSG_ON_HANDOVER_FAILED, error, 0, callId).sendToTarget();
        }
    }

    private Phone.Listener mPhoneListener = new Phone.Listener() {
+7 −0
Original line number Diff line number Diff line
@@ -223,6 +223,13 @@ public final class Phone {
        }
    }

    final void internalOnHandoverFailed(String callId, int error) {
        Call call = mCallByTelecomCallId.get(callId);
        if (call != null) {
            call.internalOnHandoverFailed(error);
        }
    }

    /**
     * Called to destroy the phone and cleanup any lingering calls.
     */
Loading