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

Commit 4a05932b authored by Chris Manton's avatar Chris Manton Committed by android-build-merger
Browse files

Merge "Add property check for gd shim entry" am: dfc12a65 am: d398974c am: c72718da

am: e5d6292e

Change-Id: I592659b5cf1c78098a86806085da50da872d61c2
parents be710464 e5d6292e
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -14,22 +14,29 @@
 * limitations under the License.
 */

#include "main/shim/shim.h"
#include <cstdint>

#include "main/shim/entry.h"
#include "main/shim/shim.h"
#include "osi/include/properties.h"

static const char* kPropertyKey = "bluetooth.gd.enabled";

// TODO(cmanton) Connect this flag to an external input
#if 1
static bool gd_shim_enabled_ = false;
#else
static bool gd_shim_enabled_ = true;
#endif
static bool gd_shim_property_checked_ = false;

EXPORT_SYMBOL extern const module_t gd_shim_module = {
    .name = GD_SHIM_MODULE,
    .init = NULL,
    .init = nullptr,
    .start_up = bluetooth::shim::StartGabeldorscheStack,
    .shut_down = bluetooth::shim::StopGabeldorscheStack,
    .clean_up = NULL,
    .dependencies = {NULL}};

bool bluetooth::shim::is_gd_shim_enabled() { return gd_shim_enabled_; }
bool bluetooth::shim::is_gd_shim_enabled() {
  if (!gd_shim_property_checked_) {
    gd_shim_property_checked_ = true;
    gd_shim_enabled_ = (osi_property_get_int32(kPropertyKey, 0) == 1);
  }
  return gd_shim_enabled_;
}