fastboot: Fix "fastboot gsi".
This command erroneously reports that no GSI is installed, because
/metadata is not mounted in recovery. To address this, temporarily mount
/metadata when the gsi command is invoked.
Bug: 122556707
Test: fastboot gsi disable
fastboot gsi wipe
Change-Id: Ib21971b49b46fd580b902ff75f01cfb96192afc0
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 17cab3a..4cdd8bc 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1948,11 +1948,10 @@
std::string size = next_arg(&args);
fb->ResizePartition(partition, size);
} else if (command == "gsi") {
- if (args.empty()) {
- syntax_error("missing 'wipe' or 'disable' argument");
- } else if (args.size() == 1 && args[0] == "wipe") {
+ std::string arg = next_arg(&args);
+ if (arg == "wipe") {
fb->RawCommand("gsi:wipe", "wiping GSI");
- } else if (args.size() == 1 && args[0] == "disable") {
+ } else if (arg == "disable") {
fb->RawCommand("gsi:disable", "disabling GSI");
} else {
syntax_error("expected 'wipe' or 'disable'");