diff options
| author | 2023-02-10 07:41:24 +0000 | |
|---|---|---|
| committer | 2023-02-10 07:41:24 +0000 | |
| commit | 31384ef9d3e546f877ccfb35ff138eedebce6934 (patch) | |
| tree | 45485572df4a9a6b168433865ca7cebdd9a2a6ac | |
| parent | 8592d3c3d38f8b8450c47e1402c0dbd75dd4e7a6 (diff) | |
| parent | 635ddd9c700d5d97f83a67cdd4ca3c7e297733a2 (diff) | |
Merge "[WMS][Bugfix] Fix hang when dumping local window." am: 635ddd9c70
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2411133
Change-Id: I4aa694d728fad1c25cea80930238adc4e0449bcf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerShellCommand.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java index aef6d1d15510..94a7cf71d5d3 100644 --- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java +++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java @@ -34,6 +34,7 @@ import android.content.res.Resources.NotFoundException; import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; +import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ShellCommand; import android.os.UserHandle; @@ -46,6 +47,7 @@ import android.view.ViewDebug; import com.android.internal.os.ByteTransferPipe; import com.android.internal.protolog.ProtoLogImpl; +import com.android.server.IoThread; import com.android.server.wm.LetterboxConfiguration.LetterboxBackgroundType; import com.android.server.wm.LetterboxConfiguration.LetterboxHorizontalReachabilityPosition; import com.android.server.wm.LetterboxConfiguration.LetterboxVerticalReachabilityPosition; @@ -572,8 +574,22 @@ public class WindowManagerShellCommand extends ShellCommand { ByteTransferPipe pipe = null; try { pipe = new ByteTransferPipe(); - w.mClient.executeCommand(ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, - pipe.getWriteFd()); + final ParcelFileDescriptor pfd = pipe.getWriteFd(); + if (w.isClientLocal()) { + // Make it asynchronous to avoid writer from being blocked + // by waiting for the buffer to be consumed in the same process. + IoThread.getExecutor().execute(() -> { + try { + w.mClient.executeCommand( + ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); + } catch (RemoteException e) { + // Ignore for local call. + } + }); + } else { + w.mClient.executeCommand( + ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); + } requestList.add(Pair.create(w.getName(), pipe)); } catch (IOException | RemoteException e) { // Skip this window |