diff options
author | David Anderson <dvander@google.com> | 2018-08-14 16:21:50 -0700 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2018-08-14 16:24:07 -0700 |
commit | 79ab0e3e98a82fd0896b31fce5b815eb541ccba9 (patch) | |
tree | 981de735db0ff56e61eb853f4fe0c6b23e4e3785 /fastboot/device/variables.cpp | |
parent | c48943165d08b07f52bc7774a37ca71ff00402ea (diff) |
fastbootd: Complete the implementation of getvar has-slot.
Bug: 78793464
Test: fastboot getvar has-slot:super returns "no"
Change-Id: I80f171df062c008718b810bbe12070834d4aa3fb
Diffstat (limited to 'fastboot/device/variables.cpp')
-rw-r--r-- | fastboot/device/variables.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp index a5dead212..65cfea327 100644 --- a/fastboot/device/variables.cpp +++ b/fastboot/device/variables.cpp @@ -123,10 +123,14 @@ bool GetHasSlot(FastbootDevice* device, const std::vector<std::string>& args) { } std::string slot_suffix = device->GetCurrentSlot(); if (slot_suffix.empty()) { - return device->WriteFail("Invalid slot"); + return device->WriteOkay("no"); } - std::string result = (args[0] == "userdata" ? "no" : "yes"); - return device->WriteOkay(result); + std::string partition_name = args[0] + slot_suffix; + if (FindPhysicalPartition(partition_name) || + LogicalPartitionExists(partition_name, slot_suffix)) { + return device->WriteOkay("yes"); + } + return device->WriteOkay("no"); } bool GetPartitionSize(FastbootDevice* device, const std::vector<std::string>& args) { |