aboutsummaryrefslogtreecommitdiffstats
path: root/dumpeventlog
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2009-05-14 18:19:52 -0700
committerXavier Ducrohet <xav@android.com>2009-05-15 14:01:12 -0700
commit5542fe492293223a81e604a49aa6fa55b1719847 (patch)
tree5a8377e382e930e99c7ebe0b729ae2c2833cbf22 /dumpeventlog
parentc28e97a0db9c383cd656cb51f3b720dfb53b8d21 (diff)
downloadsdk-5542fe492293223a81e604a49aa6fa55b1719847.zip
sdk-5542fe492293223a81e604a49aa6fa55b1719847.tar.gz
sdk-5542fe492293223a81e604a49aa6fa55b1719847.tar.bz2
Make the ddmlib API use IDevice instead of Device
Device is now private. All the API is using IDevice. Updated ddms, ADT, hierarchyviewer and other tools that relied on ddmlib.
Diffstat (limited to 'dumpeventlog')
-rw-r--r--dumpeventlog/src/com/android/dumpeventlog/DumpEventLog.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/dumpeventlog/src/com/android/dumpeventlog/DumpEventLog.java b/dumpeventlog/src/com/android/dumpeventlog/DumpEventLog.java
index 6c528e1..695573c 100644
--- a/dumpeventlog/src/com/android/dumpeventlog/DumpEventLog.java
+++ b/dumpeventlog/src/com/android/dumpeventlog/DumpEventLog.java
@@ -17,7 +17,7 @@
package com.android.dumpeventlog;
import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.Log.ILogOutput;
import com.android.ddmlib.Log.LogLevel;
@@ -30,7 +30,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
/**
- * Connects to a device using ddmlib and dumps its event log as long as the device is connected.
+ * Connects to a device using ddmlib and dumps its event log as long as the device is connected.
*/
public class DumpEventLog {
@@ -74,7 +74,7 @@ public class DumpEventLog {
System.out.println("Usage: dumpeventlog <device s/n> <filepath>");
return;
}
-
+
// redirect the log output to /dev/null
Log.setLogOutput(new ILogOutput() {
public void printAndPromptLog(LogLevel logLevel, String tag, String message) {
@@ -85,13 +85,13 @@ public class DumpEventLog {
// pass
}
});
-
+
// init the lib
AndroidDebugBridge.init(false /* debugger support */);
-
+
try {
AndroidDebugBridge bridge = AndroidDebugBridge.createBridge();
-
+
// we can't just ask for the device list right away, as the internal thread getting
// them from ADB may not be done getting the first list.
// Since we don't really want getDevices() to be blocking, we wait here manually.
@@ -103,7 +103,7 @@ public class DumpEventLog {
} catch (InterruptedException e) {
// pass
}
-
+
// let's not wait > 10 sec.
if (count > 100) {
System.err.println("Timeout getting device list!");
@@ -112,9 +112,9 @@ public class DumpEventLog {
}
// now get the devices
- Device[] devices = bridge.getDevices();
-
- for (Device device : devices) {
+ IDevice[] devices = bridge.getDevices();
+
+ for (IDevice device : devices) {
if (device.getSerialNumber().equals(args[0])) {
try {
grabLogFrom(device, args[1]);
@@ -126,20 +126,20 @@ public class DumpEventLog {
return;
}
}
-
+
System.err.println("Could not find " + args[0]);
} finally {
AndroidDebugBridge.terminate();
}
}
- private static void grabLogFrom(Device device, String filePath) throws IOException {
+ private static void grabLogFrom(IDevice device, String filePath) throws IOException {
LogWriter writer = new LogWriter(filePath);
LogReceiver receiver = new LogReceiver(writer);
writer.setReceiver(receiver);
device.runEventLogService(receiver);
-
+
writer.done();
}
}