From f5ad42f4324bfb7aa28f0967e2fcc89f55d6e91f Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Fri, 12 Jun 2015 13:59:03 -0700 Subject: Update surfaces secure flag on screen capture setting change Also, added 'wm screen-capture [userId] [true|false]' command. Bug: 20934462 Change-Id: I14711003d7691fc4495428c12c9ff3457cd3773c --- cmds/wm/src/com/android/commands/wm/Wm.java | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'cmds/wm/src') diff --git a/cmds/wm/src/com/android/commands/wm/Wm.java b/cmds/wm/src/com/android/commands/wm/Wm.java index 64f023f..fb050e5 100644 --- a/cmds/wm/src/com/android/commands/wm/Wm.java +++ b/cmds/wm/src/com/android/commands/wm/Wm.java @@ -54,6 +54,7 @@ public class Wm extends BaseCommand { " wm density [reset|DENSITY]\n" + " wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]\n" + " wm scaling [off|auto]\n" + + " wm screen-capture [userId] [true|false]\n" + "\n" + "wm size: return or override display size.\n" + " width and height in pixels unless suffixed with 'dp'.\n" + @@ -62,7 +63,9 @@ public class Wm extends BaseCommand { "\n" + "wm overscan: set overscan area for display.\n" + "\n" + - "wm scaling: set display scaling mode.\n" + "wm scaling: set display scaling mode.\n" + + "\n" + + "wm screen-capture: enable/disable screen capture.\n" ); } @@ -85,16 +88,39 @@ public class Wm extends BaseCommand { runDisplayOverscan(); } else if (op.equals("scaling")) { runDisplayScaling(); + } else if (op.equals("screen-capture")) { + runSetScreenCapture(); } else { showError("Error: unknown command '" + op + "'"); return; } } + private void runSetScreenCapture() throws Exception { + String userIdStr = nextArg(); + String enableStr = nextArg(); + int userId; + boolean disable; + + try { + userId = Integer.parseInt(userIdStr); + } catch (NumberFormatException e) { + System.err.println("Error: bad number " + e); + return; + } + + disable = !Boolean.parseBoolean(enableStr); + + try { + mWm.setScreenCaptureDisabled(userId, disable); + } catch (RemoteException e) { + System.err.println("Error: Can't set screen capture " + e); + } + } + private void runDisplaySize() throws Exception { String size = nextArg(); int w, h; - boolean scale = true; if (size == null) { Point initialSize = new Point(); Point baseSize = new Point(); @@ -181,7 +207,6 @@ public class Wm extends BaseCommand { private void runDisplayOverscan() throws Exception { String overscanStr = nextArgRequired(); Rect rect = new Rect(); - int density; if ("reset".equals(overscanStr)) { rect.set(0, 0, 0, 0); } else { -- cgit v1.1