diff options
author | Andre Eisenbach <eisenbach@google.com> | 2015-04-20 21:46:37 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-04-21 21:25:52 -0700 |
commit | 98b744f270323db14705c1251bc7bc89d196e16d (patch) | |
tree | 98408a73adf9ca3b3a83ef61d57527428266d8a0 | |
parent | a9962ce69ef78a4720183c70deb5db8cfbc70cf0 (diff) | |
download | android_system_bt-98b744f270323db14705c1251bc7bc89d196e16d.tar.gz android_system_bt-98b744f270323db14705c1251bc7bc89d196e16d.tar.bz2 android_system_bt-98b744f270323db14705c1251bc7bc89d196e16d.zip |
Fix A2DP source double initialization problem
Fixed a problem where A2DP source was initialized twice. Once before
btif was properly initialize and then a second time when the JNI
requests A2DP to be initialized, which would then fail.
Change-Id: Ia5f10a5bda344fe3bd66818a302b6b3f9db32a20
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | btif/src/btif_av.c | 36 | ||||
-rw-r--r-- | btif/src/btif_core.c | 3 | ||||
-rw-r--r-- | btif/src/btif_pan.c | 3 |
4 files changed, 9 insertions, 34 deletions
diff --git a/Android.mk b/Android.mk index a331f19ff..c5d3d1678 100644 --- a/Android.mk +++ b/Android.mk @@ -19,7 +19,6 @@ endif bdroid_CFLAGS += \ -Wall \ -# -Werror \ -Wno-unused-parameter \ -Wunused-but-set-variable \ -UNDEBUG \ diff --git a/btif/src/btif_av.c b/btif/src/btif_av.c index 5bec9450e..cbd39aa7a 100644 --- a/btif/src/btif_av.c +++ b/btif/src/btif_av.c @@ -98,7 +98,7 @@ typedef struct ******************************************************************************/ static btav_callbacks_t *bt_av_src_callbacks = NULL; static btav_callbacks_t *bt_av_sink_callbacks = NULL; -static btif_av_cb_t btif_av_cb; +static btif_av_cb_t btif_av_cb = {0}; static TIMER_LIST_ENT tle_av_open_on_rc; /* both interface and media task needs to be ready to alloc incoming request */ @@ -904,11 +904,9 @@ bt_status_t btif_av_init() btif_sm_init((const btif_sm_handler_t*)btif_av_state_handlers, BTIF_AV_STATE_IDLE); btif_a2dp_on_init(); - - return BT_STATUS_SUCCESS; } - return BT_STATUS_DONE; + return BT_STATUS_SUCCESS; } /******************************************************************************* @@ -923,20 +921,11 @@ bt_status_t btif_av_init() static bt_status_t init_src(btav_callbacks_t* callbacks) { - bt_status_t status; - - BTIF_TRACE_EVENT("%s", __FUNCTION__); - - if (bt_av_sink_callbacks != NULL) { - // already did btif_av_init() - status = BT_STATUS_SUCCESS; - } else { - status = btif_av_init(); - } + BTIF_TRACE_EVENT("%s()", __func__); - if (status == BT_STATUS_SUCCESS) { + bt_status_t status = btif_av_init(); + if (status == BT_STATUS_SUCCESS) bt_av_src_callbacks = callbacks; - } return status; } @@ -953,20 +942,11 @@ static bt_status_t init_src(btav_callbacks_t* callbacks) static bt_status_t init_sink(btav_callbacks_t* callbacks) { - bt_status_t status; - - BTIF_TRACE_EVENT("%s", __FUNCTION__); + BTIF_TRACE_EVENT("%s()", __func__); - if (bt_av_src_callbacks != NULL) { - // already did btif_av_init() - status = BT_STATUS_SUCCESS; - } else { - status = btif_av_init(); - } - - if (status == BT_STATUS_SUCCESS) { + bt_status_t status = btif_av_init(); + if (status == BT_STATUS_SUCCESS) bt_av_sink_callbacks = callbacks; - } return status; } diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c index 99d7ad441..62d22e183 100644 --- a/btif/src/btif_core.c +++ b/btif/src/btif_core.c @@ -506,9 +506,6 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status) /* callback to HAL */ if (status == BTA_SUCCESS) { - /* initialize a2dp service */ - btif_av_init(); - /* init rfcomm & l2cap api */ btif_sock_init(); diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c index 80196365f..8fe03bb49 100644 --- a/btif/src/btif_pan.c +++ b/btif/src/btif_pan.c @@ -172,8 +172,7 @@ static btpan_callbacks_t callback; static bt_status_t btpan_jni_init(const btpan_callbacks_t* callbacks) { BTIF_TRACE_DEBUG("stack_initialized = %d, btpan_cb.enabled:%d", stack_initialized, btpan_cb.enabled); - jni_initialized = TRUE; - if(stack_initialized && !btpan_cb.enabled) + if (stack_initialized && !btpan_cb.enabled) btif_pan_init(); callback = *callbacks; return BT_STATUS_SUCCESS; |