Loading system/binder/android/bluetooth/IBluetoothHeadset.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,6 @@ interface IBluetoothHeadset { oneway void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type); void clccResponse(int index, int direction, int status, int mode, boolean mpty, String number, int type); boolean setActiveDevice(in BluetoothDevice device); BluetoothDevice getActiveDevice(); } system/bta/ag/bta_ag_act.cc +9 −1 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* call close call-out */ bta_ag_co_data_close(close.hdr.handle); if (bta_ag_get_active_device() == p_scb->peer_addr) { bta_clear_active_device(); } /* call close cback */ (*bta_ag_cb.p_cback)(BTA_AG_CLOSE_EVT, (tBTA_AG*)&close); Loading Loading @@ -764,7 +768,11 @@ void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, (p_scb->callsetup_ind != BTA_AG_CALLSETUP_NONE)) { bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); } if (bta_ag_get_active_device().IsEmpty()) { tBTA_AG_DATA data = {}; data.api_set_active_device.active_device_addr = p_scb->peer_addr; bta_ag_api_set_active_device(&data); } (*bta_ag_cb.p_cback)(BTA_AG_CONN_EVT, (tBTA_AG*)&evt); } } Loading system/bta/ag/bta_ag_api.cc +11 −0 Original line number Diff line number Diff line Loading @@ -286,3 +286,14 @@ void BTA_AgSetScoAllowed(bool value) { bta_sys_sendmsg(p_buf); } void BTA_AgSetActiveDevice(const RawAddress& active_device_addr) { tBTA_AG_API_SET_ACTIVE_DEVICE* p_buf = (tBTA_AG_API_SET_ACTIVE_DEVICE*)osi_malloc( sizeof(tBTA_AG_API_SET_ACTIVE_DEVICE)); p_buf->hdr.event = BTA_AG_API_SET_ACTIVE_DEVICE_EVT; p_buf->active_device_addr = active_device_addr; bta_sys_sendmsg(p_buf); } system/bta/ag/bta_ag_int.h +11 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ enum { /* these events are handled outside of the state machine */ BTA_AG_API_ENABLE_EVT, BTA_AG_API_DISABLE_EVT, BTA_AG_API_SET_SCO_ALLOWED_EVT BTA_AG_API_SET_SCO_ALLOWED_EVT, BTA_AG_API_SET_ACTIVE_DEVICE_EVT }; /* Actions to perform after a SCO event */ Loading Loading @@ -170,6 +171,11 @@ typedef struct { bool value; } tBTA_AG_API_SET_SCO_ALLOWED; typedef struct { BT_HDR hdr; RawAddress active_device_addr; } tBTA_AG_API_SET_ACTIVE_DEVICE; /* data type for BTA_AG_DISC_RESULT_EVT */ typedef struct { BT_HDR hdr; Loading Loading @@ -197,6 +203,7 @@ typedef union { tBTA_AG_API_RESULT api_result; tBTA_AG_API_SETCODEC api_setcodec; tBTA_AG_API_SET_SCO_ALLOWED api_set_sco_allowed; tBTA_AG_API_SET_ACTIVE_DEVICE api_set_active_device; tBTA_AG_DISC_RESULT disc_result; tBTA_AG_RFC rfc; tBTA_AG_CI_RX_WRITE ci_rx_write; Loading Loading @@ -395,5 +402,8 @@ extern void bta_ag_ci_sco_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_rx_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_rcvd_slc_ready(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_set_sco_allowed(tBTA_AG_DATA* p_data); extern const RawAddress& bta_ag_get_active_device(); extern void bta_clear_active_device(); extern void bta_ag_api_set_active_device(tBTA_AG_DATA* p_data); #endif /* BTA_AG_INT_H */ system/bta/ag/bta_ag_main.cc +4 −0 Original line number Diff line number Diff line Loading @@ -793,6 +793,10 @@ bool bta_ag_hdl_event(BT_HDR* p_msg) { bta_ag_set_sco_allowed((tBTA_AG_DATA*)p_msg); break; case BTA_AG_API_SET_ACTIVE_DEVICE_EVT: bta_ag_api_set_active_device((tBTA_AG_DATA*)p_msg); break; /* all others reference scb by handle */ default: p_scb = bta_ag_scb_by_idx(p_msg->layer_specific); Loading Loading
system/binder/android/bluetooth/IBluetoothHeadset.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,6 @@ interface IBluetoothHeadset { oneway void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type); void clccResponse(int index, int direction, int status, int mode, boolean mpty, String number, int type); boolean setActiveDevice(in BluetoothDevice device); BluetoothDevice getActiveDevice(); }
system/bta/ag/bta_ag_act.cc +9 −1 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* call close call-out */ bta_ag_co_data_close(close.hdr.handle); if (bta_ag_get_active_device() == p_scb->peer_addr) { bta_clear_active_device(); } /* call close cback */ (*bta_ag_cb.p_cback)(BTA_AG_CLOSE_EVT, (tBTA_AG*)&close); Loading Loading @@ -764,7 +768,11 @@ void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, (p_scb->callsetup_ind != BTA_AG_CALLSETUP_NONE)) { bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); } if (bta_ag_get_active_device().IsEmpty()) { tBTA_AG_DATA data = {}; data.api_set_active_device.active_device_addr = p_scb->peer_addr; bta_ag_api_set_active_device(&data); } (*bta_ag_cb.p_cback)(BTA_AG_CONN_EVT, (tBTA_AG*)&evt); } } Loading
system/bta/ag/bta_ag_api.cc +11 −0 Original line number Diff line number Diff line Loading @@ -286,3 +286,14 @@ void BTA_AgSetScoAllowed(bool value) { bta_sys_sendmsg(p_buf); } void BTA_AgSetActiveDevice(const RawAddress& active_device_addr) { tBTA_AG_API_SET_ACTIVE_DEVICE* p_buf = (tBTA_AG_API_SET_ACTIVE_DEVICE*)osi_malloc( sizeof(tBTA_AG_API_SET_ACTIVE_DEVICE)); p_buf->hdr.event = BTA_AG_API_SET_ACTIVE_DEVICE_EVT; p_buf->active_device_addr = active_device_addr; bta_sys_sendmsg(p_buf); }
system/bta/ag/bta_ag_int.h +11 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ enum { /* these events are handled outside of the state machine */ BTA_AG_API_ENABLE_EVT, BTA_AG_API_DISABLE_EVT, BTA_AG_API_SET_SCO_ALLOWED_EVT BTA_AG_API_SET_SCO_ALLOWED_EVT, BTA_AG_API_SET_ACTIVE_DEVICE_EVT }; /* Actions to perform after a SCO event */ Loading Loading @@ -170,6 +171,11 @@ typedef struct { bool value; } tBTA_AG_API_SET_SCO_ALLOWED; typedef struct { BT_HDR hdr; RawAddress active_device_addr; } tBTA_AG_API_SET_ACTIVE_DEVICE; /* data type for BTA_AG_DISC_RESULT_EVT */ typedef struct { BT_HDR hdr; Loading Loading @@ -197,6 +203,7 @@ typedef union { tBTA_AG_API_RESULT api_result; tBTA_AG_API_SETCODEC api_setcodec; tBTA_AG_API_SET_SCO_ALLOWED api_set_sco_allowed; tBTA_AG_API_SET_ACTIVE_DEVICE api_set_active_device; tBTA_AG_DISC_RESULT disc_result; tBTA_AG_RFC rfc; tBTA_AG_CI_RX_WRITE ci_rx_write; Loading Loading @@ -395,5 +402,8 @@ extern void bta_ag_ci_sco_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_rx_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_rcvd_slc_ready(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_set_sco_allowed(tBTA_AG_DATA* p_data); extern const RawAddress& bta_ag_get_active_device(); extern void bta_clear_active_device(); extern void bta_ag_api_set_active_device(tBTA_AG_DATA* p_data); #endif /* BTA_AG_INT_H */
system/bta/ag/bta_ag_main.cc +4 −0 Original line number Diff line number Diff line Loading @@ -793,6 +793,10 @@ bool bta_ag_hdl_event(BT_HDR* p_msg) { bta_ag_set_sco_allowed((tBTA_AG_DATA*)p_msg); break; case BTA_AG_API_SET_ACTIVE_DEVICE_EVT: bta_ag_api_set_active_device((tBTA_AG_DATA*)p_msg); break; /* all others reference scb by handle */ default: p_scb = bta_ag_scb_by_idx(p_msg->layer_specific); Loading