Do not reset preferred top focusable stack before positioning

Top resumed activity was not updated when starting home activity
while home was already resumed and had a pinned stack on top.

When starting home activity, the home task was moving to top,
the preferred top focusable stack was reset before positioning
home task. So, the top focusable stack was the pinned task
because there had a focusable activity (pip-menu activity)
on pinned task.

Bug: 159616359
Bug: 156314330
Test: atest PinnedStackTests#testFinishPipActivityWithTaskOverlay
Change-Id: I44313d1fe9e3d1e7a7a907b9b3eff920032198a8
This commit is contained in:
Louis Chang
2020-07-01 16:48:22 +08:00
parent 276d5d7a0d
commit 1ffdf4222a

View File

@@ -326,14 +326,6 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
final boolean moveToTop = position >= getChildCount() - 1;
final boolean moveToBottom = (position == POSITION_BOTTOM || position == 0);
// Reset mPreferredTopFocusableStack before positioning to top or {@link
// ActivityStackSupervisor#updateTopResumedActivityIfNeeded()} won't update the top
// resumed activity.
final boolean wasContained = mChildren.contains(child);
if (moveToTop && wasContained && child.isFocusable()) {
mPreferredTopFocusableStack = null;
}
if (child.getWindowConfiguration().isAlwaysOnTop() && !moveToTop) {
// This stack is always-on-top, override the default behavior.
Slog.w(TAG_WM, "Ignoring move of always-on-top stack=" + this + " to bottom");
@@ -374,6 +366,9 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
} else if (mPreferredTopFocusableStack == child) {
mPreferredTopFocusableStack = null;
}
// Update the top resumed activity because the preferred top focusable task may be changed.
mAtmService.mStackSupervisor.updateTopResumedActivityIfNeeded();
}
/**