aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2011-12-19 10:04:14 -0800
committerKenny Root <kroot@google.com>2011-12-19 10:08:46 -0800
commit5e79286e6441bb50f281fe4bf675fc796a338cd2 (patch)
treef5635090c64a58708dfa0c72aa53743c9003367f
parentd09ef044f4f0d6dbcb98d152c9d2ee4f21c5cb0a (diff)
downloadsdk-5e79286e6441bb50f281fe4bf675fc796a338cd2.zip
sdk-5e79286e6441bb50f281fe4bf675fc796a338cd2.tar.gz
sdk-5e79286e6441bb50f281fe4bf675fc796a338cd2.tar.bz2
Add support for ANDROID_SERIAL in screenshot
adb, fastboot, and other utilities respect the ANDROID_SERIAL environment variable. Add support for this to screenshot so the experience can be consistent. Change-Id: I37b49c025414c5dd0774285b41cc1a308065da1d
-rw-r--r--screenshot/src/com/android/screenshot/Screenshot.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/screenshot/src/com/android/screenshot/Screenshot.java b/screenshot/src/com/android/screenshot/Screenshot.java
index 930ea8e..d93e6ff 100644
--- a/screenshot/src/com/android/screenshot/Screenshot.java
+++ b/screenshot/src/com/android/screenshot/Screenshot.java
@@ -85,6 +85,17 @@ public class Screenshot {
}
} while (index < args.length);
+ /*
+ * If no command-line switches and no serial number was passed on the
+ * command-line, try to read a serial number from the shell environment.
+ */
+ if (!device && !emulator && serial == null) {
+ String envSerial = System.getenv("ANDROID_SERIAL");
+ if (envSerial != null) {
+ serial = envSerial;
+ }
+ }
+
if (filepath == null) {
printUsageAndQuit();
}