Skip to content
Snippets Groups Projects
Commit b82f2088 authored by Myles Watson's avatar Myles Watson
Browse files

HAL: Print an error on a timeout for cuttlefish

500 ms should be sufficient for finding the Bluetooth HAL,
but when it is not, complain loudly and continue, in case
the HAL still starts.

Bug: 233804549
Test: atest
Change-Id: Ic20f0bc4f494f8e72aec1af8205b7be5e0ce9165
parent 7bb4b030
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment