Fix ActivityOption#setTaskOverlay can be covered by other activity.
Although ActivityRecord#setTaskOverlay has set setAlwaysOnTop, but it is not useful in Task#getAdjustedChildPosition, because when sorting activities in a task, it is meanless to check the windowing mode for an activity. A simple solution is to override the isAlwaysOnTop method. And because Task#showToCurrentUser will depends on current top task, so we cannot add the task before adjusting the position. Bug: 181721787 Test: atest RootTaskTests StartActivityAsUserTests StartActivityTests Change-Id: I7fdf19d04bf71fa97a841223c06fad9a7e0b2ee4
This commit is contained in:
@@ -8242,6 +8242,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);
|
||||
|
||||
@@ -3150,11 +3150,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;
|
||||
|
||||
Reference in New Issue
Block a user