Loading boot/aidl/client/BootControlClient.cpp +24 −6 Original line number Diff line number Diff line Loading @@ -79,13 +79,31 @@ class BootControlClientAidl final : public BootControlClient { BootControlVersion GetVersion() const override { return BootControlVersion::BOOTCTL_AIDL; } ~BootControlClientAidl() { if (boot_control_death_recipient) { AIBinder_unlinkToDeath(module_->asBinder().get(), boot_control_death_recipient, this); void onBootControlServiceDied() { LOG(ERROR) << "boot control service AIDL died. Attempting to reconnect..."; const auto instance_name = std::string(::aidl::android::hardware::boot::IBootControl::descriptor) + "/default"; if (AServiceManager_isDeclared(instance_name.c_str())) { module_ = ::aidl::android::hardware::boot::IBootControl::fromBinder( ndk::SpAIBinder(AServiceManager_waitForService(instance_name.c_str()))); if (module_ == nullptr) { LOG(ERROR) << "AIDL " << instance_name << " is declared but waitForService returned nullptr when trying to " "reconnect boot control service"; return; } LOG(INFO) << "Reconnected to AIDL version of IBootControl"; binder_status_t status = AIBinder_linkToDeath(module_->asBinder().get(), boot_control_death_recipient, this); if (status != STATUS_OK) { LOG(ERROR) << "Could not link to binder death"; return; } void onBootControlServiceDied() { LOG(ERROR) << "boot control service AIDL died"; } } else { LOG(ERROR) << "Failed to get service manager for: " << instance_name; } } int32_t GetNumSlots() const override { int32_t ret = -1; Loading Loading @@ -179,7 +197,7 @@ class BootControlClientAidl final : public BootControlClient { } private: const std::shared_ptr<IBootControl> module_; std::shared_ptr<IBootControl> module_; AIBinder_DeathRecipient* boot_control_death_recipient; static void onBootControlServiceDied(void* client) { BootControlClientAidl* self = static_cast<BootControlClientAidl*>(client); Loading Loading
boot/aidl/client/BootControlClient.cpp +24 −6 Original line number Diff line number Diff line Loading @@ -79,13 +79,31 @@ class BootControlClientAidl final : public BootControlClient { BootControlVersion GetVersion() const override { return BootControlVersion::BOOTCTL_AIDL; } ~BootControlClientAidl() { if (boot_control_death_recipient) { AIBinder_unlinkToDeath(module_->asBinder().get(), boot_control_death_recipient, this); void onBootControlServiceDied() { LOG(ERROR) << "boot control service AIDL died. Attempting to reconnect..."; const auto instance_name = std::string(::aidl::android::hardware::boot::IBootControl::descriptor) + "/default"; if (AServiceManager_isDeclared(instance_name.c_str())) { module_ = ::aidl::android::hardware::boot::IBootControl::fromBinder( ndk::SpAIBinder(AServiceManager_waitForService(instance_name.c_str()))); if (module_ == nullptr) { LOG(ERROR) << "AIDL " << instance_name << " is declared but waitForService returned nullptr when trying to " "reconnect boot control service"; return; } LOG(INFO) << "Reconnected to AIDL version of IBootControl"; binder_status_t status = AIBinder_linkToDeath(module_->asBinder().get(), boot_control_death_recipient, this); if (status != STATUS_OK) { LOG(ERROR) << "Could not link to binder death"; return; } void onBootControlServiceDied() { LOG(ERROR) << "boot control service AIDL died"; } } else { LOG(ERROR) << "Failed to get service manager for: " << instance_name; } } int32_t GetNumSlots() const override { int32_t ret = -1; Loading Loading @@ -179,7 +197,7 @@ class BootControlClientAidl final : public BootControlClient { } private: const std::shared_ptr<IBootControl> module_; std::shared_ptr<IBootControl> module_; AIBinder_DeathRecipient* boot_control_death_recipient; static void onBootControlServiceDied(void* client) { BootControlClientAidl* self = static_cast<BootControlClientAidl*>(client); Loading