예제 #1
0
  // This method does not check for error conditon (newState == prevState)
  private void broadcastConnectionState(BluetoothDevice device, int newState, int prevState) {

    int delay = mAudioManager.setBluetoothA2dpDeviceConnectionState(device, newState);
    log("broadcastConnectionState delay " + delay + ", StateMachine " + getCurrentState());
    mWakeLock.acquire();
    mIntentBroadcastHandler.sendMessageDelayed(
        mIntentBroadcastHandler.obtainMessage(
            MSG_CONNECTION_STATE_CHANGED, prevState, newState, device),
        delay);
  }
  // This method does not check for error conditon (newState == prevState)
  private void broadcastConnectionState(BluetoothDevice device, int newState, int prevState) {

    int delay = 0;
    if (!USE_AUDIOTRACK)
      delay =
          mAudioManager.setBluetoothA2dpDeviceConnectionState(
              device, newState, BluetoothProfile.A2DP_SINK);

    mWakeLock.acquire();
    mIntentBroadcastHandler.sendMessageDelayed(
        mIntentBroadcastHandler.obtainMessage(
            MSG_CONNECTION_STATE_CHANGED, prevState, newState, device),
        delay);
  }