Clean up visibility related flags in WindowToken

- Replace isHidden() and setHidden() by isVisible() and setVisible()
  in accordance with variable names.
- Move isVisible() from AppRecord to WindowToken

Test: Refactoring CL, existing tests pass.
Bug: 80414790
Change-Id: Ib39200acbedf204adf57c06a8b8bbb3d07f959d1
This commit is contained in:
Issei Suzuki
2019-11-08 11:24:18 +01:00
parent 17c36347cc
commit f2f6c91dd3
16 changed files with 120 additions and 128 deletions

View File

@@ -126,11 +126,12 @@ message ActivityRecordProto {
optional .com.android.server.wm.ConfigurationContainerProto configuration_container = 1 [deprecated=true];
optional .com.android.server.wm.IdentifierProto identifier = 2;
optional string state = 3;
optional bool visible = 4;
optional bool visible_requested = 4;
optional bool front_of_task = 5;
optional int32 proc_id = 6;
optional bool translucent = 7;
optional .com.android.server.wm.AppWindowTokenProto app_window_token = 8;
optional bool visible = 9;
}
message KeyguardControllerProto {

View File

@@ -249,8 +249,9 @@ message AppWindowTokenProto {
optional IdentifierProto starting_window = 19;
optional bool starting_displayed = 20;
optional bool starting_moved = 21;
optional bool hidden_set_from_transferred_starting_window = 22;
optional bool visible_set_from_transferred_starting_window = 22;
repeated .android.graphics.RectProto frozen_bounds = 23;
optional bool visible = 24;
}
/* represents WindowToken */
@@ -260,7 +261,6 @@ message WindowTokenProto {
optional WindowContainerProto window_container = 1;
optional int32 hash_code = 2;
repeated WindowStateProto windows = 3;
optional bool hidden = 4;
optional bool waiting_to_show = 5;
optional bool paused = 6;
}

View File

@@ -73,10 +73,10 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-1972506791": {
"message": "Set freezing of %s: hidden=%b freezing=%b visibleRequested=%b. %s",
"level": "INFO",
"group": "WM_DEBUG_ORIENTATION",
"-1976550065": {
"message": "commitVisibility: %s: visible=%b visibleRequested=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-1963461591": {
@@ -85,12 +85,6 @@
"group": "WM_DEBUG_ADD_REMOVE",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-1958209312": {
"message": "Clear freezing of %s: hidden=%b freezing=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-1953668890": {
"message": "Can't start recents animation, nextAppTransition=%s",
"level": "DEBUG",
@@ -547,12 +541,6 @@
"group": "WM_DEBUG_STARTING_WINDOW",
"at": "com\/android\/server\/wm\/WindowState.java"
},
"-931184679": {
"message": "Changing app %s hidden=%b performLayout=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-928291778": {
"message": "applyAnimation: anim=%s nextAppTransition=%d transit=%s Callers=%s",
"level": "VERBOSE",
@@ -841,6 +829,12 @@
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/AppTransitionController.java"
},
"-374767836": {
"message": "setAppVisibility(%s, visible=%b): %s visible=%b mVisibleRequested=%b Callers=%s",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-371630969": {
"message": "New wallpaper target=%s, oldWallpaper=%s, openingApps=%s, closingApps=%s",
"level": "VERBOSE",
@@ -883,12 +877,6 @@
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-229838822": {
"message": "setAppVisibility(%s, visible=%b): %s hidden=%b mVisibleRequested=%b Callers=%s",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"-198463978": {
"message": "updateRotationUnchecked: alwaysSendConfiguration=%b forceRelayout=%b",
"level": "VERBOSE",
@@ -1273,6 +1261,12 @@
"group": "WM_DEBUG_SCREEN_ON",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"466506262": {
"message": "Clear freezing of %s: visible=%b freezing=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"474000473": {
"message": "No stack above target stack=%s",
"level": "DEBUG",
@@ -1483,6 +1477,12 @@
"group": "WM_DEBUG_REMOTE_ANIMATIONS",
"at": "com\/android\/server\/wm\/RemoteAnimationController.java"
},
"841702299": {
"message": "Changing app %s visible=%b performLayout=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"845234215": {
"message": "App is requesting an orientation, return %d for display id=%d",
"level": "VERBOSE",
@@ -1891,6 +1891,12 @@
"group": "WM_DEBUG_STARTING_WINDOW",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"1746778201": {
"message": "Set freezing of %s: visible=%b freezing=%b visibleRequested=%b. %s",
"level": "INFO",
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"1747941491": {
"message": "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
"level": "INFO",
@@ -1987,12 +1993,6 @@
"group": "WM_DEBUG_REMOTE_ANIMATIONS",
"at": "com\/android\/server\/wm\/RemoteAnimationController.java"
},
"1965198071": {
"message": "commitVisibility: %s: hidden=%b visibleRequested=%b",
"level": "VERBOSE",
"group": "WM_DEBUG_APP_TRANSITIONS",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"1984470582": {
"message": "Creating TaskScreenshotAnimatable: task: %s width: %d height: %d",
"level": "DEBUG",

View File

@@ -121,6 +121,7 @@ import static com.android.server.am.ActivityRecordProto.PROC_ID;
import static com.android.server.am.ActivityRecordProto.STATE;
import static com.android.server.am.ActivityRecordProto.TRANSLUCENT;
import static com.android.server.am.ActivityRecordProto.VISIBLE;
import static com.android.server.am.ActivityRecordProto.VISIBLE_REQUESTED;
import static com.android.server.am.EventLogTags.AM_RELAUNCH_ACTIVITY;
import static com.android.server.am.EventLogTags.AM_RELAUNCH_RESUME_ACTIVITY;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
@@ -176,7 +177,6 @@ import static com.android.server.wm.AppWindowTokenProto.CLIENT_HIDDEN;
import static com.android.server.wm.AppWindowTokenProto.DEFER_HIDING_CLIENT;
import static com.android.server.wm.AppWindowTokenProto.FILLS_PARENT;
import static com.android.server.wm.AppWindowTokenProto.FROZEN_BOUNDS;
import static com.android.server.wm.AppWindowTokenProto.HIDDEN_SET_FROM_TRANSFERRED_STARTING_WINDOW;
import static com.android.server.wm.AppWindowTokenProto.IS_ANIMATING;
import static com.android.server.wm.AppWindowTokenProto.IS_WAITING_FOR_TRANSITION_START;
import static com.android.server.wm.AppWindowTokenProto.LAST_ALL_DRAWN;
@@ -190,7 +190,7 @@ import static com.android.server.wm.AppWindowTokenProto.STARTING_DISPLAYED;
import static com.android.server.wm.AppWindowTokenProto.STARTING_MOVED;
import static com.android.server.wm.AppWindowTokenProto.STARTING_WINDOW;
import static com.android.server.wm.AppWindowTokenProto.THUMBNAIL;
import static com.android.server.wm.AppWindowTokenProto.VISIBLE_REQUESTED;
import static com.android.server.wm.AppWindowTokenProto.VISIBLE_SET_FROM_TRANSFERRED_STARTING_WINDOW;
import static com.android.server.wm.AppWindowTokenProto.WINDOW_TOKEN;
import static com.android.server.wm.IdentifierProto.HASH_CODE;
import static com.android.server.wm.IdentifierProto.TITLE;
@@ -461,12 +461,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
private boolean keysPaused; // has key dispatching been paused for it?
int launchMode; // the launch mode activity attribute.
int lockTaskLaunchMode; // the lockTaskMode manifest attribute, subject to override
private boolean mVisible; // Should this token's windows be visible?
boolean visibleIgnoringKeyguard; // is this activity visible, ignoring the fact that Keyguard
// might hide this activity?
// True if the hidden state of this token was forced to false due to a transferred starting
// window.
private boolean mHiddenSetFromTransferredStartingWindow;
// TODO: figureout how to consolidate with the same variable in ActivityRecord.
private boolean mVisibleSetFromTransferredStartingWindow;
// TODO: figure out how to consolidate with the same variable in ActivityRecord.
private boolean mDeferHidingClient; // If true we told WM to defer reporting to the client
// process that it is hidden.
private boolean mLastDeferHidingClient; // If true we will defer setting mClientHidden to true
@@ -849,6 +850,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
pw.println(requestedVrComponent);
}
super.dump(pw, prefix, dumpAll);
pw.print(" visible="); pw.print(mVisible);
if (appToken != null) {
pw.println(prefix + "app=true mVoiceInteraction=" + mVoiceInteraction);
}
@@ -879,13 +881,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
pw.print(" mIsExiting="); pw.println(mIsExiting);
}
if (startingWindow != null || startingSurface != null
|| startingDisplayed || startingMoved || mHiddenSetFromTransferredStartingWindow) {
|| startingDisplayed || startingMoved || mVisibleSetFromTransferredStartingWindow) {
pw.print(prefix); pw.print("startingWindow="); pw.print(startingWindow);
pw.print(" startingSurface="); pw.print(startingSurface);
pw.print(" startingDisplayed="); pw.print(startingDisplayed);
pw.print(" startingMoved="); pw.print(startingMoved);
pw.println(" mHiddenSetFromTransferredStartingWindow="
+ mHiddenSetFromTransferredStartingWindow);
+ mVisibleSetFromTransferredStartingWindow);
}
if (!mFrozenBounds.isEmpty()) {
pw.print(prefix); pw.print("mFrozenBounds="); pw.println(mFrozenBounds);
@@ -1481,7 +1483,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
// Application tokens start out hidden.
setHidden(true);
setVisible(false);
mVisibleRequested = false;
ColorDisplayService.ColorDisplayServiceInternal cds = LocalServices.getService(
@@ -3198,7 +3200,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
"Removing starting %s from %s", tStartingWindow, fromActivity);
fromActivity.removeChild(tStartingWindow);
fromActivity.postWindowRemoveStartingWindowCleanup(tStartingWindow);
fromActivity.mHiddenSetFromTransferredStartingWindow = false;
fromActivity.mVisibleSetFromTransferredStartingWindow = false;
addWindow(tStartingWindow);
// Propagate other interesting state between the tokens. If the old token is displayed,
@@ -3211,10 +3213,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (fromActivity.firstWindowDrawn) {
firstWindowDrawn = true;
}
if (!fromActivity.isHidden()) {
setHidden(false);
if (fromActivity.isVisible()) {
setVisible(true);
mVisibleRequested = true;
mHiddenSetFromTransferredStartingWindow = true;
mVisibleSetFromTransferredStartingWindow = true;
}
setClientHidden(fromActivity.mClientHidden);
@@ -3828,7 +3830,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
boolean isVisible() {
// If the activity isn't hidden then it is considered visible and there is no need to check
// its children windows to see if they are visible.
return !isHidden();
return mVisible;
}
void setVisible(boolean visible) {
if (visible != mVisible) {
mVisible = visible;
scheduleAnimation();
}
}
void setVisibility(boolean visible) {
@@ -3870,8 +3879,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
"setAppVisibility(%s, visible=%b): %s hidden=%b mVisibleRequested=%b Callers=%s",
appToken, visible, appTransition, isHidden(), mVisibleRequested,
"setAppVisibility(%s, visible=%b): %s visible=%b mVisibleRequested=%b Callers=%s",
appToken, visible, appTransition, isVisible(), mVisibleRequested,
Debug.getCallers(6));
final DisplayContent displayContent = getDisplayContent();
@@ -3901,11 +3910,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
startingMoved = false;
// If the token is currently hidden (should be the common case), or has been
// stopped, then we need to set up to wait for its windows to be ready.
if (isHidden() || mAppStopped) {
if (!isVisible() || mAppStopped) {
clearAllDrawn();
// If the app was already visible, don't reset the waitingToShow state.
if (isHidden()) {
if (!isVisible()) {
waitingToShow = true;
// If the client isn't hidden, we don't need to reset the drawing state.
@@ -3975,9 +3984,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
boolean visible, int transit, boolean performLayout, boolean isVoiceInteraction) {
boolean delayed = false;
// Reset the state of mHiddenSetFromTransferredStartingWindow since visibility is actually
// Reset the state of mVisibleSetFromTransferredStartingWindow since visibility is actually
// been set by the app now.
mHiddenSetFromTransferredStartingWindow = false;
mVisibleSetFromTransferredStartingWindow = false;
// Allow for state changes and animation to be applied if:
// * token is transitioning visibility state
@@ -3987,7 +3996,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// * or the token is the opening app and visible while opening task behind existing one.
final DisplayContent displayContent = getDisplayContent();
boolean visibilityChanged = false;
if (isHidden() == visible || (isHidden() && mIsExiting)
if (isVisible() != visible || (!isVisible() && mIsExiting)
|| (visible && waitingForReplacement())
|| (visible && displayContent.mOpeningApps.contains(this)
&& displayContent.mAppTransition.getAppTransition() == TRANSIT_TASK_OPEN_BEHIND)) {
@@ -3995,7 +4004,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
mWmService.mAccessibilityController;
boolean changed = false;
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
"Changing app %s hidden=%b performLayout=%b", this, isHidden(),
"Changing app %s visible=%b performLayout=%b", this, isVisible(),
performLayout);
boolean runningAppAnimation = false;
@@ -4020,7 +4029,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
changed |= win.onAppVisibilityChanged(visible, runningAppAnimation);
}
setHidden(!visible);
setVisible(visible);
mVisibleRequested = visible;
visibilityChanged = true;
if (!visible) {
@@ -4039,8 +4048,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
"commitVisibility: %s: hidden=%b visibleRequested=%b", this,
isHidden(), mVisibleRequested);
"commitVisibility: %s: visible=%b visibleRequested=%b", this,
isVisible(), mVisibleRequested);
if (changed) {
displayContent.getInputMonitor().setUpdateInputWindowsNeededLw();
@@ -4104,7 +4113,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// no animation but there will still be a transition set.
// We still need to delay hiding the surface such that it
// can be synchronized with showing the next surface in the transition.
if (isHidden() && !delayed && !displayContent.mAppTransition.isTransitionSet()) {
if (!isVisible() && !delayed && !displayContent.mAppTransition.isTransitionSet()) {
SurfaceControl.openTransaction();
for (int i = mChildren.size() - 1; i >= 0; i--) {
mChildren.get(i).mWinAnimator.hide("immediately hidden");
@@ -4116,12 +4125,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return delayed;
}
@Override
void setHidden(boolean hidden) {
super.setHidden(hidden);
scheduleAnimation();
}
/**
* See {@link Activity#setDisablePreviewScreenshots}.
*/
@@ -4882,8 +4885,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
void startFreezingScreen() {
ProtoLog.i(WM_DEBUG_ORIENTATION,
"Set freezing of %s: hidden=%b freezing=%b visibleRequested=%b. %s",
appToken, isHidden(), mFreezingScreen, mVisibleRequested,
"Set freezing of %s: visible=%b freezing=%b visibleRequested=%b. %s",
appToken, isVisible(), mFreezingScreen, mVisibleRequested,
new RuntimeException().fillInStackTrace());
if (mVisibleRequested) {
if (!mFreezingScreen) {
@@ -4921,8 +4924,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
return;
}
ProtoLog.v(WM_DEBUG_ORIENTATION,
"Clear freezing of %s: hidden=%b freezing=%b", appToken,
isHidden(), isFreezingScreen());
"Clear freezing of %s: visible=%b freezing=%b", appToken,
isVisible(), isFreezingScreen());
stopFreezingScreen(true, force);
}
}
@@ -5082,7 +5085,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
boolean nowGone = mReportedVisibilityResults.nowGone;
boolean nowDrawn = numInteresting > 0 && numDrawn >= numInteresting;
boolean nowVisible = numInteresting > 0 && numVisible >= numInteresting && !isHidden();
boolean nowVisible = numInteresting > 0 && numVisible >= numInteresting && isVisible();
if (!nowGone) {
// If the app is not yet gone, then it can only become visible/drawn.
if (!nowDrawn) {
@@ -5443,11 +5446,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// well there is no point now.
ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Nulling last startingData");
mStartingData = null;
if (mHiddenSetFromTransferredStartingWindow) {
// We set the hidden state to false for the token from a transferred starting window.
// We now reset it back to true since the starting window was the last window in the
// token.
setHidden(true);
if (mVisibleSetFromTransferredStartingWindow) {
// We set the visible state to true for the token from a transferred starting
// window. We now reset it back to false since the starting window was the last
// window in the token.
setVisible(false);
}
} else if (mChildren.size() == 1 && startingSurface != null && !isRelaunching()) {
// If this is the last window except for a starting transition window,
@@ -5785,7 +5788,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
@Override
void prepareSurfaces() {
final boolean show = !isHidden() || isAnimating();
final boolean show = isVisible() || isAnimating();
if (mSurfaceControl != null) {
if (show && !mLastSurfaceShowing) {
@@ -5904,7 +5907,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
"AppWindowToken");
clearThumbnail();
setClientHidden(isHidden() && !mVisibleRequested);
setClientHidden(!isVisible() && !mVisibleRequested);
getDisplayContent().computeImeTargetIfNeeded(this);
@@ -7287,12 +7290,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
writeToProto(proto, APP_WINDOW_TOKEN, WindowTraceLogLevel.ALL);
writeIdentifierToProto(proto, IDENTIFIER);
proto.write(STATE, mState.toString());
proto.write(VISIBLE, mVisibleRequested);
proto.write(VISIBLE_REQUESTED, mVisibleRequested);
proto.write(FRONT_OF_TASK, isRootOfTask());
if (hasProcess()) {
proto.write(PROC_ID, app.getPid());
}
proto.write(TRANSLUCENT, !occludesParent());
proto.write(VISIBLE, mVisible);
}
public void writeToProto(ProtoOutputStream proto, long fieldId) {
@@ -7323,7 +7327,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
proto.write(FILLS_PARENT, mOccludesParent);
proto.write(APP_STOPPED, mAppStopped);
proto.write(VISIBLE_REQUESTED, mVisibleRequested);
proto.write(com.android.server.wm.AppWindowTokenProto.VISIBLE_REQUESTED, mVisibleRequested);
proto.write(CLIENT_HIDDEN, mClientHidden);
proto.write(DEFER_HIDING_CLIENT, mDeferHidingClient);
proto.write(REPORTED_DRAWN, reportedDrawn);
@@ -7337,11 +7341,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
proto.write(STARTING_DISPLAYED, startingDisplayed);
proto.write(STARTING_MOVED, startingMoved);
proto.write(HIDDEN_SET_FROM_TRANSFERRED_STARTING_WINDOW,
mHiddenSetFromTransferredStartingWindow);
proto.write(VISIBLE_SET_FROM_TRANSFERRED_STARTING_WINDOW,
mVisibleSetFromTransferredStartingWindow);
for (Rect bounds : mFrozenBounds) {
bounds.writeToProto(proto, FROZEN_BOUNDS);
}
proto.write(com.android.server.wm.AppWindowTokenProto.VISIBLE, mVisible);
proto.end(token);
}

View File

@@ -688,15 +688,16 @@ public class AppTransitionController {
* compare z-order.
*
* @param apps The list of apps to search.
* @param ignoreHidden If set to true, ignores apps that are {@link ActivityRecord#isHidden}.
* @param ignoreInvisible If set to true, ignores apps that are not
* {@link ActivityRecord#isVisible}.
* @return The top {@link ActivityRecord}.
*/
private ActivityRecord getTopApp(ArraySet<ActivityRecord> apps, boolean ignoreHidden) {
private ActivityRecord getTopApp(ArraySet<ActivityRecord> apps, boolean ignoreInvisible) {
int topPrefixOrderIndex = Integer.MIN_VALUE;
ActivityRecord topApp = null;
for (int i = apps.size() - 1; i >= 0; i--) {
final ActivityRecord app = apps.valueAt(i);
if (ignoreHidden && app.isHidden()) {
if (ignoreInvisible && !app.isVisible()) {
continue;
}
final int prefixOrderIndex = app.getPrefixOrderIndex();

View File

@@ -644,11 +644,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
+ " config reported=" + w.isLastConfigReportedToClient());
final ActivityRecord activity = w.mActivityRecord;
if (gone) Slog.v(TAG, " GONE: mViewVisibility=" + w.mViewVisibility
+ " mRelayoutCalled=" + w.mRelayoutCalled + " hidden=" + w.mToken.isHidden()
+ " mRelayoutCalled=" + w.mRelayoutCalled + " visible=" + w.mToken.isVisible()
+ " visibleRequested=" + (activity != null && activity.mVisibleRequested)
+ " parentHidden=" + w.isParentWindowHidden());
else Slog.v(TAG, " VIS: mViewVisibility=" + w.mViewVisibility
+ " mRelayoutCalled=" + w.mRelayoutCalled + " hidden=" + w.mToken.isHidden()
+ " mRelayoutCalled=" + w.mRelayoutCalled + " visible=" + w.mToken.isVisible()
+ " visibleRequested=" + (activity != null && activity.mVisibleRequested)
+ " parentHidden=" + w.isParentWindowHidden());
}

View File

@@ -120,7 +120,7 @@ class WallpaperController {
}
mFindResults.resetTopWallpaper = true;
if (w.mActivityRecord != null && w.mActivityRecord.isHidden()
if (w.mActivityRecord != null && !w.mActivityRecord.isVisible()
&& !w.mActivityRecord.isAnimating(TRANSITION)) {
// If this window's app token is hidden and not animating, it is of no interest to us.
@@ -278,9 +278,11 @@ class WallpaperController {
for (int i = mWallpaperTokens.size() - 1; i >= 0; i--) {
final WallpaperWindowToken token = mWallpaperTokens.get(i);
token.hideWallpaperToken(wasDeferred, "hideWallpapers");
if (DEBUG_WALLPAPER_LIGHT && !token.isHidden()) Slog.d(TAG, "Hiding wallpaper " + token
+ " from " + winGoingAway + " target=" + mWallpaperTarget + " prev="
+ mPrevWallpaperTarget + "\n" + Debug.getCallers(5, " "));
if (DEBUG_WALLPAPER_LIGHT && token.isVisible()) {
Slog.d(TAG, "Hiding wallpaper " + token
+ " from " + winGoingAway + " target=" + mWallpaperTarget + " prev="
+ mPrevWallpaperTarget + "\n" + Debug.getCallers(5, " "));
}
}
}

View File

@@ -56,7 +56,6 @@ class WallpaperWindowToken extends WindowToken {
final WindowState wallpaper = mChildren.get(j);
wallpaper.hideWallpaperWindow(wasDeferred, reason);
}
setHidden(true);
}
void sendWindowWallpaperCommand(
@@ -88,9 +87,7 @@ class WallpaperWindowToken extends WindowToken {
final int dw = displayInfo.logicalWidth;
final int dh = displayInfo.logicalHeight;
if (isHidden() == visible) {
setHidden(!visible);
if (isVisible() != visible) {
// Need to do a layout to ensure the wallpaper now has the correct size.
mDisplayContent.setLayoutNeeded();
}
@@ -118,10 +115,9 @@ class WallpaperWindowToken extends WindowToken {
void updateWallpaperWindows(boolean visible) {
if (isHidden() == visible) {
if (isVisible() != visible) {
if (DEBUG_WALLPAPER_LIGHT) Slog.d(TAG,
"Wallpaper token " + token + " hidden=" + !visible);
setHidden(!visible);
"Wallpaper token " + token + " visible=" + visible);
// Need to do a layout to ensure the wallpaper now has the correct size.
mDisplayContent.setLayoutNeeded();
}

View File

@@ -1569,7 +1569,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* not the pending requested hidden state.
*/
boolean isVisibleNow() {
return (!mToken.isHidden() || mAttrs.type == TYPE_APPLICATION_STARTING)
return (mToken.isVisible() || mAttrs.type == TYPE_APPLICATION_STARTING)
&& isVisible();
}
@@ -1642,7 +1642,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return false;
}
final boolean parentAndClientVisible = !isParentWindowHidden()
&& mViewVisibility == View.VISIBLE && !mToken.isHidden();
&& mViewVisibility == View.VISIBLE && mToken.isVisible();
return mHasSurface && isVisibleByPolicy() && !mDestroying
&& (parentAndClientVisible || isAnimating(TRANSITION | PARENTS));
}
@@ -1661,7 +1661,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
} else {
final Task task = getTask();
final boolean canFromTask = task != null && task.canAffectSystemUiFlags();
return canFromTask && !mActivityRecord.isHidden();
return canFromTask && mActivityRecord.isVisible();
}
}
@@ -1690,7 +1690,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
final ActivityRecord atoken = mActivityRecord;
return mViewVisibility == View.GONE
|| !mRelayoutCalled
|| (atoken == null && mToken.isHidden())
|| (atoken == null && !mToken.isVisible())
|| (atoken != null && !atoken.mVisibleRequested)
|| isParentWindowGoneForLayout()
|| (mAnimatingExit && !isAnimatingLw())
@@ -4170,7 +4170,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
+ " parentHidden=" + isParentWindowHidden()
+ " tok.visibleRequested="
+ (mActivityRecord != null && mActivityRecord.mVisibleRequested)
+ " tok.hidden=" + (mActivityRecord != null && mActivityRecord.isHidden())
+ " tok.visible=" + (mActivityRecord != null && mActivityRecord.isVisible())
+ " animating=" + isAnimating(TRANSITION | PARENTS)
+ " tok animating="
+ (mActivityRecord != null && mActivityRecord.isAnimating(TRANSITION))

View File

@@ -29,7 +29,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowTokenProto.HASH_CODE;
import static com.android.server.wm.WindowTokenProto.HIDDEN;
import static com.android.server.wm.WindowTokenProto.PAUSED;
import static com.android.server.wm.WindowTokenProto.WAITING_TO_SHOW;
import static com.android.server.wm.WindowTokenProto.WINDOWS;
@@ -72,9 +71,6 @@ class WindowToken extends WindowContainer<WindowState> {
// Is key dispatching paused for this token?
boolean paused = false;
// Should this token's windows be hidden?
private boolean mHidden;
// Temporary for finding which tokens no longer have visible windows.
boolean hasVisible;
@@ -124,16 +120,6 @@ class WindowToken extends WindowContainer<WindowState> {
}
}
void setHidden(boolean hidden) {
if (hidden != mHidden) {
mHidden = hidden;
}
}
boolean isHidden() {
return mHidden;
}
void removeAllWindowsIfPossible() {
for (int i = mChildren.size() - 1; i >= 0; --i) {
final WindowState win = mChildren.get(i);
@@ -152,7 +138,7 @@ class WindowToken extends WindowContainer<WindowState> {
// This token is exiting, so allow it to be removed when it no longer contains any windows.
mPersistOnEmpty = false;
if (mHidden) {
if (!isVisible()) {
return;
}
@@ -165,7 +151,10 @@ class WindowToken extends WindowContainer<WindowState> {
changed |= win.onSetAppExiting();
}
setHidden(true);
final ActivityRecord app = asActivityRecord();
if (app != null) {
app.setVisible(false);
}
if (changed) {
mWmService.mWindowPlacerLocked.performSurfacePlacement();
@@ -282,7 +271,6 @@ class WindowToken extends WindowContainer<WindowState> {
final WindowState w = mChildren.get(i);
w.writeToProto(proto, WINDOWS, logLevel);
}
proto.write(HIDDEN, mHidden);
proto.write(WAITING_TO_SHOW, waitingToShow);
proto.write(PAUSED, paused);
proto.end(token);
@@ -292,7 +280,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(" hidden="); pw.print(mHidden);
pw.print(" hasVisible="); pw.println(hasVisible);
if (waitingToShow) {
pw.print(prefix); pw.print("waitingToShow="); pw.print(waitingToShow);

View File

@@ -271,7 +271,7 @@ class ActivityTestsBase extends SystemServiceTestsBase {
doReturn(true).when(activity).occludesParent();
mTask.addChild(activity);
// Make visible by default...
activity.setHidden(false);
activity.setVisible(true);
}
final WindowProcessController wpc = new WindowProcessController(mService,

View File

@@ -62,7 +62,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
final ActivityRecord translucentOpening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
translucentOpening.setOccludesParent(false);
translucentOpening.setHidden(true);
translucentOpening.setVisible(false);
mDisplayContent.mOpeningApps.add(behind);
mDisplayContent.mOpeningApps.add(translucentOpening);
assertEquals(WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
@@ -90,7 +90,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
final ActivityRecord translucentOpening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
translucentOpening.setOccludesParent(false);
translucentOpening.setHidden(true);
translucentOpening.setVisible(false);
mDisplayContent.mOpeningApps.add(behind);
mDisplayContent.mOpeningApps.add(translucentOpening);
assertEquals(TRANSIT_TASK_CHANGE_WINDOWING_MODE,

View File

@@ -252,7 +252,7 @@ public class AppWindowTokenTests extends WindowTestsBase {
@Test
@Presubmit
public void testGetOrientation() {
mActivity.setHidden(false);
mActivity.setVisible(true);
mActivity.setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
@@ -261,7 +261,7 @@ public class AppWindowTokenTests extends WindowTestsBase {
assertEquals(SCREEN_ORIENTATION_LANDSCAPE, mActivity.getOrientation());
mActivity.setOccludesParent(true);
mActivity.setHidden(true);
mActivity.setVisible(false);
// Can not specify orientation if app isn't visible even though it occludes parent.
assertEquals(SCREEN_ORIENTATION_UNSET, mActivity.getOrientation());
// Can specify orientation if the current orientation candidate is orientation behind.
@@ -313,7 +313,7 @@ public class AppWindowTokenTests extends WindowTestsBase {
@Test
public void testSetOrientation() {
mActivity.setHidden(false);
mActivity.setVisible(true);
// Assert orientation is unspecified to start.
assertEquals(SCREEN_ORIENTATION_UNSPECIFIED, mActivity.getOrientation());

View File

@@ -149,7 +149,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final ActivityRecord hiddenActivity = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
hiddenActivity.setHidden(true);
hiddenActivity.setVisible(false);
mDisplayContent.getConfiguration().windowConfiguration.setRotation(
mDisplayContent.getRotation());
mController.initialize(ACTIVITY_TYPE_HOME, new SparseBooleanArray(), homeActivity);

View File

@@ -383,11 +383,11 @@ public class WindowStateTests extends WindowTestsBase {
@Test
public void testCanAffectSystemUiFlags() {
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
app.mToken.setHidden(false);
app.mActivityRecord.setVisible(true);
assertTrue(app.canAffectSystemUiFlags());
app.mToken.setHidden(true);
app.mActivityRecord.setVisible(false);
assertFalse(app.canAffectSystemUiFlags());
app.mToken.setHidden(false);
app.mActivityRecord.setVisible(true);
app.mAttrs.alpha = 0.0f;
assertFalse(app.canAffectSystemUiFlags());
}
@@ -395,7 +395,7 @@ public class WindowStateTests extends WindowTestsBase {
@Test
public void testCanAffectSystemUiFlags_disallow() {
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
app.mToken.setHidden(false);
app.mActivityRecord.setVisible(true);
assertTrue(app.canAffectSystemUiFlags());
app.getTask().setCanAffectSystemUiFlags(false);
assertFalse(app.canAffectSystemUiFlags());

View File

@@ -74,7 +74,7 @@ class WindowTestUtils {
private static void postCreateActivitySetup(ActivityRecord activity, DisplayContent dc) {
activity.onDisplayChanged(dc);
activity.setOccludesParent(true);
activity.setHidden(false);
activity.setVisible(true);
activity.mVisibleRequested = true;
}