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

Commit f2e6b136 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Add APIs for starting and stopping a virtual call.

This API is useful for cases where the user wants to play
their voicemail, for example, through their Bluetooth headsets.

Original Change by: kausik@broadcom.com

Change-Id: I6bc8929c359d698a1bacdefab4425e3a0ac5d8dd
parent de04e524
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -621,6 +621,51 @@ public final class BluetoothHeadset implements BluetoothProfile {
        return BluetoothHeadset.STATE_AUDIO_DISCONNECTED;
    }

    /**
     * Initiates a Virtual Voice Call to the handsfree device (if connected).
     * Allows the handsfree device to be used for routing non-cellular call audio
     *
     * @param device Remote Bluetooth Device
     * @return true if successful, false if there was some error.
     * @hide
     */
    public boolean startVirtualVoiceCall(BluetoothDevice device) {
        if (DBG) log("startVirtualVoiceCall()");
        if (mService != null && isEnabled() && isValidDevice(device)) {
            try {
                return mService.startVirtualVoiceCall(device);
            } catch (RemoteException e) {
                Log.e(TAG, e.toString());
            }
        } else {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
        }
        return false;
    }

    /**
     * Terminates an ongoing Virtual Voice Call to the handsfree device (if connected).
     *
     * @param device Remote Bluetooth Device
     * @return true if successful, false if there was some error.
     * @hide
     */
    public boolean stopVirtualVoiceCall(BluetoothDevice device) {
        if (DBG) log("stopVirtualVoiceCall()");
        if (mService != null && isEnabled() && isValidDevice(device)) {
            try {
                return mService.stopVirtualVoiceCall(device);
            } catch (RemoteException e) {
                Log.e(TAG, e.toString());
            }
        } else {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
        }
        return false;
    }

    private ServiceConnection mConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName className, IBinder service) {
            if (DBG) Log.d(TAG, "Proxy object connected");
+3 −0
Original line number Diff line number Diff line
@@ -47,4 +47,7 @@ interface IBluetoothHeadset {
    boolean disconnectHeadsetInternal(in BluetoothDevice device);
    boolean setAudioState(in BluetoothDevice device, int state);
    int getAudioState(in BluetoothDevice device);

    boolean startVirtualVoiceCall(in BluetoothDevice device);
    boolean stopVirtualVoiceCall(in BluetoothDevice device);
}