From 64d38fd44887addaf210367f2917dcede3831034 Mon Sep 17 00:00:00 2001 From: Shai Barack Date: Mon, 11 Nov 2024 18:49:37 +0000 Subject: Don't use concurrent message queue when debugging is enabled Debugging (and instrumentation) is known to make assumptions about MessageQueue implementation details that are broken by the modern concurrent implementation. Until an alternative to the above is developed and rolled out, opt out of the new implementation when exposed to this risk. Bug: 336880969 Change-Id: I59a43a21534f7166803a3927bde8b9ed0fe1696e Flag: build.RELEASE_PACKAGE_MESSAGEQUEUE_IMPLEMENTATION --- core/java/android/os/CombinedMessageQueue/MessageQueue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/os/CombinedMessageQueue/MessageQueue.java b/core/java/android/os/CombinedMessageQueue/MessageQueue.java index 69bd6685bcac..7529ab9ab894 100644 --- a/core/java/android/os/CombinedMessageQueue/MessageQueue.java +++ b/core/java/android/os/CombinedMessageQueue/MessageQueue.java @@ -31,6 +31,7 @@ import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import dalvik.annotation.optimization.NeverCompile; +import dalvik.system.VMDebug; import java.io.FileDescriptor; import java.lang.annotation.Retention; @@ -110,7 +111,7 @@ public final class MessageQueue { private native static void nativeSetFileDescriptorEvents(long ptr, int fd, int events); MessageQueue(boolean quitAllowed) { - mUseConcurrent = UserHandle.isCore(Process.myUid()); + mUseConcurrent = UserHandle.isCore(Process.myUid()) && !VMDebug.isDebuggingEnabled(); mQuitAllowed = quitAllowed; mPtr = nativeInit(); } -- cgit v1.2.3-59-g8ed1b