Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2231c8fb authored by Jack He's avatar Jack He Committed by Android (Google) Code Review
Browse files

Merge "bta_dm: Don't clear scheduled service discovery on BTA_DmSearchCancel()" into tm-qpr-dev

parents 35ea96a5 fd97516c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -5105,6 +5105,8 @@ public class AdapterService extends Service {
    private static final String GATT_ROBUST_CACHING_SERVER_FLAG = "INIT_gatt_robust_caching_server";
    private static final String IRK_ROTATION_FLAG = "INIT_irk_rotation";
    private static final String PASS_PHY_UPDATE_CALLBACK_FLAG = "INIT_pass_phy_update_callback";
    private static final String BTM_DM_FLUSH_DISCOVERY_QUEUE_ON_SEARCH_CANCEL =
                                    "INIT_btm_dm_flush_discovery_queue_on_search_cancel";

    /**
     * Logging flags logic (only applies to DEBUG and VERBOSE levels):
@@ -5172,6 +5174,12 @@ public class AdapterService extends Service {
                DeviceConfig.NAMESPACE_BLUETOOTH, PASS_PHY_UPDATE_CALLBACK_FLAG, true)) {
            initFlags.add(String.format("%s=%s", PASS_PHY_UPDATE_CALLBACK_FLAG, "true"));
        }
        if (DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_BLUETOOTH,
                BTM_DM_FLUSH_DISCOVERY_QUEUE_ON_SEARCH_CANCEL, false)) {
            initFlags.add(String.format("%s=%s",
                    BTM_DM_FLUSH_DISCOVERY_QUEUE_ON_SEARCH_CANCEL, "true"));
        }
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH,
                LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, false)) {
            initFlags.add(String.format("%s=%s", LOGGING_DEBUG_ENABLED_FOR_ALL_FLAG, "true"));
+6 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "btif/include/stack_manager.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "gd/common/init_flags.h"
#include "main/shim/acl_api.h"
#include "main/shim/btm_api.h"
#include "main/shim/dumpsys.h"
@@ -47,6 +48,7 @@
#include "osi/include/fixed_queue.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_ble_int.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
@@ -1515,8 +1517,11 @@ bool bta_dm_is_search_request_queued() {
 ******************************************************************************/
void bta_dm_search_clear_queue() {
  osi_free_and_reset((void**)&bta_dm_search_cb.p_pending_search);
  if (bluetooth::common::InitFlags::
          IsBtmDmFlushDiscoveryQueueOnSearchCancel()) {
    fixed_queue_flush(bta_dm_search_cb.pending_discovery_queue, osi_free);
  }
}

/*******************************************************************************
 *
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ namespace common {
bool InitFlags::logging_debug_enabled_for_all = false;
int InitFlags::hci_adapter = 0;
std::unordered_map<std::string, bool> InitFlags::logging_debug_explicit_tag_settings = {};
bool InitFlags::btm_dm_flush_discovery_queue_on_search_cancel = false;

bool ParseBoolFlag(const std::vector<std::string>& flag_pair, const std::string& flag, bool* variable) {
  if (flag != flag_pair[0]) {
@@ -70,6 +71,11 @@ void InitFlags::Load(const char** flags) {
    // Parse adapter index (defaults to 0)
    ParseIntFlag(flag_pair, "--hci", &hci_adapter);

    ParseBoolFlag(
        flag_pair,
        "INIT_btm_dm_flush_discovery_queue_on_search_cancel",
        &btm_dm_flush_discovery_queue_on_search_cancel);

    ParseBoolFlag(flag_pair, "INIT_logging_debug_enabled_for_all", &logging_debug_enabled_for_all);
    if ("INIT_logging_debug_enabled_for_tags" == flag_pair[0]) {
      auto tags = StringSplit(flag_pair[1], ",");
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ table InitFlagsData {
    gd_controller_enabled:bool (privacy:"Any");
    gd_core_enabled:bool (privacy:"Any");
    btaa_hci_log_enabled:bool (privacy:"Any");
    btm_dm_flush_discovery_queue_on_search_cancel:bool (privacy:"Any");
}

root_type InitFlagsData;
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,10 @@ class InitFlags final {
    return logging_debug_enabled_for_all;
  }

  inline static bool IsBtmDmFlushDiscoveryQueueOnSearchCancel() {
    return btm_dm_flush_discovery_queue_on_search_cancel;
  }

  inline static int GetAdapterIndex() {
    return hci_adapter;
  }
@@ -50,6 +54,7 @@ class InitFlags final {
 private:
  static void SetAll(bool value);
  static bool logging_debug_enabled_for_all;
  static bool btm_dm_flush_discovery_queue_on_search_cancel;
  static int hci_adapter;
  // save both log allow list and block list in the map to save hashing time
  static std::unordered_map<std::string, bool> logging_debug_explicit_tag_settings;
Loading