Remove DisplayContent#mExitingTokens and WindowToken#hasVisible

The mExitingTokens was only used for dumpsys, but almost never seen it
appear in log. The hasVisible is also removed by the way because it
was only used for checking whether to remove items in mExitingTokens.

Besides, WindowState prints mAnimatingExit and WindowContainer prints
animating animator in dumpsys. So it already provides enough info about
the exiting windows for debugging.

Bug: 163976519
Test: CtsWindowManagerDeviceTestCases

Change-Id: Ifaad007cb96e8f86a5a111f3dcf830ed25de3c20
This commit is contained in:
Riddle Hsu
2021-10-25 19:59:58 -06:00
parent 9c6e07a76f
commit fe493243d3
4 changed files with 1 additions and 70 deletions

View File

@@ -465,9 +465,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
@VisibleForTesting
boolean isDefaultDisplay;
/** Window tokens that are in the process of exiting, but still on screen for animations. */
final ArrayList<WindowToken> mExitingTokens = new ArrayList<>();
/** Detect user tapping outside of current focused task bounds .*/
@VisibleForTesting
final TaskTapPointerEventListener mTapDetector;
@@ -3313,17 +3310,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
});
pw.println();
if (!mExitingTokens.isEmpty()) {
pw.println();
pw.println(" Exiting tokens:");
for (int i = mExitingTokens.size() - 1; i >= 0; i--) {
final WindowToken token = mExitingTokens.get(i);
pw.print(" Exiting #"); pw.print(i);
pw.print(' '); pw.print(token);
pw.println(':');
token.dump(pw, " ", dumpAll);
}
}
final ScreenRotationAnimation rotationAnimation = getRotationAnimation();
if (rotationAnimation != null) {
@@ -4573,21 +4559,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
return ret;
}
void setExitingTokensHasVisible(boolean hasVisible) {
for (int i = mExitingTokens.size() - 1; i >= 0; i--) {
mExitingTokens.get(i).hasVisible = hasVisible;
}
}
void removeExistingTokensIfPossible() {
for (int i = mExitingTokens.size() - 1; i >= 0; i--) {
final WindowToken token = mExitingTokens.get(i);
if (!token.hasVisible) {
mExitingTokens.remove(i);
}
}
}
@Override
void onDescendantOverrideConfigurationChanged() {
setLayoutNeeded();

View File

@@ -839,12 +839,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
UPDATE_FOCUS_WILL_PLACE_SURFACES, false /*updateInputWindows*/);
}
// Initialize state of exiting tokens.
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
final DisplayContent displayContent = mChildren.get(displayNdx);
displayContent.setExitingTokensHasVisible(false);
}
mHoldScreen = null;
mScreenBrightnessOverride = PowerManager.BRIGHTNESS_INVALID_FLOAT;
mUserActivityTimeout = -1;
@@ -951,12 +945,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
mWmService.mDestroySurface.clear();
}
// Time to remove any exiting tokens?
for (int displayNdx = mChildren.size() - 1; displayNdx >= 0; --displayNdx) {
final DisplayContent displayContent = mChildren.get(displayNdx);
displayContent.removeExistingTokensIfPossible();
}
for (int displayNdx = 0; displayNdx < mChildren.size(); ++displayNdx) {
final DisplayContent displayContent = mChildren.get(displayNdx);
if (displayContent.pendingLayoutChanges != 0) {

View File

@@ -514,8 +514,6 @@ class WindowStateAnimator {
return;
}
boolean displayed = false;
computeShownFrameLocked();
setSurfaceBoundariesLocked(t);
@@ -535,7 +533,6 @@ class WindowStateAnimator {
}
} else if (mLastAlpha != mShownAlpha
|| mLastHidden) {
displayed = true;
mLastAlpha = mShownAlpha;
ProtoLog.i(WM_SHOW_TRANSACTIONS,
"SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s",
@@ -566,14 +563,10 @@ class WindowStateAnimator {
}
}
}
if (hasSurface()) {
w.mToken.hasVisible = true;
}
} else {
if (DEBUG_ANIM && mWin.isAnimating(TRANSITION | PARENTS)) {
Slog.v(TAG, "prepareSurface: No changes in animation for " + this);
}
displayed = true;
}
if (w.getOrientationChanging()) {
@@ -589,10 +582,6 @@ class WindowStateAnimator {
ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change complete in %s", w);
}
}
if (displayed) {
w.mToken.hasVisible = true;
}
}
/**

View File

@@ -26,8 +26,6 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ADD_REMOVE;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_WINDOW_MOVEMENT;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
import static com.android.server.wm.WindowContainer.AnimationFlags.CHILDREN;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
import static com.android.server.wm.WindowContainerChildProto.WINDOW_TOKEN;
@@ -102,9 +100,6 @@ class WindowToken extends WindowContainer<WindowState> {
// Is key dispatching paused for this token?
boolean paused = false;
// Temporary for finding which tokens no longer have visible windows.
boolean hasVisible;
// Set to true when this token is in a pending transaction where it
// will be shown.
boolean waitingToShow;
@@ -240,6 +235,7 @@ class WindowToken extends WindowContainer<WindowState> {
}
}
/** Starts exit animation or hides windows if needed. It is only used for non-activity token. */
void setExiting(boolean animateExit) {
if (isEmpty()) {
super.removeImmediately();
@@ -255,27 +251,15 @@ class WindowToken extends WindowContainer<WindowState> {
final int count = mChildren.size();
boolean changed = false;
final boolean delayed = isAnimating(TRANSITION | PARENTS)
|| (isAnimating(CHILDREN, ANIMATION_TYPE_WINDOW_ANIMATION) && animateExit);
for (int i = 0; i < count; i++) {
final WindowState win = mChildren.get(i);
changed |= win.onSetAppExiting(animateExit);
}
final ActivityRecord app = asActivityRecord();
if (app != null) {
app.setVisible(false);
}
if (changed) {
mWmService.mWindowPlacerLocked.performSurfacePlacement();
mWmService.updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL, false /*updateInputWindows*/);
}
if (delayed) {
mDisplayContent.mExitingTokens.add(this);
}
}
/**
@@ -723,7 +707,6 @@ class WindowToken extends WindowContainer<WindowState> {
super.dump(pw, prefix, dumpAll);
pw.print(prefix); pw.print("windows="); pw.println(mChildren);
pw.print(prefix); pw.print("windowType="); pw.print(windowType);
pw.print(" hasVisible="); pw.print(hasVisible);
if (waitingToShow) {
pw.print(" waitingToShow=true");
}