Use PooledLambda in print code
This replaces the usage of handler message types with PooledLambda
Test: atest CtsPrintTestCases
Change-Id: I19b01278b67b5fe18d48a2e0bb8300bbe1413a63
diff --git a/core/java/android/os/Handler.java b/core/java/android/os/Handler.java
index fc88e90..0417ded 100644
--- a/core/java/android/os/Handler.java
+++ b/core/java/android/os/Handler.java
@@ -683,6 +683,23 @@
return enqueueMessage(queue, msg, 0);
}
+ /**
+ * Executes the message synchronously if called on the same thread this handler corresponds to,
+ * or {@link #sendMessage pushes it to the queue} otherwise
+ *
+ * @return Returns true if the message was successfully ran or placed in to the
+ * message queue. Returns false on failure, usually because the
+ * looper processing the message queue is exiting.
+ * @hide
+ */
+ public final boolean executeOrSendMessage(Message msg) {
+ if (mLooper == Looper.myLooper()) {
+ dispatchMessage(msg);
+ return true;
+ }
+ return sendMessage(msg);
+ }
+
private boolean enqueueMessage(MessageQueue queue, Message msg, long uptimeMillis) {
msg.target = this;
if (mAsynchronous) {