summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWale Ogunwale <ogunwale@google.com>2014-12-10 00:09:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-10 00:09:15 +0000
commitc73923bcf9f1ec488c04430db9a6de8c03028a2c (patch)
treefcadb9b8a80bf8f24007c18d04c33427077b219d
parent8386aee1759701cfa791c372da296533f3e47ff3 (diff)
parenteacdf2ce04899b0a3abef55e4e7e1fe9c1649932 (diff)
downloadframeworks_base-c73923bcf9f1ec488c04430db9a6de8c03028a2c.zip
frameworks_base-c73923bcf9f1ec488c04430db9a6de8c03028a2c.tar.gz
frameworks_base-c73923bcf9f1ec488c04430db9a6de8c03028a2c.tar.bz2
Merge "Always take an activity screenshot when pausing."
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java50
1 files changed, 5 insertions, 45 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 02b45a3..9507958 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -222,13 +222,6 @@ final class ActivityStack {
long mLaunchStartTime = 0;
long mFullyDrawnStartTime = 0;
- /**
- * 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 mCurrentUser;
final int mStackId;
@@ -741,18 +734,6 @@ final class ActivityStack {
}
}
- /**
- * This resets the saved state from the last screenshot, forcing a new screenshot to be taken
- * again when requested.
- */
- private void invalidateLastScreenshot() {
- mLastScreenshotActivity = null;
- if (mLastScreenshotBitmap != null) {
- mLastScreenshotBitmap.recycle();
- }
- mLastScreenshotBitmap = null;
- }
-
public final Bitmap screenshotActivities(ActivityRecord who) {
if (DEBUG_SCREENSHOTS) Slog.d(TAG, "screenshotActivities: " + who);
if (who.noDisplay) {
@@ -762,30 +743,17 @@ final class ActivityStack {
if (isHomeStack()) {
// This is an optimization -- since we never show Home or Recents within Recents itself,
- // we can just go ahead and skip taking the screenshot if this is the home stack. In
- // the case where the most recent task is not the task that was supplied, then the stack
- // has changed, so invalidate the last screenshot().
- invalidateLastScreenshot();
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tIs Home stack? " + isHomeStack());
+ // we can just go ahead and skip taking the screenshot if this is the home stack.
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tHome stack");
return null;
}
int w = mService.mThumbnailWidth;
int h = mService.mThumbnailHeight;
if (w > 0) {
- if (who != mLastScreenshotActivity || mLastScreenshotBitmap == null
- || mLastScreenshotActivity.state == ActivityState.RESUMED
- || mLastScreenshotBitmap.getWidth() != w
- || mLastScreenshotBitmap.getHeight() != h) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tUpdating screenshot");
- mLastScreenshotActivity = who;
- mLastScreenshotBitmap = mWindowManager.screenshotApplications(
- who.appToken, Display.DEFAULT_DISPLAY, w, h, SCREENSHOT_FORCE_565);
- }
- if (mLastScreenshotBitmap != null) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tReusing last screenshot");
- return mLastScreenshotBitmap.copy(mLastScreenshotBitmap.getConfig(), true);
- }
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tTaking screenshot");
+ return mWindowManager.screenshotApplications(who.appToken, Display.DEFAULT_DISPLAY,
+ w, h, SCREENSHOT_FORCE_565);
}
Slog.e(TAG, "Invalid thumbnail dimensions: " + w + "x" + h);
return null;
@@ -1103,11 +1071,6 @@ final class ActivityStack {
next.cpuTimeAtResume = 0; // Couldn't get the cpu time of process
}
- // If we are resuming the activity that we had last screenshotted, then we know it will be
- // updated, so invalidate the last screenshot to ensure we take a fresh one when requested
- if (next == mLastScreenshotActivity) {
- invalidateLastScreenshot();
- }
next.returningOptions = null;
if (mActivityContainer.mActivityDisplay.mVisibleBehindActivity == next) {
@@ -1824,9 +1787,6 @@ final class ActivityStack {
// Do over!
mStackSupervisor.scheduleResumeTopActivities();
}
- if (next == mLastScreenshotActivity) {
- invalidateLastScreenshot();
- }
if (mStackSupervisor.reportResumedActivityLocked(next)) {
mNoAnimActivities.clear();
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();