Merge "Fix some bugs with display iteration/removal ordering" into sc-v2-dev am: 45613c7bdb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14981905 Change-Id: Id808fb2b4a90fbd7ad220971429af8f525be65ee
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.navigationbar;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -351,9 +352,7 @@ public class NavigationBarController implements Callbacks,
|
||||
Log.w(TAG, "Cannot get WindowManager.");
|
||||
return;
|
||||
}
|
||||
final Context context = isOnDefaultDisplay
|
||||
? mContext
|
||||
: mContext.createDisplayContext(display);
|
||||
final Context context = mContext.createWindowContext(display, TYPE_NAVIGATION_BAR, null);
|
||||
NavigationBar navBar = new NavigationBar(context,
|
||||
mWindowManager,
|
||||
mAssistManagerLazy,
|
||||
|
||||
@@ -696,6 +696,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
// well and thus won't change the top resumed / focused record
|
||||
boolean mDontMoveToTop;
|
||||
|
||||
private final ArrayList<ActivityRecord> mTmpActivityList = new ArrayList<>();
|
||||
|
||||
private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
|
||||
WindowStateAnimator winAnimator = w.mWinAnimator;
|
||||
final ActivityRecord activity = w.mActivityRecord;
|
||||
@@ -2485,7 +2487,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
|
||||
@Override
|
||||
boolean isVisibleRequested() {
|
||||
return isVisible();
|
||||
return isVisible() && !mRemoved && !mRemoving;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4508,6 +4510,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
}
|
||||
}
|
||||
|
||||
// clear first just in case.
|
||||
mTmpActivityList.clear();
|
||||
// Time to remove any exiting applications?
|
||||
forAllRootTasks(task -> {
|
||||
final ArrayList<ActivityRecord> activities = task.mExitingActivities;
|
||||
@@ -4515,16 +4519,24 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
final ActivityRecord activity = activities.get(j);
|
||||
if (!activity.hasVisible && !mDisplayContent.mClosingApps.contains(activity)
|
||||
&& (!activity.mIsExiting || activity.isEmpty())) {
|
||||
// Make sure there is no animation running on this activity, so any windows
|
||||
// associated with it will be removed as soon as their animations are
|
||||
// complete.
|
||||
cancelAnimation();
|
||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE,
|
||||
"performLayout: Activity exiting now removed %s", activity);
|
||||
activity.removeIfPossible();
|
||||
mTmpActivityList.add(activity);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!mTmpActivityList.isEmpty()) {
|
||||
// Make sure there is no animation running on this activity, so any windows
|
||||
// associated with it will be removed as soon as their animations are
|
||||
// complete.
|
||||
cancelAnimation();
|
||||
}
|
||||
for (int i = 0; i < mTmpActivityList.size(); ++i) {
|
||||
final ActivityRecord activity = mTmpActivityList.get(i);
|
||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE,
|
||||
"performLayout: Activity exiting now removed %s", activity);
|
||||
activity.removeIfPossible();
|
||||
}
|
||||
// Clear afterwards so we don't hold references.
|
||||
mTmpActivityList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -816,8 +816,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
}
|
||||
|
||||
// Initialize state of exiting tokens.
|
||||
final int numDisplays = mChildren.size();
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
|
||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||
displayContent.setExitingTokensHasVisible(false);
|
||||
}
|
||||
@@ -866,7 +865,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
recentsAnimationController.checkAnimationReady(defaultDisplay.mWallpaperController);
|
||||
}
|
||||
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
|
||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||
if (displayContent.mWallpaperMayChange) {
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Wallpaper may change! Adjusting");
|
||||
@@ -928,12 +927,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
}
|
||||
|
||||
// Time to remove any exiting tokens?
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
for (int displayNdx = mChildren.size() - 1; displayNdx >= 0; --displayNdx) {
|
||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||
displayContent.removeExistingTokensIfPossible();
|
||||
}
|
||||
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
|
||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||
if (displayContent.pendingLayoutChanges != 0) {
|
||||
displayContent.setLayoutNeeded();
|
||||
|
||||
@@ -6046,7 +6046,8 @@ class Task extends TaskFragment {
|
||||
|
||||
/** Returns true if a removal action is still being deferred. */
|
||||
boolean handleCompleteDeferredRemoval() {
|
||||
if (isAnimating(TRANSITION | CHILDREN)) {
|
||||
if (isAnimating(TRANSITION | CHILDREN)
|
||||
|| mAtmService.getTransitionController().inTransition(this)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,11 @@ class WindowToken extends WindowContainer<WindowState> {
|
||||
ProtoLog.w(WM_DEBUG_WINDOW_MOVEMENT,
|
||||
"removeAllWindowsIfPossible: removing win=%s", win);
|
||||
win.removeIfPossible();
|
||||
if (i > mChildren.size()) {
|
||||
// It's possible for removeIfPossible to delete siblings (for example if it is a
|
||||
// starting window, it will perform operations on the ActivityRecord).
|
||||
i = mChildren.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user