aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-05-04 12:20:10 -0700
committerSiva Velusamy <vsiva@google.com>2012-05-04 14:02:20 -0700
commitb12a40ecf16b2cb14eec42822efff3c9dc1e2188 (patch)
tree0b3272ed06c5144a2199bd7c12dabb3c151d47be /ddms/libs
parent206b3513654dcc7765c5c7c6fe2ab2423cb76afe (diff)
downloadsdk-b12a40ecf16b2cb14eec42822efff3c9dc1e2188.zip
sdk-b12a40ecf16b2cb14eec42822efff3c9dc1e2188.tar.gz
sdk-b12a40ecf16b2cb14eec42822efff3c9dc1e2188.tar.bz2
logcat: Add a device disconnected message.
When a device is disconnected, an explicit message informing the user of this event is attached to the log. See http://code.google.com/p/android/issues/detail?id=25830 for the reason why this might be useful. Change-Id: I969004cb72b877b8319a639607f82c1c9f9a8635
Diffstat (limited to 'ddms/libs')
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java2
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatReceiver.java12
2 files changed, 12 insertions, 2 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
index 53255cb..54381fb 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
@@ -986,7 +986,7 @@ public final class LogCatPanel extends SelectionDependentPanel
mDeletedLogCount = 0;
}
- if (mReceiver == null) {
+ if (mReceiver == null || mReceiver.getMessages() == null) {
return;
}
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatReceiver.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatReceiver.java
index 8f2d52c..2674e92 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatReceiver.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatReceiver.java
@@ -20,9 +20,11 @@ import com.android.ddmlib.IDevice;
import com.android.ddmlib.IShellOutputReceiver;
import com.android.ddmlib.Log;
import com.android.ddmlib.MultiLineReceiver;
+import com.android.ddmlib.Log.LogLevel;
import org.eclipse.jface.preference.IPreferenceStore;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -34,6 +36,9 @@ import java.util.Set;
public final class LogCatReceiver {
private static final String LOGCAT_COMMAND = "logcat -v long";
private static final int DEVICE_POLL_INTERVAL_MSEC = 1000;
+ private static LogCatMessage DEVICE_DISCONNECTED_MESSAGE =
+ new LogCatMessage(LogLevel.ERROR, "", "", "",
+ "", "", "Device disconnected");
private LogCatMessageList mLogMessages;
private IDevice mCurrentDevice;
@@ -72,9 +77,11 @@ public final class LogCatReceiver {
/* stop the current logcat command */
mCurrentLogCatOutputReceiver.mIsCancelled = true;
mCurrentLogCatOutputReceiver = null;
+
+ // add a message to the log indicating that the device has been disconnected.
+ processLogMessages(Collections.singletonList(DEVICE_DISCONNECTED_MESSAGE));
}
- mLogMessages = null;
mCurrentDevice = null;
}
@@ -149,7 +156,10 @@ public final class LogCatReceiver {
private void processLogLines(String[] lines) {
List<LogCatMessage> newMessages = mLogCatMessageParser.processLogLines(lines,
mPidToNameMapper);
+ processLogMessages(newMessages);
+ }
+ private void processLogMessages(List<LogCatMessage> newMessages) {
if (newMessages.size() > 0) {
List<LogCatMessage> deletedMessages;
synchronized (mLogMessages) {