Loading fastboot/device/commands.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,13 @@ bool SetActiveHandler(FastbootDevice* device, const std::vector<std::string>& ar CommandResult ret; auto cb = [&ret](CommandResult result) { ret = result; }; auto result = boot_control_hal->setActiveBootSlot(slot, cb); if (result.isOk() && ret.success) return device->WriteStatus(FastbootResult::OKAY, ""); if (result.isOk() && ret.success) { // Save as slot suffix to match the suffix format as returned from // the boot control HAL. auto current_slot = "_" + args[1]; device->set_active_slot(current_slot); return device->WriteStatus(FastbootResult::OKAY, ""); } return device->WriteStatus(FastbootResult::FAIL, "Unable to set slot"); } Loading fastboot/device/fastboot_device.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ FastbootDevice::FastbootDevice() transport_(std::make_unique<ClientUsbTransport>()), boot_control_hal_(IBootControl::getService()), health_hal_(get_health_service()), fastboot_hal_(IFastboot::getService()) {} fastboot_hal_(IFastboot::getService()), active_slot_("") {} FastbootDevice::~FastbootDevice() { CloseDevice(); Loading @@ -68,6 +69,11 @@ void FastbootDevice::CloseDevice() { } std::string FastbootDevice::GetCurrentSlot() { // Check if a set_active ccommand was issued earlier since the boot control HAL // returns the slot that is currently booted into. if (!active_slot_.empty()) { return active_slot_; } // Non-A/B devices must not have boot control HALs. if (!boot_control_hal_) { return ""; Loading fastboot/device/fastboot_device.h +3 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ class FastbootDevice { } android::sp<android::hardware::health::V2_0::IHealth> health_hal() { return health_hal_; } void set_active_slot(const std::string& active_slot) { active_slot_ = active_slot; } private: const std::unordered_map<std::string, CommandHandler> kCommandMap; Loading @@ -64,4 +66,5 @@ class FastbootDevice { android::sp<android::hardware::health::V2_0::IHealth> health_hal_; android::sp<android::hardware::fastboot::V1_0::IFastboot> fastboot_hal_; std::vector<char> download_data_; std::string active_slot_; }; Loading
fastboot/device/commands.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,13 @@ bool SetActiveHandler(FastbootDevice* device, const std::vector<std::string>& ar CommandResult ret; auto cb = [&ret](CommandResult result) { ret = result; }; auto result = boot_control_hal->setActiveBootSlot(slot, cb); if (result.isOk() && ret.success) return device->WriteStatus(FastbootResult::OKAY, ""); if (result.isOk() && ret.success) { // Save as slot suffix to match the suffix format as returned from // the boot control HAL. auto current_slot = "_" + args[1]; device->set_active_slot(current_slot); return device->WriteStatus(FastbootResult::OKAY, ""); } return device->WriteStatus(FastbootResult::FAIL, "Unable to set slot"); } Loading
fastboot/device/fastboot_device.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ FastbootDevice::FastbootDevice() transport_(std::make_unique<ClientUsbTransport>()), boot_control_hal_(IBootControl::getService()), health_hal_(get_health_service()), fastboot_hal_(IFastboot::getService()) {} fastboot_hal_(IFastboot::getService()), active_slot_("") {} FastbootDevice::~FastbootDevice() { CloseDevice(); Loading @@ -68,6 +69,11 @@ void FastbootDevice::CloseDevice() { } std::string FastbootDevice::GetCurrentSlot() { // Check if a set_active ccommand was issued earlier since the boot control HAL // returns the slot that is currently booted into. if (!active_slot_.empty()) { return active_slot_; } // Non-A/B devices must not have boot control HALs. if (!boot_control_hal_) { return ""; Loading
fastboot/device/fastboot_device.h +3 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ class FastbootDevice { } android::sp<android::hardware::health::V2_0::IHealth> health_hal() { return health_hal_; } void set_active_slot(const std::string& active_slot) { active_slot_ = active_slot; } private: const std::unordered_map<std::string, CommandHandler> kCommandMap; Loading @@ -64,4 +66,5 @@ class FastbootDevice { android::sp<android::hardware::health::V2_0::IHealth> health_hal_; android::sp<android::hardware::fastboot::V1_0::IFastboot> fastboot_hal_; std::vector<char> download_data_; std::string active_slot_; };