So, I tried to improve standalone DDMS, when checking the Event Log panel/tab. I got this error:
11:09:45 E/EventLog: closed
com.android.ddmlib.AdbCommandRejectedException: closed
at com.android.ddmlib.AdbHelper.runLogService(AdbHelper.java:579)
at com.android.ddmlib.AdbHelper.runEventLogService(AdbHelper.java:548)
at com.android.ddmlib.Device.runEventLogService(Device.java:584)
at com.android.ddmuilib.log.event.EventLogPanel$8.run(EventLogPanel.java:461)
So far, I tried using emulator fw 2.3.3 (API 10) and it's works, but doesn't work for fw 6.0 (API 23).
So far I've found:
On fw 2.3.3 API 10:
- it has file path /dev/log/events
- when I pull the file, it seems log events that I need
On fw 6.0 API 23:
- it doesn't has file path /dev/log/events, instead it moved to /dev/input/event0 or dev/input/event1
- when I pull the file, it has 0 size, means it is an empty file
Some device has /dev/log/events even it fw 6.0 API 23 (in my case Samsung SM-A500F). When manually pull, it's not empty, but still it has adb rejection error "closed".
What I done so far:
- change the command from byte[] request = formAdbRequest("log:" + logName); to: byte[] request = formAdbRequest("input:event0"); -> still get the "Closed" error
- change the command to: byte[] request = formAdbRequest("shell:logcat -v threadtime -b " + logName); -> the "Closed" error is gone, but the result data cannot be parsed, it has different format
public static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName,
LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException {
SocketChannel adbChan = null;
try {
adbChan = SocketChannel.open(adbSockAddr);
adbChan.configureBlocking(false);
// if the device is not -1, then we first tell adb we're looking to talk
// to a specific device
setDevice(adbChan, device);
byte[] request = formAdbRequest("log:" + logName);
write(adbChan, request);
AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */);
if (!resp.okay) {
throw new AdbCommandRejectedException(resp.message);
}
byte[] data = new byte[16384];
ByteBuffer buf = ByteBuffer.wrap(data);
while (true) {
int count;
if (rcvr != null && rcvr.isCancelled()) {
break;
}
count = adbChan.read(buf);
if (count < 0) {
break;
} else if (count == 0) {
try {
Thread.sleep(WAIT_TIME * 5);
} catch (InterruptedException ie) {
}
} else {
if (rcvr != null) {
rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position());
}
buf.rewind();
}
}
} finally {
if (adbChan != null) {
adbChan.close();
}
}
}
I'm afraid that the system events log is no longer can be read through log:events, but I still couldn't find the documents for this.
Any comments are highly appreciated.
Thanks in advance.