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

Commit 5c87c889 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HFPClient call disconnect cause"

parents 62062f63 d31e52eb
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public class HfpClientConnection extends Connection {
    private BluetoothHeadsetClient mHeadsetProfile;

    private BluetoothHeadsetClientCall mCurrentCall;
    private int mPreviousCallState = -1;
    private boolean mClosed;
    private boolean mClosing = false;
    private boolean mLocalDisconnect;
@@ -162,12 +163,19 @@ public class HfpClientConnection extends Connection {
                setRinging();
                break;
            case BluetoothHeadsetClientCall.CALL_STATE_TERMINATED:
                // TODO Use more specific causes
                close(mLocalDisconnect ? DisconnectCause.LOCAL : DisconnectCause.REMOTE);
                if (mPreviousCallState == BluetoothHeadsetClientCall.CALL_STATE_INCOMING
                        || mPreviousCallState == BluetoothHeadsetClientCall.CALL_STATE_WAITING) {
                    close(DisconnectCause.MISSED);
                } else if (mLocalDisconnect) {
                    close(DisconnectCause.LOCAL);
                } else {
                    close(DisconnectCause.REMOTE);
                }
                break;
            default:
                Log.wtf(TAG, "Unexpected phone state " + state);
        }
        mPreviousCallState = state;
    }

    public synchronized void close(int cause) {
+5 −5
Original line number Diff line number Diff line
@@ -192,15 +192,15 @@ public class HfpClientDeviceBlock {
            // (represented as unknown call in telecom since). Since BluetoothHeadsetClientCall is a
            // parcelable we simply pack the entire object in there.
            Bundle b = new Bundle();
            if (call.getState() == BluetoothHeadsetClientCall.CALL_STATE_DIALING ||
                call.getState() == BluetoothHeadsetClientCall.CALL_STATE_ALERTING ||
                call.getState() == BluetoothHeadsetClientCall.CALL_STATE_ACTIVE ||
                call.getState() == BluetoothHeadsetClientCall.CALL_STATE_WAITING) {
            if (call.getState() == BluetoothHeadsetClientCall.CALL_STATE_DIALING
                    || call.getState() == BluetoothHeadsetClientCall.CALL_STATE_ALERTING
                    || call.getState() == BluetoothHeadsetClientCall.CALL_STATE_ACTIVE) {
                // This is an outgoing call. Even if it is an active call we do not have a way of
                // putting that parcelable in a seaprate field.
                b.putParcelable(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, call);
                mTelecomManager.addNewUnknownCall(mPhoneAccount.getAccountHandle(), b);
            } else if (call.getState() == BluetoothHeadsetClientCall.CALL_STATE_INCOMING) {
            } else if (call.getState() == BluetoothHeadsetClientCall.CALL_STATE_INCOMING
                    || call.getState() == BluetoothHeadsetClientCall.CALL_STATE_WAITING) {
                // This is an incoming call.
                b.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_EXTRAS, call);
                mTelecomManager.addNewIncomingCall(mPhoneAccount.getAccountHandle(), b);