Loading core/java/android/os/Looper.java +12 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package android.os; 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 Loading Loading @@ -289,6 +291,16 @@ public final class Looper { 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() Loading core/java/android/os/Message.java +55 −22 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package android.os; import android.os.MessageProto; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; /** * Loading Loading @@ -520,6 +522,37 @@ public final class Message implements Parcelable { return b.toString(); } void writeToProto(ProtoOutputStream proto, long fieldId) { final long messageToken = proto.start(fieldId); proto.write(MessageProto.WHEN, when); if (target != null) { if (callback != null) { proto.write(MessageProto.CALLBACK, callback.getClass().getName()); } else { proto.write(MessageProto.WHAT, what); } if (arg1 != 0) { proto.write(MessageProto.ARG1, arg1); } if (arg2 != 0) { proto.write(MessageProto.ARG2, arg2); } if (obj != null) { proto.write(MessageProto.OBJ, obj.toString()); } proto.write(MessageProto.TARGET, target.getClass().getName()); } else { proto.write(MessageProto.BARRIER, arg1); } proto.end(messageToken); } public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator<Message>() { public Message createFromParcel(Parcel source) { Loading core/java/android/os/MessageQueue.java +15 −1 Original line number Diff line number Diff line Loading @@ -18,9 +18,11 @@ package android.os; import android.annotation.IntDef; import android.annotation.NonNull; import android.os.MessageQueueProto; import android.util.Log; import android.util.Printer; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import java.io.FileDescriptor; import java.lang.annotation.Retention; Loading Loading @@ -770,6 +772,18 @@ public final class MessageQueue { } } void writeToProto(ProtoOutputStream proto, long fieldId) { final long messageQueueToken = proto.start(fieldId); synchronized (this) { for (Message msg = mMessages; msg != null; msg = msg.next) { msg.writeToProto(proto, MessageQueueProto.MESSAGES); } proto.write(MessageQueueProto.IS_POLLING_LOCKED, isPollingLocked()); proto.write(MessageQueueProto.IS_QUITTING, mQuitting); } proto.end(messageQueueToken); } /** * Callback interface for discovering when a thread is going to block * waiting for more messages. Loading core/java/android/os/WorkSource.java +17 −1 Original line number Diff line number Diff line package android.os; import android.os.WorkSourceProto; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.util.Arrays; Loading Loading @@ -692,6 +694,20 @@ public class WorkSource implements Parcelable { return result.toString(); } /** @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long workSourceToken = proto.start(fieldId); for (int i = 0; i < mNum; i++) { final long contentProto = proto.start(WorkSourceProto.WORK_SOURCE_CONTENTS); proto.write(WorkSourceProto.WorkSourceContentProto.UID, mUids[i]); if (mNames != null) { proto.write(WorkSourceProto.WorkSourceContentProto.NAME, mNames[i]); } proto.end(contentProto); } proto.end(workSourceToken); } public static final Parcelable.Creator<WorkSource> CREATOR = new Parcelable.Creator<WorkSource>() { public WorkSource createFromParcel(Parcel in) { Loading core/proto/android/os/looper.proto 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; package android.os; option java_multiple_files = true; import "frameworks/base/core/proto/android/os/messagequeue.proto"; message LooperProto { string thread_name = 1; int64 thread_id = 2; int32 identity_hash_code = 3; android.os.MessageQueueProto queue = 4; } Loading
core/java/android/os/Looper.java +12 −0 Original line number Diff line number Diff line Loading @@ -18,8 +18,10 @@ package android.os; 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 Loading Loading @@ -289,6 +291,16 @@ public final class Looper { 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() Loading
core/java/android/os/Message.java +55 −22 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package android.os; import android.os.MessageProto; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; /** * Loading Loading @@ -520,6 +522,37 @@ public final class Message implements Parcelable { return b.toString(); } void writeToProto(ProtoOutputStream proto, long fieldId) { final long messageToken = proto.start(fieldId); proto.write(MessageProto.WHEN, when); if (target != null) { if (callback != null) { proto.write(MessageProto.CALLBACK, callback.getClass().getName()); } else { proto.write(MessageProto.WHAT, what); } if (arg1 != 0) { proto.write(MessageProto.ARG1, arg1); } if (arg2 != 0) { proto.write(MessageProto.ARG2, arg2); } if (obj != null) { proto.write(MessageProto.OBJ, obj.toString()); } proto.write(MessageProto.TARGET, target.getClass().getName()); } else { proto.write(MessageProto.BARRIER, arg1); } proto.end(messageToken); } public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator<Message>() { public Message createFromParcel(Parcel source) { Loading
core/java/android/os/MessageQueue.java +15 −1 Original line number Diff line number Diff line Loading @@ -18,9 +18,11 @@ package android.os; import android.annotation.IntDef; import android.annotation.NonNull; import android.os.MessageQueueProto; import android.util.Log; import android.util.Printer; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import java.io.FileDescriptor; import java.lang.annotation.Retention; Loading Loading @@ -770,6 +772,18 @@ public final class MessageQueue { } } void writeToProto(ProtoOutputStream proto, long fieldId) { final long messageQueueToken = proto.start(fieldId); synchronized (this) { for (Message msg = mMessages; msg != null; msg = msg.next) { msg.writeToProto(proto, MessageQueueProto.MESSAGES); } proto.write(MessageQueueProto.IS_POLLING_LOCKED, isPollingLocked()); proto.write(MessageQueueProto.IS_QUITTING, mQuitting); } proto.end(messageQueueToken); } /** * Callback interface for discovering when a thread is going to block * waiting for more messages. Loading
core/java/android/os/WorkSource.java +17 −1 Original line number Diff line number Diff line package android.os; import android.os.WorkSourceProto; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.util.Arrays; Loading Loading @@ -692,6 +694,20 @@ public class WorkSource implements Parcelable { return result.toString(); } /** @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long workSourceToken = proto.start(fieldId); for (int i = 0; i < mNum; i++) { final long contentProto = proto.start(WorkSourceProto.WORK_SOURCE_CONTENTS); proto.write(WorkSourceProto.WorkSourceContentProto.UID, mUids[i]); if (mNames != null) { proto.write(WorkSourceProto.WorkSourceContentProto.NAME, mNames[i]); } proto.end(contentProto); } proto.end(workSourceToken); } public static final Parcelable.Creator<WorkSource> CREATOR = new Parcelable.Creator<WorkSource>() { public WorkSource createFromParcel(Parcel in) { Loading
core/proto/android/os/looper.proto 0 → 100644 +30 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto3"; package android.os; option java_multiple_files = true; import "frameworks/base/core/proto/android/os/messagequeue.proto"; message LooperProto { string thread_name = 1; int64 thread_id = 2; int32 identity_hash_code = 3; android.os.MessageQueueProto queue = 4; }