Only take screenshot when hiding activities
So we don't take screenshots when just switching focus between
activities or when docking activities.
Bug: 26070919
Bug: 25845255
Change-Id: Ie924c5f72f4168806b949ad10df7ef139cd280cc
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 60f26e2..b052d17 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -925,7 +925,7 @@
final ActivityRecord next = mStackSupervisor.topRunningActivityLocked();
if (mService.mHasRecents
&& (next == null || next.noDisplay || next.task != prev.task || uiSleeping)) {
- prev.updateThumbnailLocked(screenshotActivitiesLocked(prev), null);
+ prev.mUpdateTaskThumbnailWhenHidden = true;
}
stopFullyDrawnTraceIfNeeded();
@@ -1221,6 +1221,10 @@
private void setVisible(ActivityRecord r, boolean visible) {
r.visible = visible;
+ if (!visible && r.mUpdateTaskThumbnailWhenHidden) {
+ r.updateThumbnailLocked(r.task.stack.screenshotActivitiesLocked(r), null);
+ r.mUpdateTaskThumbnailWhenHidden = false;
+ }
mWindowManager.setAppVisibility(r.appToken, visible);
final ArrayList<ActivityContainer> containers = r.mChildContainers;
for (int containerNdx = containers.size() - 1; containerNdx >= 0; --containerNdx) {