DO NOT MERGE Reset top focused root task when task hidden am: 78a9f28282

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14019845

Change-Id: I043dd659efd942aa19e6f6264294b8280e4da3e8
This commit is contained in:
Louis Chang
2021-03-30 17:41:33 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 7 deletions

View File

@@ -4597,11 +4597,11 @@ class Task extends WindowContainer<WindowContainer> {
}
final boolean wasHidden = isForceHidden();
mForceHiddenFlags = newFlags;
if (wasHidden && isFocusableAndVisible()) {
// The change in force-hidden state will change visibility without triggering a stack
// order change, so we should reset the preferred top focusable stack to ensure it's not
// used if a new activity is started from this task.
getDisplayArea().resetPreferredTopFocusableStackIfBelow(this);
if (wasHidden != isForceHidden() && isTopActivityFocusable()) {
// The change in force-hidden state will change visibility without triggering a root
// task order change, so we should reset the preferred top focusable root task to ensure
// it's not used if a new activity is started from this task.
getDisplayArea().resetPreferredTopFocusableRootTaskIfNeeded(this);
}
return true;
}

View File

@@ -773,9 +773,10 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
onStackOrderChanged(stack);
}
void resetPreferredTopFocusableStackIfBelow(Task task) {
/** Reset the mPreferredTopFocusableRootTask if it is or below the given task. */
void resetPreferredTopFocusableRootTaskIfNeeded(Task task) {
if (mPreferredTopFocusableStack != null
&& mPreferredTopFocusableStack.compareTo(task) < 0) {
&& mPreferredTopFocusableStack.compareTo(task) <= 0) {
mPreferredTopFocusableStack = null;
}
}