Merge changes from topic "chromehole" into qt-dev

* changes:
  Only consider gone for layout if parent is gone for layout
  Reland "Prevent dismissing starting window when reopening app"
This commit is contained in:
Jorim Jaggi
2019-07-25 23:07:16 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
@@ -540,6 +541,18 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
waitingToShow = true;
// Let's reset the draw state in order to prevent the starting window to be
// immediately dismissed when the app still has the surface.
forAllWindows(w -> {
if (w.mWinAnimator.mDrawState == HAS_DRAWN) {
w.mWinAnimator.resetDrawState();
// Force add to mResizingWindows, so that we are guaranteed to get
// another reportDrawn callback.
w.resetLastContentInsets();
}
}, true /* traverseTopToBottom */);
}
}

View File

@@ -1623,7 +1623,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|| !mRelayoutCalled
|| (atoken == null && mToken.isHidden())
|| (atoken != null && atoken.hiddenRequested)
|| isParentWindowHidden()
|| isParentWindowGoneForLayout()
|| (mAnimatingExit && !isAnimatingLw())
|| mDestroying;
}
@@ -3795,6 +3795,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return parent != null && parent.mHidden;
}
private boolean isParentWindowGoneForLayout() {
final WindowState parent = getParentWindow();
return parent != null && parent.isGoneForLayoutLw();
}
void setWillReplaceWindow(boolean animate) {
for (int i = mChildren.size() - 1; i >= 0; i--) {
final WindowState c = mChildren.get(i);