12-12 21:02:16.207 1700 1700 D BluetoothAdapter: wade getProfileProxy12
12-12 21:02:16.207 1700 1700 D BluetoothAdapter: wade new BluetoothAvrcpController
12-12 21:02:16.210 1700 1700 E BluetoothAvrcpController: Could not bind to Bluetooth AVRCP Controller Service with Intent { act=android.bluetooth.IBluetoothAvrcpController }
<!-- If true, we will require location to be enabled on the device to
diff --git a/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java b/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.
index ffe8931..a8bedda 100755
--- a/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
+++ b/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
@@ -35,6 +35,8 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
import android.bluetooth.IBluetooth;
+import android.bluetooth.BluetoothAvrcpController;
+import android.bluetooth.BluetoothAvrcp;
import android.content.Context;
import android.media.AudioFormat;
import android.media.AudioManager;
@@ -106,6 +108,11 @@ final class A2dpSinkStateMachine extends StateMachine {
private final WakeLock mWakeLock;
private static final int MSG_CONNECTION_STATE_CHANGED = 0;
+ public static final int AVRC_ID_PAUSE = 0x46;
+ public static final int KEY_STATE_PRESSED = 0;
+ public static final int KEY_STATE_RELEASED = 1;
+ private BluetoothAvrcpController mAvrcpController;
+ private static final String TAG = "AVRCPa2dpsinktest";
// mCurrentDevice is the device connected before the state changes
// mTargetDevice is the device to be connected
@@ -145,6 +152,7 @@ final class A2dpSinkStateMachine extends StateMachine {
mService = svc;
mContext = context;
mAdapter = BluetoothAdapter.getDefaultAdapter();
+ mAdapter.getProfileProxy(context, mAvrcpServiceListener, BluetoothProfile.AVRCP_CONTROLLER);
initNative();
@@ -312,6 +320,9 @@ final class A2dpSinkStateMachine extends StateMachine {
log("Exit Disconnected: " + getCurrentMessage().what);
}
+
+
+
// in Disconnected state
private void processConnectionEvent(int state, BluetoothDevice device) {
switch (state) {
@@ -670,6 +681,8 @@ final class A2dpSinkStateMachine extends StateMachine {
mAudioManager.requestAudioFocus(mAudioFocusListener, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
audioPlay();
+ Log.d(TAG, "audioPlay now");
+ sendCommand(BluetoothAvrcp.PASSTHROUGH_ID_STOP);
break;
case AUDIO_STATE_REMOTE_SUSPEND:
logd("in remote suspend here do nothing");
@@ -687,6 +700,23 @@ final class A2dpSinkStateMachine extends StateMachine {
}
}