adb: fix adb remount -R

A regression from commit 8c2198c809
("adb: use shell for remount to forward return codes.") where the
optional argv[1] got missed for the remount command.  This change
hands off _all_ the arguments if to a shell and activates some of
the extra features in the remount command.

$ adb remount --help
remount [-h] [-R] [-T fstab_file] [partition]...
	-h --help	this help
	-R --reboot	disable verity & reboot to facilitate remount
	-T --fstab	custom fstab file location
	partition	specific partition(s) (empty does all)

Remount specified partition(s) read-write, by name or mount point.
-R notwithstanding, verity must be disabled on partition(s).
$

SideEffects: adb remount [-h] [-R] [-T fstab_file] [partition]...
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I8223d4000ab20857e9b634e4d4a326eed530d7be
This commit is contained in:
Mark Salyzyn 2019-09-17 08:01:15 -07:00
parent b0321c1de1
commit 6f908cefe7
1 changed files with 6 additions and 2 deletions
adb/client

View File

@ -1713,8 +1713,12 @@ int adb_commandline(int argc, const char** argv) {
}
if (CanUseFeature(features, kFeatureRemountShell)) {
const char* arg[2] = {"shell", "remount"};
return adb_shell(2, arg);
std::vector<const char*> args = {"shell"};
args.insert(args.cend(), argv, argv + argc);
return adb_shell(args.size(), args.data());
} else if (argc > 1) {
auto command = android::base::StringPrintf("%s:%s", argv[0], argv[1]);
return adb_connect_command(command);
} else {
return adb_connect_command("remount:");
}