From 4d03fe64205e4c2a3d6101b4818ded5b8fa56a0e Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 4 Oct 2013 17:26:37 -0700 Subject: [PATCH] Fix issue #11086275: Thumbnail only created once for top activity If the last screenshot activity is resumed, we need to always capture a new screenshot, because it can change at any time. On the other hand, never create a thumbnail for tasks that have set themselves to not show on the recent tasks lists, since we have no use for them. Change-Id: I38523afc966c125da93339e0100da950119cdf99 --- services/java/com/android/server/am/ActivityStack.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 45b30f1cf60ae..10e13259beb5d 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -678,6 +678,14 @@ final class ActivityStack { return null; } + TaskRecord tr = who.task; + if (tr.intent != null && (tr.intent.getFlags() + &Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0) { + // If this task is being excluded from recents, we don't want to take + // the expense of capturing a thumbnail, since we will never show it. + return null; + } + Resources res = mService.mContext.getResources(); int w = mThumbnailWidth; int h = mThumbnailHeight; @@ -690,6 +698,7 @@ final class ActivityStack { if (w > 0) { if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null + || mLastScreenshotActivity.state == ActivityState.RESUMED || mLastScreenshotBitmap.getWidth() != w || mLastScreenshotBitmap.getHeight() != h) { mLastScreenshotActivity = who;