Merge "Defer stop for all activities becoming invisible" into pi-dev

This commit is contained in:
Jorim Jaggi
2018-06-26 11:34:03 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 0 deletions

View File

@@ -1654,6 +1654,16 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
void addToStopping(ActivityRecord r, boolean scheduleIdle, boolean idleDelayed) {
if (!mStackSupervisor.mStoppingActivities.contains(r)) {
mStackSupervisor.mStoppingActivities.add(r);
// Some activity is waiting for another activity to become visible before it's being
// stopped, which means that we also want to wait with stopping this one to avoid
// flickers.
if (!mStackSupervisor.mActivitiesWaitingForVisibleActivity.isEmpty()
&& !mStackSupervisor.mActivitiesWaitingForVisibleActivity.contains(r)) {
if (DEBUG_SWITCH) Slog.i(TAG_SWITCH, "adding to waiting visible activity=" + r
+ " existing=" + mStackSupervisor.mActivitiesWaitingForVisibleActivity);
mStackSupervisor.mActivitiesWaitingForVisibleActivity.add(r);
}
}
// If we already have a few activities waiting to stop, then give up

View File

@@ -3937,6 +3937,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
stops = new ArrayList<>();
}
stops.add(s);
// Make sure to remove it in all cases in case we entered this block with
// shouldSleepOrShutDown
mActivitiesWaitingForVisibleActivity.remove(s);
mStoppingActivities.remove(activityNdx);
}
}