Revert "Check whether local device is an ATV device to determine..."
Revert "Pass in extra param as signature of bluetooth init metho..."
Revert submission 12287594-bt-gatt-tv-fix
Reason for revert: Regression in pairing some BLE devices (b/162903202)
Reverted Changes:
If923f2abc:Pass in extra param as signature of bluetooth init...
I6d06f5996:Check whether local device is an ATV device to det...
Ib7575ff3d:Pass whether the local device is an atv device to ...
Bug: 157038281
Test: Manual
Change-Id: I061e32be6570b52a8733be9cc71f6b169087266b
(cherry picked from commit f69198f0d190be3400a3908c0070842b4a8185a7)
diff --git a/btif/include/btif_api.h b/btif/include/btif_api.h
index f9b8886..31c5e77 100644
--- a/btif/include/btif_api.h
+++ b/btif/include/btif_api.h
@@ -134,18 +134,6 @@
/*******************************************************************************
*
- * Function is_atv_device
- *
- * Description Returns true if the local device is an Android TV
- * device, false if it is not.
- *
- * Returns bool
- *
- ******************************************************************************/
-bool is_atv_device(void);
-
-/*******************************************************************************
- *
* Function btif_get_adapter_properties
*
* Description Fetches all local adapter properties
diff --git a/btif/src/bluetooth.cc b/btif/src/bluetooth.cc
index a00c0c6..0187b1d 100644
--- a/btif/src/bluetooth.cc
+++ b/btif/src/bluetooth.cc
@@ -88,7 +88,6 @@
bool niap_mode = false;
const int CONFIG_COMPARE_ALL_PASS = 0b11;
int niap_config_compare_result = CONFIG_COMPARE_ALL_PASS;
-bool is_local_device_atv = false;
/*******************************************************************************
* Externs
@@ -141,7 +140,7 @@
****************************************************************************/
static int init(bt_callbacks_t* callbacks, bool start_restricted,
- bool is_niap_mode, int config_compare_result, bool is_atv) {
+ bool is_niap_mode, int config_compare_result) {
LOG_INFO(LOG_TAG,
"%s: start restricted = %d ; niap = %d, config compare result = %d",
__func__, start_restricted, is_niap_mode, config_compare_result);
@@ -162,7 +161,6 @@
restricted_mode = start_restricted;
niap_mode = is_niap_mode;
niap_config_compare_result = config_compare_result;
- is_local_device_atv = is_atv;
stack_manager_get_interface()->init_stack();
btif_debug_init();
@@ -193,8 +191,6 @@
return niap_mode ? niap_config_compare_result : CONFIG_COMPARE_ALL_PASS;
}
-bool is_atv_device() { return is_local_device_atv; }
-
static int get_adapter_properties(void) {
/* sanity check */
if (!interface_ready()) return BT_STATUS_NOT_READY;
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 4251005..8ac32b2 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -473,10 +473,9 @@
* The |is_niap_mode| flag inits the adapter in NIAP mode.
* The |config_compare_result| flag show the config checksum check result if
* is in NIAP mode.
- * The |is_atv| flag indicates whether the local device is an Android TV
*/
int (*init)(bt_callbacks_t* callbacks, bool guest_mode, bool is_niap_mode,
- int config_compare_result, bool is_atv);
+ int config_compare_result);
/** Enable Bluetooth. */
int (*enable)();
diff --git a/service/hal/bluetooth_interface.cc b/service/hal/bluetooth_interface.cc
index 42eeb00..8043785 100644
--- a/service/hal/bluetooth_interface.cc
+++ b/service/hal/bluetooth_interface.cc
@@ -254,7 +254,7 @@
// Initialize the Bluetooth interface. Set up the adapter (Bluetooth DM) API
// callbacks.
- status = hal_iface_->init(&bt_callbacks, false, false, 0, false);
+ status = hal_iface_->init(&bt_callbacks, false, false, 0);
if (status != BT_STATUS_SUCCESS) {
LOG(ERROR) << "Failed to initialize Bluetooth stack";
return false;
diff --git a/stack/smp/smp_act.cc b/stack/smp/smp_act.cc
index 22d9958..1239542 100644
--- a/stack/smp/smp_act.cc
+++ b/stack/smp/smp_act.cc
@@ -19,7 +19,6 @@
#include <cutils/log.h>
#include <log/log.h>
#include <string.h>
-#include "btif_api.h"
#include "btif_common.h"
#include "btif_storage.h"
#include "device/include/interop.h"
@@ -1302,9 +1301,8 @@
smp_int_data.status = SMP_PAIR_AUTH_FAIL;
int_evt = SMP_AUTH_CMPL_EVT;
} else {
- if (!is_atv_device() &&
- (p_cb->local_io_capability == SMP_IO_CAP_IO ||
- p_cb->local_io_capability == SMP_IO_CAP_KBDISP)) {
+ if (p_cb->local_io_capability != SMP_IO_CAP_NONE &&
+ p_cb->local_io_capability != SMP_IO_CAP_IN) {
/* display consent dialog if this device has a display */
SMP_TRACE_DEBUG("ENCRYPTION_ONLY showing Consent Dialog");
p_cb->cb_evt = SMP_CONSENT_REQ_EVT;
@@ -1658,9 +1656,8 @@
}
if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_JUSTWORKS) {
- if (!is_atv_device() &&
- (p_cb->local_io_capability == SMP_IO_CAP_IO ||
- p_cb->local_io_capability == SMP_IO_CAP_KBDISP)) {
+ if (p_cb->local_io_capability != SMP_IO_CAP_NONE &&
+ p_cb->local_io_capability != SMP_IO_CAP_IN) {
/* display consent dialog */
SMP_TRACE_DEBUG("JUST WORKS showing Consent Dialog");
p_cb->cb_evt = SMP_CONSENT_REQ_EVT;
diff --git a/test/headless/headless.cc b/test/headless/headless.cc
index 9083e9c..4eadcb6 100644
--- a/test/headless/headless.cc
+++ b/test/headless/headless.cc
@@ -141,7 +141,7 @@
void HeadlessStack::SetUp() {
LOG(INFO) << __func__ << " Entry";
- int status = bluetoothInterface.init(&bt_callbacks, false, false, 0, false);
+ int status = bluetoothInterface.init(&bt_callbacks, false, false, 0);
(status == BT_STATUS_SUCCESS)
? LOG(INFO) << __func__ << " Initialized bluetooth callbacks"
: LOG(FATAL) << "Failed to initialize Bluetooth stack";
diff --git a/test/suite/adapter/adapter_unittest.cc b/test/suite/adapter/adapter_unittest.cc
index 85549b0..d68ad0f 100644
--- a/test/suite/adapter/adapter_unittest.cc
+++ b/test/suite/adapter/adapter_unittest.cc
@@ -179,7 +179,7 @@
ASSERT_TRUE(bt_callbacks != nullptr);
for (int i = 0; i < kTestRepeatCount; ++i) {
- bt_interface()->init(bt_callbacks, false, false, 0, false);
+ bt_interface()->init(bt_callbacks, false, false, 0);
EXPECT_EQ(bt_interface()->enable(), BT_STATUS_SUCCESS);
semaphore_wait(adapter_state_changed_callback_sem_);
EXPECT_EQ(GetState(), BT_STATE_ON) << "Adapter did not turn on.";