diff options
author | Jim Miller <jaggies@google.com> | 2011-03-09 14:42:56 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-09 14:42:56 -0800 |
commit | 5c9248f668201a751500f67cc60bd45ff905751a (patch) | |
tree | bd8a8af74cdb2a5d9665afadfe0d429b2010876a /services | |
parent | 788dd5e076821d8604be7a8e44a1c5ae5f4e198e (diff) | |
parent | e70d506ab329f1f96b0ee132317aa36edea1b94e (diff) | |
download | frameworks_base-5c9248f668201a751500f67cc60bd45ff905751a.zip frameworks_base-5c9248f668201a751500f67cc60bd45ff905751a.tar.gz frameworks_base-5c9248f668201a751500f67cc60bd45ff905751a.tar.bz2 |
Merge "Fix 4027057: Improve resolution of RecentApps thumbnail images." into honeycomb-mr1
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 8ccfbba..33e6a36 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -4727,7 +4727,15 @@ public class WindowManagerService extends IWindowManager.Stub SystemProperties.set(StrictMode.VISUAL_PROPERTY, value); } - public Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight) { + /** + * Takes a snapshot of the screen. In landscape mode this grabs the whole screen. + * In portrait mode, it grabs the upper region of the screen based on the vertical dimension + * of the target image. + * + * @param width the width of the target bitmap + * @param height the height of the target bitmap + */ + public Bitmap screenshotApplications(IBinder appToken, int width, int height) { if (!checkCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER, "screenshotApplications()")) { throw new SecurityException("Requires READ_FRAME_BUFFER permission"); @@ -4739,7 +4747,7 @@ public class WindowManagerService extends IWindowManager.Stub final Rect frame = new Rect(); float scale; - int sw, sh, dw, dh; + int dw, dh; int rot; synchronized(mWindowMap) { @@ -4807,7 +4815,7 @@ public class WindowManagerService extends IWindowManager.Stub // Constrain frame to the screen size. frame.intersect(0, 0, dw, dh); - + if (frame.isEmpty() || maxLayer == 0) { return null; } @@ -4818,15 +4826,7 @@ public class WindowManagerService extends IWindowManager.Stub int fh = frame.height(); // First try reducing to fit in x dimension. - scale = maxWidth/(float)fw; - sw = maxWidth; - sh = (int)(fh*scale); - if (sh > maxHeight) { - // y dimension became too long; constrain by that. - scale = maxHeight/(float)fh; - sw = (int)(fw*scale); - sh = maxHeight; - } + scale = width/(float)fw; // The screen shot will contain the entire screen. dw = (int)(dw*scale); @@ -4845,8 +4845,8 @@ public class WindowManagerService extends IWindowManager.Stub + ") to layer " + maxLayer); return null; } - - Bitmap bm = Bitmap.createBitmap(sw, sh, rawss.getConfig()); + + Bitmap bm = Bitmap.createBitmap(width, height, rawss.getConfig()); Matrix matrix = new Matrix(); ScreenRotationAnimation.createRotationMatrix(rot, dw, dh, matrix); matrix.postTranslate(-(int)(frame.left*scale), -(int)(frame.top*scale)); |