Merge "Fix ActivityOption#setTaskOverlay can be covered by other activity." into sc-dev

This commit is contained in:
Wei Sheng Shih
2021-05-20 08:26:56 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 2 deletions

View File

@@ -8243,6 +8243,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return mTaskOverlay;
}
@Override
public boolean isAlwaysOnTop() {
return mTaskOverlay || super.isAlwaysOnTop();
}
@Override
boolean showToCurrentUser() {
return mShowForAllUsers || mWmService.isCurrentProfile(mUserId);

View File

@@ -3152,11 +3152,14 @@ class Task extends WindowContainer<WindowContainer> {
// Figure-out min/max possible position depending on if child can show for current user.
int minPosition = (canShowChild) ? computeMinUserPosition(0, size) : 0;
int maxPosition = (canShowChild) ? size : computeMaxUserPosition(size - 1);
int maxPosition = (canShowChild) ? size - 1 : computeMaxUserPosition(size - 1);
if (!hasChild(wc)) {
// Increase the maxPosition because children size will grow once wc is added.
++maxPosition;
}
// Factor in always-on-top children in max possible position.
if (!wc.isAlwaysOnTop()) {
// We want to place all non-always-on-top containers below always-on-top ones.
while (maxPosition > minPosition) {
if (!mChildren.get(maxPosition - 1).isAlwaysOnTop()) break;