diff options
| author | 2012-12-20 16:07:06 -0800 | |
|---|---|---|
| committer | 2012-12-20 16:24:58 -0800 | |
| commit | b12428a128f358bbf23a54471e552dd49b2eaef4 (patch) | |
| tree | 1b16a3cb145382a69c162dcd4e5c2618c2521d70 | |
| parent | 5b88cd721870748a071364852f19f266a8ea1de6 (diff) | |
Save most recent thumbnail Bitmap for reuse.
This keeps Recents from taking two identical screenshots, one for
the Recents thumbnail and one for the pause activity thumbnail.
Fixes bug 7351766.
Change-Id: Ia4d12802151666ec36e4d9b395cf10e1e02dc37f
| -rw-r--r-- | services/java/com/android/server/am/ActivityStack.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index b007bc8bdbe2..0e01e4cb2a74 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -45,6 +45,7 @@ import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; import android.os.Binder; import android.os.Bundle; import android.os.Handler; @@ -280,6 +281,13 @@ final class ActivityStack { */ boolean mDismissKeyguardOnNextActivity = false; + /** + * Save the most recent screenshot for reuse. This keeps Recents from taking two identical + * screenshots, one for the Recents thumbnail and one for the pauseActivity thumbnail. + */ + private ActivityRecord mLastScreenshotActivity = null; + private Bitmap mLastScreenshotBitmap = null; + int mThumbnailWidth = -1; int mThumbnailHeight = -1; @@ -931,8 +939,16 @@ final class ActivityStack { } if (w > 0) { - return mService.mWindowManager.screenshotApplications(who.appToken, - Display.DEFAULT_DISPLAY, w, h); + if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null + || mLastScreenshotBitmap.getWidth() != w + || mLastScreenshotBitmap.getHeight() != h) { + mLastScreenshotActivity = who; + mLastScreenshotBitmap = mService.mWindowManager.screenshotApplications( + who.appToken, Display.DEFAULT_DISPLAY, w, h); + } + if (mLastScreenshotBitmap != null) { + return mLastScreenshotBitmap.copy(Config.ARGB_8888, true); + } } return null; } |