Get rid of BTA_JV specific events
Bug: 68359837
Test: compilation test
Change-Id: I4273bc1bed2cef676ab1ed026ac8a0fa3ffbada9
diff --git a/system/bta/Android.bp b/system/bta/Android.bp
index 0a421fc..eaa3564 100644
--- a/system/bta/Android.bp
+++ b/system/bta/Android.bp
@@ -92,7 +92,6 @@
"jv/bta_jv_act.cc",
"jv/bta_jv_api.cc",
"jv/bta_jv_cfg.cc",
- "jv/bta_jv_main.cc",
"mce/bta_mce_act.cc",
"mce/bta_mce_api.cc",
"mce/bta_mce_cfg.cc",
diff --git a/system/bta/BUILD.gn b/system/bta/BUILD.gn
index 6ab7218..db19966 100644
--- a/system/bta/BUILD.gn
+++ b/system/bta/BUILD.gn
@@ -75,7 +75,6 @@
"jv/bta_jv_act.cc",
"jv/bta_jv_api.cc",
"jv/bta_jv_cfg.cc",
- "jv/bta_jv_main.cc",
"mce/bta_mce_act.cc",
"mce/bta_mce_api.cc",
"mce/bta_mce_cfg.cc",
diff --git a/system/bta/jv/bta_jv_act.cc b/system/bta/jv/bta_jv_act.cc
index d559304..51528a8 100644
--- a/system/bta/jv/bta_jv_act.cc
+++ b/system/bta/jv/bta_jv_act.cc
@@ -51,6 +51,8 @@
using bluetooth::Uuid;
+tBTA_JV_CB bta_jv_cb;
+
/* one of these exists for each client */
struct fc_client {
struct fc_client* next_all_list;
diff --git a/system/bta/jv/bta_jv_api.cc b/system/bta/jv/bta_jv_api.cc
index c20f378..7e972fa 100644
--- a/system/bta/jv/bta_jv_api.cc
+++ b/system/bta/jv/bta_jv_api.cc
@@ -40,11 +40,9 @@
using base::Bind;
using bluetooth::Uuid;
-/*****************************************************************************
- * Constants
- ****************************************************************************/
-
-static const tBTA_SYS_REG bta_jv_reg = {bta_jv_sm_execute, NULL};
+namespace {
+bool bta_jv_enabled = false;
+}
/*******************************************************************************
*
@@ -61,35 +59,30 @@
*
******************************************************************************/
tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK* p_cback) {
- tBTA_JV_STATUS status = BTA_JV_FAILURE;
- int i;
+ if (!p_cback || bta_jv_enabled) {
+ APPL_TRACE_ERROR("JVenable fails");
+ return BTA_JV_FAILURE;
+ }
APPL_TRACE_API("BTA_JvEnable");
- if (p_cback && !bta_sys_is_register(BTA_ID_JV)) {
- memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB));
- /* set handle to invalid value by default */
- for (i = 0; i < BTA_JV_PM_MAX_NUM; i++) {
- bta_jv_cb.pm_cb[i].handle = BTA_JV_PM_HANDLE_CLEAR;
- }
- /* register with BTA system manager */
- bta_sys_register(BTA_ID_JV, &bta_jv_reg);
-
- if (p_cback) {
- do_in_bta_thread(FROM_HERE, Bind(&bta_jv_enable, p_cback));
- status = BTA_JV_SUCCESS;
- }
- } else {
- APPL_TRACE_ERROR("JVenable fails");
+ memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB));
+ /* set handle to invalid value by default */
+ for (int i = 0; i < BTA_JV_PM_MAX_NUM; i++) {
+ bta_jv_cb.pm_cb[i].handle = BTA_JV_PM_HANDLE_CLEAR;
}
- return (status);
+
+ bta_jv_enabled = true;
+
+ do_in_bta_thread(FROM_HERE, Bind(&bta_jv_enable, p_cback));
+ return BTA_JV_SUCCESS;
}
/** Disable the Java I/F */
void BTA_JvDisable(void) {
APPL_TRACE_API("%s", __func__);
- bta_sys_deregister(BTA_ID_JV);
+ bta_jv_enabled = false;
do_in_bta_thread(FROM_HERE, Bind(&bta_jv_disable));
}
diff --git a/system/bta/jv/bta_jv_int.h b/system/bta/jv/bta_jv_int.h
index 56bcabf..9b97a5a 100644
--- a/system/bta/jv/bta_jv_int.h
+++ b/system/bta/jv/bta_jv_int.h
@@ -36,11 +36,6 @@
* Constants
****************************************************************************/
-enum {
- /* these events are handled by the state machine */
- BTA_JV_MAX_INT_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
-};
-
#ifndef BTA_JV_RFC_EV_MASK
#define BTA_JV_RFC_EV_MASK \
(PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_FC | PORT_EV_FCS)
@@ -111,24 +106,6 @@
int curr_sess; /* current sessions count*/
} tBTA_JV_RFC_CB;
-/* data type for BTA_JV_API_L2CAP_READ_EVT */
-typedef struct {
- BT_HDR hdr;
- uint32_t handle;
- uint32_t req_id;
- tBTA_JV_L2CAP_CBACK* p_cback;
- uint8_t* p_data;
- uint16_t len;
- uint32_t l2cap_socket_id;
-} tBTA_JV_API_L2CAP_READ;
-
-/* union of all data types */
-typedef union {
- /* GKI event buffer header */
- BT_HDR hdr;
- tBTA_JV_API_L2CAP_READ l2cap_read;
-} tBTA_JV_MSG;
-
/* JV control block */
typedef struct {
/* the SDP handle reported to JV user is the (index + 1) to sdp_handle[].
@@ -162,8 +139,6 @@
/* config struct */
extern tBTA_JV_CFG* p_bta_jv_cfg;
-extern bool bta_jv_sm_execute(BT_HDR* p_msg);
-
extern void bta_jv_enable(tBTA_JV_DM_CBACK* p_cback);
extern void bta_jv_disable();
extern void bta_jv_get_channel_id(int32_t type, int32_t channel,
@@ -209,7 +184,6 @@
tBTA_JV_RFC_CB* p_cb, tBTA_JV_PCB* p_pcb);
extern void bta_jv_set_pm_profile(uint32_t handle, tBTA_JV_PM_ID app_id,
tBTA_JV_CONN_STATE init_st);
-extern void bta_jv_change_pm_state(tBTA_JV_MSG* p_data);
extern void bta_jv_l2cap_connect_le(uint16_t remote_chan,
const RawAddress& peer_bd_addr,
tBTA_JV_L2CAP_CBACK* p_cback,
diff --git a/system/bta/jv/bta_jv_main.cc b/system/bta/jv/bta_jv_main.cc
deleted file mode 100644
index 6dfff4f..0000000
--- a/system/bta/jv/bta_jv_main.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2012 Broadcom Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * This is the main implementation file for the BTA Java I/F
- *
- ******************************************************************************/
-
-#include "bta_api.h"
-#include "bta_jv_api.h"
-#include "bta_jv_int.h"
-#include "bta_sys.h"
-
-/*****************************************************************************
- * Constants and types
- ****************************************************************************/
-
-tBTA_JV_CB bta_jv_cb;
-
-/* state machine action enumeration list */
-#define BTA_JV_NUM_ACTIONS (BTA_JV_MAX_INT_EVT & 0x00ff)
-
-/* type for action functions */
-typedef void (*tBTA_JV_ACTION)(tBTA_JV_MSG* p_data);
-
-/* action function list */
-const tBTA_JV_ACTION bta_jv_action[] = {
-};
-
-/*******************************************************************************
- *
- * Function bta_jv_sm_execute
- *
- * Description State machine event handling function for JV
- *
- *
- * Returns void
- *
- ******************************************************************************/
-bool bta_jv_sm_execute(BT_HDR* p_msg) {
- bool ret = false;
- uint16_t action = (p_msg->event & 0x00ff);
- /* execute action functions */
-
- if (action < BTA_JV_NUM_ACTIONS) {
- (*bta_jv_action[action])((tBTA_JV_MSG*)p_msg);
- ret = true;
- }
-
- return (ret);
-}