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

Commit 935c908e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "HAL: Print an error on a timeout for cuttlefish" am: c2caeafe am:...

Merge "HAL: Print an error on a timeout for cuttlefish" am: c2caeafe am: 55db8cd0 am: 8890ec5b am: 22b669ad am: 427ac24f

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2175889



Change-Id: Ib0feb7a86ab56eb886baa9e4a27f253794484663
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents d8133600 427ac24f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include "hal/snoop_logger.h"
#include "os/alarm.h"
#include "os/log.h"
#include "os/system_properties.h"

using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
@@ -210,6 +211,15 @@ class HciHalHidl : public HciHal {
    auto get_service_alarm = new os::Alarm(GetHandler());
    get_service_alarm->Schedule(
        BindOnce([] {
          const std::string kBoardProperty = "ro.product.board";
          const std::string kCuttlefishBoard = "cutf";
          auto board_name = os::GetSystemProperty(kBoardProperty);
          bool emulator = board_name.has_value() && board_name.value() == kCuttlefishBoard;
          if (emulator) {
            LOG_ERROR("board_name: %s", board_name.value().c_str());
            LOG_ERROR("Unable to get a Bluetooth service after 500ms, start the HAL before starting Bluetooth");
            return;
          }
          LOG_ALWAYS_FATAL("Unable to get a Bluetooth service after 500ms, start the HAL before starting Bluetooth");
        }),
        std::chrono::milliseconds(500));