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

Commit 6af3053f authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes I8f61001c,I52dafb82,I79d5fec6,I344fe614,I8c96c500, ... into main

* changes:
  Remove unused function gatt_num_clcb_by_bd_addr
  Remove unused functions btsock_thread_post_cmd, btsock_thread_remove_fd_and_close
  Remove unused legacy HCI command serializers
  Remove unused function btm_read_link_quality_timeout
  Remove unused function btm_queue_start_sync_req
  Remove unused function BTM_IsAclConnectionUpFromHandle
  Remove unused function btm_is_sco_active
  Remove unused functions btm_inq_db_init, btm_inq_db_free
  Remove unused function btm_dev_support_role_switch
  Remove unused module BtifConfigCache
  Remove debug function btif_debug_config_dump
parents bd306bab 6ba42076
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -131,9 +131,6 @@
    {
      "name": "net_test_btcore"
    },
    {
      "name": "net_test_btif_config_cache"
    },
    {
      "name": "net_test_btif_hh"
    },
@@ -294,9 +291,6 @@
    {
      "name": "net_test_avrcp"
    },
    {
      "name": "net_test_btif_config_cache"
    },
    {
      "name": "net_test_btpackets"
    },
+0 −45
Original line number Diff line number Diff line
@@ -187,7 +187,6 @@ cc_library_static {
        "src/btif_ble_scanner.cc",
        "src/btif_bqr.cc",
        "src/btif_config.cc",
        "src/btif_config_cache.cc",
        "src/btif_core.cc",
        "src/btif_debug_conn.cc",
        "src/btif_dm.cc",
@@ -499,50 +498,6 @@ cc_test {
    },
}

// btif config cache unit tests for target
cc_test {
    name: "net_test_btif_config_cache",
    defaults: [
        "fluoride_defaults",
        "mts_defaults",
    ],
    test_suites: ["general-tests"],
    host_supported: true,
    test_options: {
        unit_test: true,
    },
    include_dirs: btifCommonIncludes,
    srcs: [
        "src/btif_config_cache.cc",
        "test/btif_config_cache_test.cc",
    ],
    header_libs: ["libbluetooth_headers"],
    shared_libs: [
        "libbase",
        "libbinder_ndk",
        "libcrypto",
        "libcutils",
        "liblog",
    ],
    static_libs: [
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_log",
        "libbt_shim_bridge",
        "libc++fs",
        "libchrome",
        "libgmock",
        "libosi",
    ],
    target: {
        android: {
            static_libs: [
                "android.system.suspend.control-V1-ndk",
            ],
        },
    },
}

// btif hf client service tests for target
cc_test {
    name: "net_test_btif_hf_client_service",
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ static_library("btif") {
    "src/btif_bqr.cc",
    "src/btif_csis_client.cc",
    "src/btif_config.cc",
    "src/btif_config_cache.cc",
    "src/btif_core.cc",
    "src/btif_debug_conn.cc",
    "src/btif_dm.cc",
+0 −1
Original line number Diff line number Diff line
@@ -58,6 +58,5 @@ size_t btif_config_get_bin_length(const std::string& section,
std::vector<RawAddress> btif_config_get_paired_devices();

bool btif_config_clear(void);
void btif_debug_config_dump(int fd);
bool btif_get_device_clockoffset(const RawAddress& bda, int* p_clock_offset);
bool btif_set_device_clockoffset(const RawAddress& bda, int clock_offset);
+0 −58
Original line number Diff line number Diff line
/*
 *  Copyright 2020 The Android Open Source Project
 *
 *  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.
 */

#pragma once

#include <vector>

#include "common/lru.h"
#include "osi/include/config.h"

class BtifConfigCache {
 public:
  explicit BtifConfigCache(size_t capacity);
  ~BtifConfigCache();

  void Clear();
  void Init(std::unique_ptr<config_t> source);
  std::vector<std::string> GetPersistentSectionNames();
  config_t PersistentSectionCopy();
  bool HasSection(const std::string& section_name);
  bool HasUnpairedSection(const std::string& section_name);
  bool HasPersistentSection(const std::string& section_name);
  bool HasKey(const std::string& section_name, const std::string& key);
  bool RemoveKey(const std::string& section_name, const std::string& key);
  void RemovePersistentSectionsWithKey(const std::string& key);

  // Setters and getters
  void SetString(std::string section_name, std::string key, std::string value);
  std::optional<std::string> GetString(const std::string& section_name,
                                       const std::string& key);
  void SetInt(std::string section_name, std::string key, int value);
  std::optional<int> GetInt(const std::string& section_name,
                            const std::string& key);
  void SetUint64(std::string section_name, std::string key, uint64_t value);
  std::optional<uint64_t> GetUint64(const std::string& section_name,
                                    const std::string& key);
  void SetBool(std::string section_name, std::string key, bool value);
  std::optional<bool> GetBool(const std::string& section_name,
                              const std::string& key);

 private:
  bluetooth::common::LegacyLruCache<std::string, section_t>
      unpaired_devices_cache_;
  config_t paired_devices_list_;
};
Loading