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

Commit dfc12a65 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add property check for gd shim entry"

parents 519645d5 4de8496f
Loading
Loading
Loading
Loading
+15 −8
Original line number Original line Diff line number Diff line
@@ -14,22 +14,29 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


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

#include "main/shim/entry.h"
#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;
static bool gd_shim_enabled_ = false;
#else
static bool gd_shim_property_checked_ = false;
static bool gd_shim_enabled_ = true;
#endif


EXPORT_SYMBOL extern const module_t gd_shim_module = {
EXPORT_SYMBOL extern const module_t gd_shim_module = {
    .name = GD_SHIM_MODULE,
    .name = GD_SHIM_MODULE,
    .init = NULL,
    .init = nullptr,
    .start_up = bluetooth::shim::StartGabeldorscheStack,
    .start_up = bluetooth::shim::StartGabeldorscheStack,
    .shut_down = bluetooth::shim::StopGabeldorscheStack,
    .shut_down = bluetooth::shim::StopGabeldorscheStack,
    .clean_up = NULL,
    .clean_up = NULL,
    .dependencies = {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_;
}