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;
|
package com.android.systemui.navigationbar;
|
||||||
|
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
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 static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -351,9 +352,7 @@ public class NavigationBarController implements Callbacks,
|
|||||||
Log.w(TAG, "Cannot get WindowManager.");
|
Log.w(TAG, "Cannot get WindowManager.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Context context = isOnDefaultDisplay
|
final Context context = mContext.createWindowContext(display, TYPE_NAVIGATION_BAR, null);
|
||||||
? mContext
|
|
||||||
: mContext.createDisplayContext(display);
|
|
||||||
NavigationBar navBar = new NavigationBar(context,
|
NavigationBar navBar = new NavigationBar(context,
|
||||||
mWindowManager,
|
mWindowManager,
|
||||||
mAssistManagerLazy,
|
mAssistManagerLazy,
|
||||||
|
|||||||
@@ -696,6 +696,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// well and thus won't change the top resumed / focused record
|
// well and thus won't change the top resumed / focused record
|
||||||
boolean mDontMoveToTop;
|
boolean mDontMoveToTop;
|
||||||
|
|
||||||
|
private final ArrayList<ActivityRecord> mTmpActivityList = new ArrayList<>();
|
||||||
|
|
||||||
private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
|
private final Consumer<WindowState> mUpdateWindowsForAnimator = w -> {
|
||||||
WindowStateAnimator winAnimator = w.mWinAnimator;
|
WindowStateAnimator winAnimator = w.mWinAnimator;
|
||||||
final ActivityRecord activity = w.mActivityRecord;
|
final ActivityRecord activity = w.mActivityRecord;
|
||||||
@@ -2485,7 +2487,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isVisibleRequested() {
|
boolean isVisibleRequested() {
|
||||||
return isVisible();
|
return isVisible() && !mRemoved && !mRemoving;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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?
|
// Time to remove any exiting applications?
|
||||||
forAllRootTasks(task -> {
|
forAllRootTasks(task -> {
|
||||||
final ArrayList<ActivityRecord> activities = task.mExitingActivities;
|
final ArrayList<ActivityRecord> activities = task.mExitingActivities;
|
||||||
@@ -4515,16 +4519,24 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
final ActivityRecord activity = activities.get(j);
|
final ActivityRecord activity = activities.get(j);
|
||||||
if (!activity.hasVisible && !mDisplayContent.mClosingApps.contains(activity)
|
if (!activity.hasVisible && !mDisplayContent.mClosingApps.contains(activity)
|
||||||
&& (!activity.mIsExiting || activity.isEmpty())) {
|
&& (!activity.mIsExiting || activity.isEmpty())) {
|
||||||
|
mTmpActivityList.add(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!mTmpActivityList.isEmpty()) {
|
||||||
// Make sure there is no animation running on this activity, so any windows
|
// 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
|
// associated with it will be removed as soon as their animations are
|
||||||
// complete.
|
// complete.
|
||||||
cancelAnimation();
|
cancelAnimation();
|
||||||
|
}
|
||||||
|
for (int i = 0; i < mTmpActivityList.size(); ++i) {
|
||||||
|
final ActivityRecord activity = mTmpActivityList.get(i);
|
||||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE,
|
ProtoLog.v(WM_DEBUG_ADD_REMOVE,
|
||||||
"performLayout: Activity exiting now removed %s", activity);
|
"performLayout: Activity exiting now removed %s", activity);
|
||||||
activity.removeIfPossible();
|
activity.removeIfPossible();
|
||||||
}
|
}
|
||||||
}
|
// Clear afterwards so we don't hold references.
|
||||||
});
|
mTmpActivityList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -816,8 +816,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize state of exiting tokens.
|
// Initialize state of exiting tokens.
|
||||||
final int numDisplays = mChildren.size();
|
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
|
||||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
|
||||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||||
displayContent.setExitingTokensHasVisible(false);
|
displayContent.setExitingTokensHasVisible(false);
|
||||||
}
|
}
|
||||||
@@ -866,7 +865,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
recentsAnimationController.checkAnimationReady(defaultDisplay.mWallpaperController);
|
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);
|
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||||
if (displayContent.mWallpaperMayChange) {
|
if (displayContent.mWallpaperMayChange) {
|
||||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Wallpaper may change! Adjusting");
|
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?
|
// 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);
|
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||||
displayContent.removeExistingTokensIfPossible();
|
displayContent.removeExistingTokensIfPossible();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
|
||||||
final DisplayContent displayContent = mChildren.get(displayNdx);
|
final DisplayContent displayContent = mChildren.get(displayNdx);
|
||||||
if (displayContent.pendingLayoutChanges != 0) {
|
if (displayContent.pendingLayoutChanges != 0) {
|
||||||
displayContent.setLayoutNeeded();
|
displayContent.setLayoutNeeded();
|
||||||
|
|||||||
@@ -6046,7 +6046,8 @@ class Task extends TaskFragment {
|
|||||||
|
|
||||||
/** Returns true if a removal action is still being deferred. */
|
/** Returns true if a removal action is still being deferred. */
|
||||||
boolean handleCompleteDeferredRemoval() {
|
boolean handleCompleteDeferredRemoval() {
|
||||||
if (isAnimating(TRANSITION | CHILDREN)) {
|
if (isAnimating(TRANSITION | CHILDREN)
|
||||||
|
|| mAtmService.getTransitionController().inTransition(this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,11 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
ProtoLog.w(WM_DEBUG_WINDOW_MOVEMENT,
|
ProtoLog.w(WM_DEBUG_WINDOW_MOVEMENT,
|
||||||
"removeAllWindowsIfPossible: removing win=%s", win);
|
"removeAllWindowsIfPossible: removing win=%s", win);
|
||||||
win.removeIfPossible();
|
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