From 0801a618a36e63c334afc739ae6404d5a9dda18f Mon Sep 17 00:00:00 2001 From: Fabien Sanglard Date: Fri, 20 Jan 2023 19:31:00 +0000 Subject: [PATCH] Ensure WAIT packet upon HELO in --suspend mode Upon suspending the app, we don't set mWaiting like we do in waitingForDebugger. This is an error because this state is checked upon handling HELO in DdmHandleHello chunk handler. Mimicking what is done in waitingForDebugger ensure that WAIT is sent and DDM client receive the event. Bug: 266232837 Test: Manual Change-Id: I3b8bc9af6f017f3a16c33ac38df7a9248c939a1a --- core/java/android/os/Debug.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java index c731a808263a4..2d16dc3a4c33b 100644 --- a/core/java/android/os/Debug.java +++ b/core/java/android/os/Debug.java @@ -1006,12 +1006,15 @@ public final class Debug // been replaced with an implementation that will suspendAll and // send VM_START. System.out.println("Waiting for debugger first packet"); + + mWaiting = true; while (!isDebuggerConnected()) { try { Thread.sleep(100); } catch (InterruptedException ie) { } } + mWaiting = false; System.out.println("Debug.suspendAllAndSentVmStart"); VMDebug.suspendAllAndSendVmStart();