diff options
author | Robert Carr <racarr@google.com> | 2016-09-15 12:49:06 -0700 |
---|---|---|
committer | Robert Carr <racarr@google.com> | 2016-09-19 11:19:51 -0700 |
commit | 58c3437228b8b7b2ab4e5a80e6406f9c39309053 (patch) | |
tree | 837c66922cba8f45f30bf94025d5c8f3976d3bfc /cmds/wm | |
parent | 68e5c9e93a8f1542cd988ac01ba1d98381ff4893 (diff) |
Pass SurfaceTrace through WM command in binary format.
Maybe we could add a pretty printer later, this is mostly,
intended for consumption by the test framework though, so for
now we defer parsing until that part.
Test: cts-tradefed run singleCommand cts -o --module CtsWindowManagerHostTestCases --test android.server.cts.SurfaceViewMovementTests#testSurfaceMovesWithParent
Change-Id: I75add6a9644cd4bbbb9d06aab97b9bf9f016655b
Diffstat (limited to 'cmds/wm')
-rw-r--r-- | cmds/wm/src/com/android/commands/wm/Wm.java | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/cmds/wm/src/com/android/commands/wm/Wm.java b/cmds/wm/src/com/android/commands/wm/Wm.java index b46cd6767a73..84fb626cc4c6 100644 --- a/cmds/wm/src/com/android/commands/wm/Wm.java +++ b/cmds/wm/src/com/android/commands/wm/Wm.java @@ -77,7 +77,7 @@ public class Wm extends BaseCommand { "wm dismiss-keyguard: dismiss the keyguard, prompting the user for auth if " + "necessary.\n" + "\n" + - "wm surface-trace: log surface commands to stdout.\n" + "wm surface-trace: log surface commands to stdout in a binary format.\n" ); } @@ -112,46 +112,15 @@ public class Wm extends BaseCommand { } } - private void parseTrace(String next, DataInputStream is) throws Exception { - switch (next) { - case "Alpha": - System.out.println(is.readFloat()); - break; - case "Layer": - System.out.println(is.readInt()); - break; - case "Position": - System.out.println(is.readFloat() + ", " + is.readFloat()); - break; - case "Size": - System.out.println(is.readInt() + ", " + is.readInt()); - break; - case "LayerStack": - System.out.println(is.readInt()); - break; - case "Matrix": - System.out.println(is.readFloat() + "," + is.readFloat() + "," + is.readFloat() + "," + - is.readFloat()); - break; - case "Hide": - case "Show": - case "GeometryAppliesWithResize": - break; - } - } - private void runSurfaceTrace() throws Exception { - ParcelFileDescriptor[] fds = ParcelFileDescriptor.createPipe(); - - mWm.enableSurfaceTrace(fds[1]); - DataInputStream is = new DataInputStream(new FileInputStream(fds[0].getFileDescriptor())); + ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(FileDescriptor.out); + mWm.enableSurfaceTrace(pfd); try { - while (true) { - String cmd = is.readUTF(); - String window = is.readUTF(); - System.out.print(cmd + "(" + window + "): "); - parseTrace(cmd, is); + // No one is going to wake us up, we are just waiting on SIGINT. Otherwise + // the WM can happily continue writing to our stdout. + synchronized (this) { + this.wait(); } } finally { mWm.disableSurfaceTrace(); |