Protobufferize PowerManager dumpsys
Bug: 34230125
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCase -t com.android.server.cts.PowerIncidentTest
Change-Id: Ib71563cfc9ca95c297111430d8bbe2ce88d7a41d
diff --git a/core/java/android/os/Looper.java b/core/java/android/os/Looper.java
index d299672..63d3e7a 100644
--- a/core/java/android/os/Looper.java
+++ b/core/java/android/os/Looper.java
@@ -18,8 +18,10 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.os.LooperProto;
import android.util.Log;
import android.util.Printer;
+import android.util.proto.ProtoOutputStream;
/**
* Class used to run a message loop for a thread. Threads by default do
@@ -289,6 +291,16 @@
mQueue.dump(pw, prefix + " ");
}
+ /** @hide */
+ public void writeToProto(ProtoOutputStream proto, long fieldId) {
+ final long looperToken = proto.start(fieldId);
+ proto.write(LooperProto.THREAD_NAME, mThread.getName());
+ proto.write(LooperProto.THREAD_ID, mThread.getId());
+ proto.write(LooperProto.IDENTITY_HASH_CODE, System.identityHashCode(this));
+ mQueue.writeToProto(proto, LooperProto.QUEUE);
+ proto.end(looperToken);
+ }
+
@Override
public String toString() {
return "Looper (" + mThread.getName() + ", tid " + mThread.getId()