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

Commit 3b76a4b2 authored by Hemant Gupta's avatar Hemant Gupta Committed by Mike Lockwood
Browse files

Add Support for AVRCP Controller Feature

    - Provide support for AVRCP Controller CAT 1 and CAT 2
    passthrough commands.

Change-Id: Iefbb7fcd6273c49dc8a305b7a25ec6e94c60a5a9
parent 2263dd1d
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -90,6 +90,11 @@ public final class BluetoothA2dp implements BluetoothProfile {
    public static final String ACTION_PLAYING_STATE_CHANGED =
        "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED";

    /** @hide */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_AVRCP_CONNECTION_STATE_CHANGED =
        "android.bluetooth.a2dp.profile.action.AVRCP_CONNECTION_STATE_CHANGED";

    /**
     * A2DP sink device is streaming music. This state can be one of
     * {@link #EXTRA_STATE} or {@link #EXTRA_PREVIOUS_STATE} of
@@ -547,4 +552,34 @@ public final class BluetoothA2dp implements BluetoothProfile {
    private static void log(String msg) {
      Log.d(TAG, msg);
    }

    /** @hide */
    public void sendPassThroughCmd(int keyCode, int keyState) {
        if (DBG) Log.d(TAG, "sendPassThroughCmd");
        if (mService != null && isEnabled()) {
            try {
                mService.sendPassThroughCmd(keyCode, keyState);
                return;
            } catch (RemoteException e) {
                Log.e(TAG, "Error talking to BT service in sendPassThroughCmd()", e);
                return;
            }
        }
        if (mService == null) Log.w(TAG, "Proxy not attached to service");
    }

    /** @hide */
    public boolean isAvrcpConnected(BluetoothDevice device) {
        if (DBG) Log.d(TAG, "isAvrcpConnected");
        if (mService != null && isEnabled()) {
            try {
                return mService.isAvrcpConnected(device);
            } catch (RemoteException e) {
                Log.e(TAG, "Error talking to BT service in isAvrcpConnected()", e);
                return false;
            }
        }
        if (mService == null) Log.w(TAG, "Proxy not attached to service");
        return false;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -36,4 +36,6 @@ interface IBluetoothA2dp {
    oneway void adjustAvrcpAbsoluteVolume(int direction);
    oneway void setAvrcpAbsoluteVolume(int volume);
    boolean isA2dpPlaying(in BluetoothDevice device);
    void sendPassThroughCmd(int keyCode, int keyState);
    boolean isAvrcpConnected(in BluetoothDevice device);
}