Show install path in "adb --version" and "fastboot --version".
Bug: http://b/36766455
Bug: http://b/34691048
Test: ran tests
Change-Id: I4b67ec54d41a281fe7a33c017d3cfbc8055e3b43
diff --git a/adb/adb.cpp b/adb/adb.cpp
index 577e9b9..cf6b359 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -59,10 +59,12 @@
std::string adb_version() {
// Don't change the format of this --- it's parsed by ddmlib.
- return android::base::StringPrintf("Android Debug Bridge version %d.%d.%d\n"
- "Revision %s\n",
- ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
- ADB_REVISION);
+ return android::base::StringPrintf(
+ "Android Debug Bridge version %d.%d.%d\n"
+ "Revision %s\n"
+ "Installed as %s\n",
+ ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, ADB_REVISION,
+ android::base::GetExecutablePath().c_str());
}
void fatal(const char *fmt, ...) {
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 2927b16..a99ba23 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1536,6 +1536,7 @@
setvbuf(stderr, nullptr, _IONBF, 0);
} else if (strcmp("version", longopts[longindex].name) == 0) {
fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION);
+ fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
return 0;
} else if (strcmp("slot", longopts[longindex].name) == 0) {
slot_override = std::string(optarg);