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

Commit a32e205e authored by David Duarte's avatar David Duarte
Browse files

Remove btif_config_transcode

Test: mma
Bug: 279502784
Change-Id: If96ecb1b1621d97ff90e48888707ad0cf38f42e9
parent 688c2d47
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -177,7 +177,6 @@ cc_library_static {
        "src/btif_bqr.cc",
        "src/btif_config.cc",
        "src/btif_config_cache.cc",
        "src/btif_config_transcode.cc",
        "src/btif_core.cc",
        "src/btif_debug_conn.cc",
        "src/btif_dm.cc",
@@ -530,7 +529,6 @@ cc_test {
        "libcutils",
        "libhidlbase",
        "liblog",
        "libtinyxml2",
    ],
    static_libs: [
        "android.hardware.bluetooth.a2dp@1.0",
@@ -657,7 +655,6 @@ cc_test {
        "libcutils",
        "libhidlbase",
        "liblog",
        "libtinyxml2",
    ],
    static_libs: [
        "android.hardware.bluetooth.a2dp@1.0",
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ static_library("btif") {
    "src/btif_csis_client.cc",
    "src/btif_config.cc",
    "src/btif_config_cache.cc",
    "src/btif_config_transcode.cc",
    "src/btif_core.cc",
    "src/btif_debug_conn.cc",
    "src/btif_dm.cc",
+0 −23
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright 2014 Google, Inc.
 *
 *  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 "osi/include/config.h"

std::unique_ptr<config_t> btif_config_transcode(const char* xml_filename);
+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@
#include "btif_api.h"
#include "btif_common.h"
#include "btif_config_cache.h"
#include "btif_config_transcode.h"
#include "btif_keystore.h"
#include "btif_metrics_logging.h"
#include "common/address_obfuscator.h"
+0 −69
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright 2014 Google, Inc.
 *
 *  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.
 *
 ******************************************************************************/

#define LOG_TAG "bt_btif_config_transcode"

#include "osi/include/config.h"

#ifndef __ANDROID__
std::unique_ptr<config_t> btif_config_transcode(const char* xml_filename) {
  // Legacy XML config never exists for non-Android
  return nullptr;
}
#else
#include <tinyxml2.h>

#include "osi/include/log.h"

using namespace tinyxml2;

std::unique_ptr<config_t> btif_config_transcode(const char* xml_filename) {
  XMLDocument document;
  int error = document.LoadFile(xml_filename);
  if (error != XML_SUCCESS) {
    LOG_ERROR("%s unable to load XML file '%s': %d", __func__, xml_filename,
              error);
    return NULL;
  }

  XMLElement* rootElement = document.RootElement();
  if (!rootElement) {
    LOG_ERROR("%s unable to find root element; assuming corrupted config file.",
              __func__);
    return NULL;
  }

  std::unique_ptr<config_t> config = config_new_empty();

  for (XMLElement* i = rootElement->FirstChildElement(); i != NULL;
       i = i->NextSiblingElement())
    for (XMLElement* j = i->FirstChildElement(); j != NULL;
         j = j->NextSiblingElement()) {
      const char* section = j->Attribute("Tag");
      for (XMLElement* k = j->FirstChildElement(); k != NULL;
           k = k->NextSiblingElement()) {
        const char* key = k->Attribute("Tag");
        const char* value = k->GetText();
        if (section && key && value)
          config_set_string(config.get(), section, key, value);
      }
    }

  return config;
}
#endif
Loading