Loading services/core/java/com/android/server/wm/WindowManagerShellCommand.java +18 −10 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.provider.Settings; import android.util.DisplayMetrics; import android.util.DisplayMetrics; import android.util.Pair; import android.util.Pair; import android.view.Display; import android.view.Display; import android.view.IWindow; import android.view.IWindowManager; import android.view.IWindowManager; import android.view.ViewDebug; import android.view.ViewDebug; Loading Loading @@ -553,6 +554,22 @@ public class WindowManagerShellCommand extends ShellCommand { return 0; return 0; } } private void dumpLocalWindowAsync(IWindow client, ParcelFileDescriptor pfd) { // Make it asynchronous to avoid writer from being blocked // by waiting for the buffer to be consumed in the same process. IoThread.getExecutor().execute(() -> { synchronized (mInternal.mGlobalLock) { try { client.executeCommand(ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); } catch (Exception e) { // Ignore RemoteException for local call. Just print trace for other // exceptions caused by RC with tolerable low possibility. e.printStackTrace(); } } }); } private int runDumpVisibleWindowViews(PrintWriter pw) { private int runDumpVisibleWindowViews(PrintWriter pw) { if (!mInternal.checkCallingPermission(android.Manifest.permission.DUMP, if (!mInternal.checkCallingPermission(android.Manifest.permission.DUMP, "runDumpVisibleWindowViews()")) { "runDumpVisibleWindowViews()")) { Loading @@ -575,16 +592,7 @@ public class WindowManagerShellCommand extends ShellCommand { pipe = new ByteTransferPipe(); pipe = new ByteTransferPipe(); final ParcelFileDescriptor pfd = pipe.getWriteFd(); final ParcelFileDescriptor pfd = pipe.getWriteFd(); if (w.isClientLocal()) { if (w.isClientLocal()) { // Make it asynchronous to avoid writer from being blocked dumpLocalWindowAsync(w.mClient, pfd); // 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 { } else { w.mClient.executeCommand( w.mClient.executeCommand( ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); Loading Loading
services/core/java/com/android/server/wm/WindowManagerShellCommand.java +18 −10 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.provider.Settings; import android.util.DisplayMetrics; import android.util.DisplayMetrics; import android.util.Pair; import android.util.Pair; import android.view.Display; import android.view.Display; import android.view.IWindow; import android.view.IWindowManager; import android.view.IWindowManager; import android.view.ViewDebug; import android.view.ViewDebug; Loading Loading @@ -553,6 +554,22 @@ public class WindowManagerShellCommand extends ShellCommand { return 0; return 0; } } private void dumpLocalWindowAsync(IWindow client, ParcelFileDescriptor pfd) { // Make it asynchronous to avoid writer from being blocked // by waiting for the buffer to be consumed in the same process. IoThread.getExecutor().execute(() -> { synchronized (mInternal.mGlobalLock) { try { client.executeCommand(ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); } catch (Exception e) { // Ignore RemoteException for local call. Just print trace for other // exceptions caused by RC with tolerable low possibility. e.printStackTrace(); } } }); } private int runDumpVisibleWindowViews(PrintWriter pw) { private int runDumpVisibleWindowViews(PrintWriter pw) { if (!mInternal.checkCallingPermission(android.Manifest.permission.DUMP, if (!mInternal.checkCallingPermission(android.Manifest.permission.DUMP, "runDumpVisibleWindowViews()")) { "runDumpVisibleWindowViews()")) { Loading @@ -575,16 +592,7 @@ public class WindowManagerShellCommand extends ShellCommand { pipe = new ByteTransferPipe(); pipe = new ByteTransferPipe(); final ParcelFileDescriptor pfd = pipe.getWriteFd(); final ParcelFileDescriptor pfd = pipe.getWriteFd(); if (w.isClientLocal()) { if (w.isClientLocal()) { // Make it asynchronous to avoid writer from being blocked dumpLocalWindowAsync(w.mClient, pfd); // 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 { } else { w.mClient.executeCommand( w.mClient.executeCommand( ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); ViewDebug.REMOTE_COMMAND_DUMP_ENCODED, null, pfd); Loading