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

Commit 48471f7b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Bluetooth in band ring"

parents 923fa6c6 e2a2e2cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -784,7 +784,7 @@ public class HeadsetClientService extends ProfileService {
        BluetoothHeadsetClientCall call = new BluetoothHeadsetClientCall(device,
                HeadsetClientStateMachine.HF_ORIGINATED_CALL_ID,
                BluetoothHeadsetClientCall.CALL_STATE_DIALING, number, false  /* multiparty */,
                true  /* outgoing */);
                true  /* outgoing */, sm.getInBandRing());
        Message msg = sm.obtainMessage(HeadsetClientStateMachine.DIAL_NUMBER);
        msg.obj = call;
        sm.sendMessage(msg);
+21 −1
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ public class HeadsetClientStateMachine extends StateMachine {
    private static final boolean DBG = false;

    static final int NO_ACTION = 0;
    static final int IN_BAND_RING_ENABLED = 1;

    // external actions
    public static final int AT_OK = 0;
@@ -139,6 +140,7 @@ public class HeadsetClientStateMachine extends StateMachine {
    private int mIndicatorNetworkType;
    private int mIndicatorNetworkSignal;
    private int mIndicatorBatteryLevel;
    private boolean mInBandRing;

    private String mOperatorName;
    private String mSubscriberInfo;
@@ -171,6 +173,11 @@ public class HeadsetClientStateMachine extends StateMachine {
        return mDisconnected;
    }

    // Get if in band ring is currently enabled on device.
    public boolean getInBandRing() {
        return mInBandRing;
    }

    public void dump(StringBuilder sb) {
        ProfileService.println(sb, "mCurrentDevice: " + mCurrentDevice);
        ProfileService.println(sb, "mAudioState: " + mAudioState);
@@ -410,7 +417,7 @@ public class HeadsetClientStateMachine extends StateMachine {
        }
        mCallsUpdate.put(id,
                new BluetoothHeadsetClientCall(mCurrentDevice, id, state, number, multiParty,
                        outgoing));
                        outgoing, mInBandRing));
    }

    private void acceptCall(int flag) {
@@ -783,6 +790,7 @@ public class HeadsetClientStateMachine extends StateMachine {
            mIndicatorNetworkType = HeadsetClientHalConstants.SERVICE_TYPE_HOME;
            mIndicatorNetworkSignal = 0;
            mIndicatorBatteryLevel = 0;
            mInBandRing = false;

            mAudioWbs = false;

@@ -1408,6 +1416,18 @@ public class HeadsetClientStateMachine extends StateMachine {
                            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, event.device);
                            mService.sendBroadcast(intent, ProfileService.BLUETOOTH_PERM);
                            break;
                        case StackEvent.EVENT_TYPE_IN_BAND_RINGTONE:
                            intent = new Intent(BluetoothHeadsetClient.ACTION_AG_EVENT);
                            mInBandRing = event.valueInt == IN_BAND_RING_ENABLED;
                            intent.putExtra(BluetoothHeadsetClient.EXTRA_IN_BAND_RING,
                                    event.valueInt);
                            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, event.device);
                            mService.sendBroadcast(intent, ProfileService.BLUETOOTH_PERM);
                            if (DBG) {
                                Log.d(TAG,
                                        event.device.toString() + "onInBandRing" + event.valueInt);
                            }
                            break;
                        case StackEvent.EVENT_TYPE_RING_INDICATION:
                            // Ringing is not handled at this indication and rather should be
                            // implemented (by the client of this service). Use the
+13 −1
Original line number Diff line number Diff line
@@ -387,7 +387,19 @@ class NativeInterface {
    }

    private void onInBandRing(int inBand, byte[] address) {
        Log.w(TAG, "onInBandRing not supported");
        StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_IN_BAND_RINGTONE);
        event.valueInt = inBand;
        event.device = getDevice(address);
        if (DBG) {
            Log.d(TAG, "onInBandRing: address " + address + " event " + event);
        }
        HeadsetClientService service = HeadsetClientService.getHeadsetClientService();
        if (service != null) {
            service.messageFromNative(event);
        } else {
            Log.w(TAG,
                    "onInBandRing: Ignoring message because service not available: " + event);
        }
    }

    private void onLastVoiceTagNumber(String number, byte[] address) {
+8 −7
Original line number Diff line number Diff line
@@ -38,13 +38,14 @@ public class StackEvent {
    public static final int EVENT_TYPE_CALL = 9;
    public static final int EVENT_TYPE_CALLSETUP = 10;
    public static final int EVENT_TYPE_CALLHELD = 11;
    public static final int EVENT_TYPE_CLIP = 12;
    public static final int EVENT_TYPE_CALL_WAITING = 13;
    public static final int EVENT_TYPE_CURRENT_CALLS = 14;
    public static final int EVENT_TYPE_VOLUME_CHANGED = 15;
    public static final int EVENT_TYPE_CMD_RESULT = 16;
    public static final int EVENT_TYPE_SUBSCRIBER_INFO = 17;
    public static final int EVENT_TYPE_RESP_AND_HOLD = 18;
    public static final int EVENT_TYPE_RESP_AND_HOLD = 12;
    public static final int EVENT_TYPE_CLIP = 13;
    public static final int EVENT_TYPE_CALL_WAITING = 14;
    public static final int EVENT_TYPE_CURRENT_CALLS = 15;
    public static final int EVENT_TYPE_VOLUME_CHANGED = 16;
    public static final int EVENT_TYPE_CMD_RESULT = 17;
    public static final int EVENT_TYPE_SUBSCRIBER_INFO = 18;
    public static final int EVENT_TYPE_IN_BAND_RINGTONE = 19;
    public static final int EVENT_TYPE_RING_INDICATION = 21;

    public int type = EVENT_TYPE_NONE;
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ public class HfpClientDeviceBlock {
                    || call.getState() == BluetoothHeadsetClientCall.CALL_STATE_WAITING) {
                // This is an incoming call.
                b.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_EXTRAS, call);
                b.putBoolean(TelecomManager.EXTRA_CALL_EXTERNAL_RINGER, call.isInBandRing());
                mTelecomManager.addNewIncomingCall(mPhoneAccount.getAccountHandle(), b);
            }
        } else if (call.getState() == BluetoothHeadsetClientCall.CALL_STATE_TERMINATED) {
Loading