From 43aa15912891930833edfc101615a9c881de54a1 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 10 Sep 2012 17:36:31 -0700 Subject: Allow adb shell am display-size to use bigger sizes. We now support scaling the logical display to fit the physical display, whatever size it is. So we can allow adb shell am display-size to use more or less arbitrary sizes although we do enforce an upper and lower bound to protect the user. Change-Id: I5fe6ba32ad1f9e4fbcd6915f7d36850b987bbcc0 --- cmds/am/src/com/android/commands/am/Am.java | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'cmds/am') diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 89287ad..bc9e74e 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -1187,32 +1187,26 @@ public class Am { private void runDisplaySize() throws Exception { String size = nextArgRequired(); - int m, n; + int w, h; if ("reset".equals(size)) { - m = n = -1; + w = h = -1; } else { int div = size.indexOf('x'); if (div <= 0 || div >= (size.length()-1)) { System.err.println("Error: bad size " + size); return; } - String mstr = size.substring(0, div); - String nstr = size.substring(div+1); + String wstr = size.substring(0, div); + String hstr = size.substring(div+1); try { - m = Integer.parseInt(mstr); - n = Integer.parseInt(nstr); + w = Integer.parseInt(wstr); + h = Integer.parseInt(hstr); } catch (NumberFormatException e) { System.err.println("Error: bad number " + e); return; } } - if (m < n) { - int tmp = m; - m = n; - n = tmp; - } - IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.checkService( Context.WINDOW_SERVICE)); if (wm == null) { @@ -1221,9 +1215,9 @@ public class Am { } try { - if (m >= 0 && n >= 0) { + if (w >= 0 && h >= 0) { // TODO(multidisplay): For now Configuration only applies to main screen. - wm.setForcedDisplaySize(Display.DEFAULT_DISPLAY, m, n); + wm.setForcedDisplaySize(Display.DEFAULT_DISPLAY, w, h); } else { wm.clearForcedDisplaySize(Display.DEFAULT_DISPLAY); } @@ -1444,7 +1438,7 @@ public class Am { " am clear-debug-app\n" + " am monitor [--gdb ]\n" + " am screen-compat [on|off] \n" + - " am display-size [reset|MxN]\n" + + " am display-size [reset|WxH]\n" + " am display-density [reset|DENSITY]\n" + " am to-uri [INTENT]\n" + " am to-intent-uri [INTENT]\n" + -- cgit v1.1