diff options
Diffstat (limited to 'services/java/com')
3 files changed, 12 insertions, 5 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index f2ff9ca..f23bcba 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -254,7 +254,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean IS_USER_BUILD = "user".equals(Build.TYPE); // Maximum number of recent tasks that we can remember. - static final int MAX_RECENT_TASKS = 20; + static final int MAX_RECENT_TASKS = ActivityManager.isLowRamDeviceStatic() ? 10 : 20; // Amount of time after a call to stopAppSwitches() during which we will // prevent further untrusted switches from happening. diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 28c87d1..45b30f1 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -121,6 +121,9 @@ final class ActivityStack { // convertToTranslucent(). static final long TRANSLUCENT_CONVERSION_TIMEOUT = 2000; + static final boolean SCREENSHOT_FORCE_565 = ActivityManager + .isLowRamDeviceStatic() ? true : false; + enum ActivityState { INITIALIZING, RESUMED, @@ -691,10 +694,10 @@ final class ActivityStack { || mLastScreenshotBitmap.getHeight() != h) { mLastScreenshotActivity = who; mLastScreenshotBitmap = mWindowManager.screenshotApplications( - who.appToken, Display.DEFAULT_DISPLAY, w, h); + who.appToken, Display.DEFAULT_DISPLAY, w, h, SCREENSHOT_FORCE_565); } if (mLastScreenshotBitmap != null) { - return mLastScreenshotBitmap.copy(Config.ARGB_8888, true); + return mLastScreenshotBitmap.copy(mLastScreenshotBitmap.getConfig(), true); } } return null; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index e625cae..3b572e4 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -60,6 +60,7 @@ import android.content.pm.PackageManager; import android.content.res.CompatibilityInfo; import android.content.res.Configuration; import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.PixelFormat; @@ -5513,9 +5514,12 @@ public class WindowManagerService extends IWindowManager.Stub * @param displayId the Display to take a screenshot of. * @param width the width of the target bitmap * @param height the height of the target bitmap + * @param force565 if true the returned bitmap will be RGB_565, otherwise it + * will be the same config as the surface */ @Override - public Bitmap screenshotApplications(IBinder appToken, int displayId, int width, int height) { + public Bitmap screenshotApplications(IBinder appToken, int displayId, int width, + int height, boolean force565) { if (!checkCallingPermission(android.Manifest.permission.READ_FRAME_BUFFER, "screenshotApplications()")) { throw new SecurityException("Requires READ_FRAME_BUFFER permission"); @@ -5718,7 +5722,7 @@ public class WindowManagerService extends IWindowManager.Stub return null; } - Bitmap bm = Bitmap.createBitmap(width, height, rawss.getConfig()); + Bitmap bm = Bitmap.createBitmap(width, height, force565 ? Config.RGB_565 : rawss.getConfig()); frame.scale(scale); Matrix matrix = new Matrix(); ScreenRotationAnimation.createRotationMatrix(rot, dw, dh, matrix); |