BA: Support for HIDL2.0
- BA support for hidl2.0 with active device api changes.
- BA ack path changes for hidl2.0
CRs-Fixed: 2442862
Change-Id: Iff685b228f62fd5c1cab79a6c1b29f5e05bb553c
diff --git a/packages_apps_bluetooth_ext/src/ba/BATService.java b/packages_apps_bluetooth_ext/src/ba/BATService.java
index 1cd459f..9d20265 100644
--- a/packages_apps_bluetooth_ext/src/ba/BATService.java
+++ b/packages_apps_bluetooth_ext/src/ba/BATService.java
@@ -88,7 +88,7 @@
public static final int MESSAGE_BAT_STREAMING_ID_EVT = 104;
private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH;
- public static final String mBAAddress = "FA:CE:FA:CE:FA:CE";
+ public static final String mBAAddress = "CE:FA:CE:FA:CE:FA";
public static BluetoothDevice mBADevice;
// we will listen for vol change intent from audio manager.
// this intent is called in all following 3 cases
@@ -452,13 +452,8 @@
// check for transition from PENDING to PAUSED
if((mPrevStackBATState == BA_STACK_STATE_PENDING) &&
(mCurrStackBATState == BA_STACK_STATE_PAUSED)) {
- if (a2dpActiveDevice != null) {
- Log.d(TAG," updating AudioManager: Disconnect for A2dp ");
- mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
- a2dpActiveDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.A2DP,
- true, -1);
- }
- mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+ Log.d(TAG," updating AudioManager: Connected for BA ");
+ mAudioManager.handleBluetoothA2dpActiveDeviceChange(
mBADevice, BluetoothProfile.STATE_CONNECTED,BluetoothProfile.A2DP, true, -1);
//BA audio works on the principal of absVol
//Currently mm-audio tracks value of last updated absVol support,
@@ -475,18 +470,14 @@
// inform BA device as disconnected, don't send noisy intent
// as a2dp has to be updated as well. Switching should happen to
// A2DP in this case.
- Log.d(TAG," updating AudioManager: DisConnected for BA ");
- mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
- mBADevice, BluetoothProfile.STATE_DISCONNECTED,BluetoothProfile.A2DP,
- true, -1);
Log.d(TAG," updating AudioManager: Connected for A2DP ");
- mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+ mAudioManager.handleBluetoothA2dpActiveDeviceChange(
a2dpActiveDevice, BluetoothProfile.STATE_CONNECTED,BluetoothProfile.A2DP,
true, -1);
} else {// a2dp active device is null.
// inform BA device as disconnected. we have to send noisy intent
// because BA seems to be last device.
- mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
+ mAudioManager.handleBluetoothA2dpActiveDeviceChange(
mBADevice, BluetoothProfile.STATE_DISCONNECTED,BluetoothProfile.A2DP,
false, -1);
}
diff --git a/system_bt_ext/btif/include/btif_bat.h b/system_bt_ext/btif/include/btif_bat.h
index 29166dd..3b8d635 100644
--- a/system_bt_ext/btif/include/btif_bat.h
+++ b/system_bt_ext/btif/include/btif_bat.h
@@ -48,6 +48,17 @@
******************************************************************************/
typedef enum {
+ BA_CTRL_ACK_SUCCESS,
+ BA_CTRL_ACK_FAILURE,
+ BA_CTRL_ACK_INCALL_FAILURE, /* Failure when in Call*/
+ BA_CTRL_ACK_UNSUPPORTED,
+ BA_CTRL_ACK_PENDING,
+ BA_CTRL_ACK_DISCONNECT_IN_PROGRESS,
+ BA_CTRL_SKT_DISCONNECTED,
+ BA_CTRL_ACK_UNKNOWN,
+} tBA_CTRL_ACK;
+
+typedef enum {
BTIF_BA_STATE_IDLE_AUDIO_PENDING = 0,
BTIF_BA_STATE_IDLE_AUDIO_STREAMING,
BTIF_BA_STATE_IDLE_AUDIO_NS,
@@ -123,6 +134,14 @@
void ba_send_message(uint8_t event, uint8_t size, char* ptr, bool is_btif_thread);
uint16_t btif_get_ba_latency();
bool btif_ba_is_active();
+uint8_t btif_ba_get_sample_rate();
+uint8_t btif_ba_get_channel_mode();
+uint8_t btif_ba_get_frame_size();
+uint8_t btif_ba_get_complexity();
+uint8_t btif_ba_get_prediction_mode();
+uint8_t btif_ba_get_vbr_flag();
+uint32_t btif_ba_get_bitrate();
+
/*
uint8_t get_curr_vol_level();
uint8_t get_max_vol_level();
diff --git a/system_bt_ext/btif/src/btif_ba.cc b/system_bt_ext/btif/src/btif_ba.cc
index c96fa8b..4ee9219 100644
--- a/system_bt_ext/btif/src/btif_ba.cc
+++ b/system_bt_ext/btif/src/btif_ba.cc
@@ -32,7 +32,7 @@
#include <string.h>
#define LOG_TAG "bt_btif_vendor"
-
+#include "btif_a2dp.h"
#include <cutils/properties.h>
#include "bt_utils.h"
#include "btif_common.h"
@@ -52,17 +52,6 @@
#include "btif_av.h"
#include "btif_config.h"
-typedef enum {
- BA_CTRL_ACK_SUCCESS,
- BA_CTRL_ACK_FAILURE,
- BA_CTRL_ACK_INCALL_FAILURE, /* Failure when in Call*/
- BA_CTRL_ACK_UNSUPPORTED,
- BA_CTRL_ACK_PENDING,
- BA_CTRL_ACK_DISCONNECT_IN_PROGRESS,
- BA_CTRL_SKT_DISCONNECTED,
- BA_CTRL_ACK_UNKNOWN,
-} tBA_CTRL_ACK;
-
extern void btif_av_trigger_suspend();
static ba_transmitter_callbacks_t *ba_transmitter_callback = NULL;
@@ -264,11 +253,13 @@
bool btif_ba_is_active()
{
- LOG_INFO(LOG_TAG,"%s:",__func__);
+ bool ret = false;
if (btif_ba_get_state() > BTIF_BA_STATE_IDLE_AUDIO_NS)
- return true;
+ ret = true;
else
- return false;
+ ret = false;
+ LOG_INFO(LOG_TAG,"%s: %d",__func__, ret);
+ return ret;
}
btif_ba_state_t btif_ba_get_state()
@@ -323,11 +314,11 @@
{
if ( btif_ba_cb.audio_cmd_pending == BTIF_BA_AUDIO_PAUSE_REQ_EVT)
{
- btif_a2dp_audio_on_suspended(result);
+ btif_ba_audio_on_suspended(result);
}
else if ( btif_ba_cb.audio_cmd_pending == BTIF_BA_AUDIO_STOP_REQ_EVT)
{
- btif_a2dp_audio_on_stopped(result);
+ btif_ba_audio_on_stopped(result);
}
else
{
@@ -338,7 +329,7 @@
{
if ( btif_ba_cb.audio_cmd_pending == BTIF_BA_AUDIO_START_REQ_EVT)
{
- btif_a2dp_audio_on_started(result);
+ btif_ba_audio_on_started(result);
}
else
{
@@ -372,6 +363,41 @@
*p_codec_config = bit_rate;p_codec_config ++;
}
+uint8_t btif_ba_get_sample_rate()
+{
+ return btif_ba_cb.sampl_freq;
+}
+
+uint8_t btif_ba_get_channel_mode()
+{
+ return btif_ba_cb.ch_mode;
+}
+
+uint8_t btif_ba_get_frame_size()
+{
+ return btif_ba_cb.frame_size;
+}
+
+uint8_t btif_ba_get_complexity()
+{
+ return btif_ba_cb.complexity;
+}
+
+uint8_t btif_ba_get_prediction_mode()
+{
+ return btif_ba_cb.prediction_mode;
+}
+
+uint8_t btif_ba_get_vbr_flag()
+{
+ return btif_ba_cb.vbr_mode;
+}
+
+uint32_t btif_ba_get_bitrate()
+{
+ return btif_ba_cb.bit_rate;
+}
+
static void memorize_msg(uint8_t event, btif_ba_state_t state)
{
BTIF_TRACE_DEBUG(" %s event = %s, state = %d", __FUNCTION__,