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

Commit 4de8496f authored by Chris Manton's avatar Chris Manton
Browse files

Add property check for gd shim entry

Bug: 14042172
Test: Ensure boot into both stacks
Test: adb shell stop; adb shell setprop bluetooth.gd.enabled 1 ; adb shell start
Test: adb shell stop; adb shell setprop bluetooth.gd.enabled 0 ; adb shell start

Change-Id: Ied131f5444dd33201197e9f19d0f4bc88c069f8c
parent 45d54000
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_;
}