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

Commit 5adfc552 authored by Gopi Sakshihally Bhuthaiah's avatar Gopi Sakshihally Bhuthaiah
Browse files

Renaming HOGP specific Keys

Bug: 335366054
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT code clean up
Change-Id: I763596f967ed4850f92dd7a482845d6ac0534ab9
parent 8c884637
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -780,19 +780,19 @@ void bta_hh_le_co_rpt_info(const tAclLinkSpec& link_spec,
  std::string addrstr = link_spec.addrt.bda.ToString();
  const char* bdstr = addrstr.c_str();

  size_t len = btif_config_get_bin_length(bdstr, BTIF_STORAGE_KEY_HID_REPORT);
  size_t len = btif_config_get_bin_length(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT);
  if (len >= sizeof(tBTA_HH_RPT_CACHE_ENTRY) && len <= sizeof(sReportCache)) {
    btif_config_get_bin(bdstr, BTIF_STORAGE_KEY_HID_REPORT,
    btif_config_get_bin(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT,
                        (uint8_t*)sReportCache, &len);
    idx = len / sizeof(tBTA_HH_RPT_CACHE_ENTRY);
  }

  if (idx < BTA_HH_NV_LOAD_MAX) {
    memcpy(&sReportCache[idx++], p_entry, sizeof(tBTA_HH_RPT_CACHE_ENTRY));
    btif_config_set_bin(bdstr, BTIF_STORAGE_KEY_HID_REPORT,
    btif_config_set_bin(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT,
                        (const uint8_t*)sReportCache,
                        idx * sizeof(tBTA_HH_RPT_CACHE_ENTRY));
    btif_config_set_int(bdstr, BTIF_STORAGE_KEY_HID_REPORT_VERSION,
    btif_config_set_int(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT_VERSION,
                        BTA_HH_CACHE_REPORT_VERSION);
    log::verbose("Saving report; dev={}, idx={}", link_spec, idx);
  }
@@ -820,15 +820,15 @@ tBTA_HH_RPT_CACHE_ENTRY* bta_hh_le_co_cache_load(const tAclLinkSpec& link_spec,
  std::string addrstr = link_spec.addrt.bda.ToString();
  const char* bdstr = addrstr.c_str();

  size_t len = btif_config_get_bin_length(bdstr, BTIF_STORAGE_KEY_HID_REPORT);
  size_t len = btif_config_get_bin_length(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT);
  if (!p_num_rpt || len < sizeof(tBTA_HH_RPT_CACHE_ENTRY)) return NULL;

  if (len > sizeof(sReportCache)) len = sizeof(sReportCache);
  btif_config_get_bin(bdstr, BTIF_STORAGE_KEY_HID_REPORT,
  btif_config_get_bin(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT,
                      (uint8_t*)sReportCache, &len);

  int cache_version = -1;
  btif_config_get_int(bdstr, BTIF_STORAGE_KEY_HID_REPORT_VERSION,
  btif_config_get_int(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT_VERSION,
                      &cache_version);

  if (cache_version != BTA_HH_CACHE_REPORT_VERSION) {
@@ -859,7 +859,7 @@ void bta_hh_le_co_reset_rpt_cache(const tAclLinkSpec& link_spec,
  std::string addrstr = link_spec.addrt.bda.ToString();
  const char* bdstr = addrstr.c_str();

  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_REPORT);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_REPORT_VERSION);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT_VERSION);
  log::verbose("Reset cache for bda {}", link_spec);
}
+2 −2
Original line number Diff line number Diff line
@@ -332,9 +332,9 @@ bt_status_t btif_storage_remove_hid_info(const tAclLinkSpec& link_spec) {
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_SSR_MAX_LATENCY);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_SSR_MIN_TIMEOUT);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_DESCRIPTOR);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_REPORT);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_REPORT_VERSION);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HID_RECONNECT_ALLOWED);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT);
  btif_config_remove(bdstr, BTIF_STORAGE_KEY_HOGP_REPORT_VERSION);

  if (com::android::bluetooth::flags::allow_switching_hid_and_hogp()) {
    int db_version = 0;
+2 −2
Original line number Diff line number Diff line
@@ -58,8 +58,6 @@
#define BTIF_STORAGE_KEY_HID_DESCRIPTOR "HidDescriptor"
#define BTIF_STORAGE_KEY_HID_DEVICE_CABLED "HidDeviceCabled"
#define BTIF_STORAGE_KEY_HID_PRODUCT_ID "HidProductId"
#define BTIF_STORAGE_KEY_HID_REPORT "HidReport"
#define BTIF_STORAGE_KEY_HID_REPORT_VERSION "HidReportVersion"
#define BTIF_STORAGE_KEY_HID_SSR_MAX_LATENCY "HidSSRMaxLatency"
#define BTIF_STORAGE_KEY_HID_SSR_MIN_TIMEOUT "HidSSRMinTimeout"
#define BTIF_STORAGE_KEY_HID_SUB_CLASS "HidSubClass"
@@ -67,6 +65,8 @@
#define BTIF_STORAGE_KEY_HID_VERSION "HidVersion"
#define BTIF_STORAGE_KEY_HID_DB_VERSION "HidDbVersion"
#define BTIF_STORAGE_KEY_HID_RECONNECT_ALLOWED "HidReConnectAllowed"
#define BTIF_STORAGE_KEY_HOGP_REPORT "HidReport"
#define BTIF_STORAGE_KEY_HOGP_REPORT_VERSION "HidReportVersion"
#define BTIF_STORAGE_KEY_HOGP_RECONNECT_ALLOWED "HogpReConnectAllowed"
#define BTIF_STORAGE_KEY_HOGP_APP_ID "HogpAppId"
#define BTIF_STORAGE_KEY_HOGP_ATTR_MASK "HogpAttrMask"