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

Commit b103e31e authored by Henri Chataing's avatar Henri Chataing
Browse files

Remove unused module BtifConfigCache

The cache has been unused since I87db6b3687e252999bfe5459d11b0ee89aac373f
migrated to the new GD storage module

Bug: 331817295
Test: m com.android.btservices
Flag: EXEMPT, dead code removal
Change-Id: Ia88074def71bbb381a4a8769664975a98524207d
parent 15e21745
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 −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_;
};
+0 −4
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
#include <string>
#include <unordered_map>

#include "btif_config_cache.h"
#include "btif_keystore.h"
#include "btif_metrics_logging.h"
#include "common/address_obfuscator.h"
@@ -155,9 +154,6 @@ static void init_metric_id_allocator() {

static std::recursive_mutex config_lock;  // protects operations on |config|.

// limited btif config cache capacity
static BtifConfigCache btif_config_cache(TEMPORARY_SECTION_CAPACITY);

// Module lifecycle functions

static future_t* init(void) {
Loading