summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Skuhne <skuhne@google.com> 2015-08-27 09:47:20 -0700
committer Skuhne <skuhne@google.com> 2015-08-27 09:47:20 -0700
commit17690ffcf7ed47b2719c65bb148190ddcdf4232c (patch)
tree4593420329609c25c796306353d881b4c3938575
parent306a1d22b8afa60aad2dca9e6a67788eb774d534 (diff)
Dont update thumbnails of freeform windows on focus change
Windows should not update their thumbnails upon a focus change since it costs a lot of time to capture the content and the thumbnail would be outdated short time later anyways since the window is still visible anyways. Bug: 23562904 Change-Id: If5d23a1058e83030770905827d682f649a579f7a
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java9
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java8
2 files changed, 16 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 965f5b626508..f50df3a1f34f 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -902,7 +902,14 @@ final class ActivityStack {
prev.task.touchActiveTime();
clearLaunchTime(prev);
final ActivityRecord next = mStackSupervisor.topRunningActivityLocked();
- if (mService.mHasRecents && (next == null || next.noDisplay || next.task != prev.task || uiSleeping)) {
+ // In freeform mode we only update the thumbnail when there is no thumbnail yet since every
+ // focus change will request a thumbnail to be taken.
+ // Note furthermore that since windows can change their content in freeform mode all the
+ // time a thumbnail is possibly constantly outdated.
+ if (mService.mHasRecents &&
+ (next == null || next.noDisplay || next.task != prev.task || uiSleeping) &&
+ (!prev.task.hasThumbnail() ||
+ prev.task.stack.mStackId != FREEFORM_WORKSPACE_STACK_ID)) {
prev.updateThumbnailLocked(screenshotActivities(prev), null);
}
stopFullyDrawnTraceIfNeeded();
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 712b8cc9af6b..9cbaec53ce60 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -478,6 +478,14 @@ final class TaskRecord {
}
/**
+ * Returns true when we have a thumbnail.
+ * @return Returns true if there is a thumbnail.
+ */
+ boolean hasThumbnail() {
+ return mLastThumbnail != null;
+ }
+
+ /**
* Sets the last thumbnail.
* @return whether the thumbnail was set
*/