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

Commit 866c0816 authored by Alain Vongsouvanh's avatar Alain Vongsouvanh Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE ANYWHERE Bring back support for legacy bt_config.xml" into cw-e-dev

parents 3d4cef70 c92bee1a
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -43,9 +43,11 @@
#if defined(OS_GENERIC)
static const char *CONFIG_FILE_PATH = "bt_config.conf";
static const char *CONFIG_BACKUP_PATH = "bt_config.bak";
static const char *CONFIG_LEGACY_FILE_PATH = "bt_config.xml";
#else  // !defined(OS_GENERIC)
static const char *CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.conf";
static const char *CONFIG_BACKUP_PATH = "/data/misc/bluedroid/bt_config.bak";
static const char *CONFIG_LEGACY_FILE_PATH = "/data/misc/bluedroid/bt_config.xml";
#endif  // defined(OS_GENERIC)
static const period_ms_t CONFIG_SETTLE_PERIOD_MS = 3000;

@@ -104,15 +106,19 @@ static future_t *init(void) {
    LOG_WARN("%s unable to load config file: %s; using backup.",
              __func__, CONFIG_FILE_PATH);
    config = config_new(CONFIG_BACKUP_PATH);
  }
  if (!config) {
    LOG_WARN("%s unable to load backup; attempting to transcode legacy file.", __func__);
    config = btif_config_transcode(CONFIG_LEGACY_FILE_PATH);
  }
  if (!config) {
      LOG_ERROR("%s unable to load backup; creating empty config.", __func__);
    LOG_ERROR("%s unable to transcode legacy file; creating empty config.", __func__);
    config = config_new_empty();
  }
  if (!config) {
    LOG_ERROR("%s unable to allocate a config object.", __func__);
    goto error;
  }
    }
  }

  btif_config_devcache_cleanup();