Clean up visibility related flags in ActivityRecord
- Replace visible and hiddenRequested flag by a single flag mVisibleRequested. - Merge setVisible() into setVisiblity(). Test: Refactoring, all existing tests pass. Bug: 80414790 Change-Id: I7bafdb86e6b8431046775d3968d24f85c3fac45a
This commit is contained in:
@@ -235,7 +235,7 @@ message AppWindowTokenProto {
|
||||
optional WindowContainerThumbnailProto thumbnail = 6;
|
||||
optional bool fills_parent = 7;
|
||||
optional bool app_stopped = 8;
|
||||
optional bool hidden_requested = 9;
|
||||
optional bool visible_requested = 9;
|
||||
optional bool client_hidden = 10;
|
||||
optional bool defer_hiding_client = 11;
|
||||
optional bool reported_drawn = 12;
|
||||
|
||||
@@ -73,6 +73,12 @@
|
||||
"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",
|
||||
"at": "com\/android\/server\/wm\/ActivityRecord.java"
|
||||
},
|
||||
"-1963461591": {
|
||||
"message": "Removing %s from %s",
|
||||
"level": "VERBOSE",
|
||||
@@ -883,6 +889,12 @@
|
||||
"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",
|
||||
@@ -1207,12 +1219,6 @@
|
||||
"group": "WM_DEBUG_ORIENTATION",
|
||||
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
||||
},
|
||||
"358613119": {
|
||||
"message": "setAppVisibility(%s, visible=%b): %s hidden=%b hiddenRequested=%b Callers=%s",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS",
|
||||
"at": "com\/android\/server\/wm\/ActivityRecord.java"
|
||||
},
|
||||
"371641947": {
|
||||
"message": "Window Manager Crash %s",
|
||||
"level": "WTF",
|
||||
@@ -1501,12 +1507,6 @@
|
||||
"group": "WM_DEBUG_RECENTS_ANIMATIONS",
|
||||
"at": "com\/android\/server\/wm\/RecentsAnimation.java"
|
||||
},
|
||||
"857751535": {
|
||||
"message": "commitVisibility: %s: hidden=%b hiddenRequested=%b",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS",
|
||||
"at": "com\/android\/server\/wm\/ActivityRecord.java"
|
||||
},
|
||||
"873914452": {
|
||||
"message": "goodToGo()",
|
||||
"level": "DEBUG",
|
||||
@@ -1993,10 +1993,10 @@
|
||||
"group": "WM_DEBUG_REMOTE_ANIMATIONS",
|
||||
"at": "com\/android\/server\/wm\/RemoteAnimationController.java"
|
||||
},
|
||||
"1966564525": {
|
||||
"message": "Set freezing of %s: hidden=%b freezing=%b hiddenRequested=%b. %s",
|
||||
"level": "INFO",
|
||||
"group": "WM_DEBUG_ORIENTATION",
|
||||
"1965198071": {
|
||||
"message": "commitVisibility: %s: hidden=%b visibleRequested=%b",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS",
|
||||
"at": "com\/android\/server\/wm\/ActivityRecord.java"
|
||||
},
|
||||
"1984470582": {
|
||||
|
||||
@@ -548,7 +548,7 @@ class ActivityMetricsLogger {
|
||||
private static boolean hasActivityToBeDrawn(Task t) {
|
||||
for (int i = t.getChildCount() - 1; i >= 0; --i) {
|
||||
final ActivityRecord r = t.getChildAt(i);
|
||||
if (r.visible && !r.mDrawn && !r.finishing) {
|
||||
if (r.mVisibleRequested && !r.mDrawn && !r.finishing) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,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_REQUESTED;
|
||||
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;
|
||||
@@ -192,6 +191,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.WINDOW_TOKEN;
|
||||
import static com.android.server.wm.IdentifierProto.HASH_CODE;
|
||||
import static com.android.server.wm.IdentifierProto.TITLE;
|
||||
@@ -462,7 +462,6 @@ 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
|
||||
boolean visible; // does this activity's window need to be shown?
|
||||
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
|
||||
@@ -622,11 +621,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// case do not clear allDrawn until the animation completes.
|
||||
boolean deferClearAllDrawn;
|
||||
|
||||
// Is this window's surface needed? This is almost like hidden, except
|
||||
// it will sometimes be true a little earlier: when the token has
|
||||
// Is this window's surface needed? This is almost like visible, except
|
||||
// it will sometimes be true a little earlier: when the activity record has
|
||||
// been shown, but is still waiting for its app transition to execute
|
||||
// before making its windows shown.
|
||||
boolean hiddenRequested;
|
||||
boolean mVisibleRequested;
|
||||
|
||||
// Last visibility state we reported to the app token.
|
||||
boolean reportedVisible;
|
||||
@@ -836,7 +835,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
pw.print(" finishing="); pw.println(finishing);
|
||||
pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused);
|
||||
pw.print(" inHistory="); pw.print(inHistory);
|
||||
pw.print(" visible="); pw.print(visible);
|
||||
pw.print(" sleeping="); pw.print(sleeping);
|
||||
pw.print(" idle="); pw.print(idle);
|
||||
pw.print(" mStartingWindowState=");
|
||||
@@ -860,7 +858,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
pw.print(prefix); pw.print(" mOccludesParent="); pw.print(mOccludesParent);
|
||||
pw.print(" mOrientation="); pw.println(mOrientation);
|
||||
pw.println(prefix + "hiddenRequested=" + hiddenRequested + " mClientHidden=" + mClientHidden
|
||||
pw.println(prefix + "mVisibleRequested=" + mVisibleRequested
|
||||
+ " mClientHidden=" + mClientHidden
|
||||
+ ((mDeferHidingClient) ? " mDeferHidingClient=" + mDeferHidingClient : "")
|
||||
+ " reportedDrawn=" + reportedDrawn + " reportedVisible=" + reportedVisible);
|
||||
if (paused) {
|
||||
@@ -1488,7 +1487,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|
||||
// Application tokens start out hidden.
|
||||
setHidden(true);
|
||||
hiddenRequested = true;
|
||||
mVisibleRequested = false;
|
||||
|
||||
ColorDisplayService.ColorDisplayServiceInternal cds = LocalServices.getService(
|
||||
ColorDisplayService.ColorDisplayServiceInternal.class);
|
||||
@@ -1517,7 +1516,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
deferRelaunchUntilPaused = false;
|
||||
keysPaused = false;
|
||||
inHistory = false;
|
||||
visible = false;
|
||||
nowVisible = false;
|
||||
mDrawn = false;
|
||||
idle = false;
|
||||
@@ -2200,7 +2198,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
* 2. App is delayed closing since it might enter PIP.
|
||||
*/
|
||||
boolean isClosingOrEnteringPip() {
|
||||
return (isAnimating(TRANSITION | PARENTS) && hiddenRequested) || mWillCloseOrEnterPip;
|
||||
return (isAnimating(TRANSITION | PARENTS) && !mVisibleRequested) || mWillCloseOrEnterPip;
|
||||
}
|
||||
/**
|
||||
* @return Whether AppOps allows this package to enter picture-in-picture.
|
||||
@@ -2459,7 +2457,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
mAtmService.getLockTaskController().clearLockedTask(task);
|
||||
}
|
||||
} else if (!isState(PAUSING)) {
|
||||
if (visible) {
|
||||
if (mVisibleRequested) {
|
||||
// Prepare and execute close transition.
|
||||
prepareActivityHideTransitionAnimation(transit);
|
||||
}
|
||||
@@ -2538,12 +2536,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// TODO(b/137329632): find the next activity directly underneath this one, not just anywhere
|
||||
final ActivityRecord next = getDisplay().topRunningActivity(
|
||||
true /* considerKeyguardState */);
|
||||
final boolean isVisible = visible || nowVisible;
|
||||
final boolean isVisible = mVisibleRequested || nowVisible;
|
||||
// isNextNotYetVisible is to check if the next activity is invisible, or it has been
|
||||
// requested to be invisible but its windows haven't reported as invisible. If so, it
|
||||
// implied that the current finishing activity should be added into stopping list rather
|
||||
// than destroy immediately.
|
||||
final boolean isNextNotYetVisible = next != null && (!next.nowVisible || !next.visible);
|
||||
final boolean isNextNotYetVisible = next != null
|
||||
&& (!next.nowVisible || !next.mVisibleRequested);
|
||||
if (isVisible && isNextNotYetVisible) {
|
||||
// Add this activity to the list of stopping activities. It will be processed and
|
||||
// destroyed when the next activity reports idle.
|
||||
@@ -3226,7 +3225,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
if (!fromActivity.isHidden()) {
|
||||
setHidden(false);
|
||||
hiddenRequested = false;
|
||||
mVisibleRequested = true;
|
||||
mHiddenSetFromTransferredStartingWindow = true;
|
||||
}
|
||||
setClientHidden(fromActivity.mClientHidden);
|
||||
@@ -3275,7 +3274,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
if (fromActivity == this) {
|
||||
return;
|
||||
}
|
||||
if (fromActivity.hiddenRequested && transferStartingWindow(fromActivity.token)) {
|
||||
if (!fromActivity.mVisibleRequested && transferStartingWindow(fromActivity.token)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3790,6 +3789,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
return opts;
|
||||
}
|
||||
|
||||
boolean allowMoveToFront() {
|
||||
return pendingOptions == null || !pendingOptions.getAvoidMoveToFront();
|
||||
}
|
||||
|
||||
void removeUriPermissionsLocked() {
|
||||
if (uriPermissions != null) {
|
||||
uriPermissions.removeUriPermissions();
|
||||
@@ -3826,7 +3829,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
return;
|
||||
}
|
||||
mDeferHidingClient = deferHidingClient;
|
||||
if (!mDeferHidingClient && !visible) {
|
||||
if (!mDeferHidingClient && !mVisibleRequested) {
|
||||
// Hiding the client is no longer deferred and the app isn't visible still, go ahead and
|
||||
// update the visibility.
|
||||
setVisibility(false);
|
||||
@@ -3846,20 +3849,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
+ appToken);
|
||||
return;
|
||||
}
|
||||
if (visible) {
|
||||
mDeferHidingClient = false;
|
||||
}
|
||||
setVisibility(visible, mDeferHidingClient);
|
||||
mAtmService.addWindowLayoutReasons(
|
||||
ActivityTaskManagerService.LAYOUT_REASON_VISIBILITY_CHANGED);
|
||||
mStackSupervisor.getActivityMetricsLogger().notifyVisibilityChanged(this);
|
||||
}
|
||||
|
||||
// TODO: Look into merging with #commitVisibility()
|
||||
void setVisible(boolean newVisible) {
|
||||
visible = newVisible;
|
||||
mDeferHidingClient = !visible && mDeferHidingClient;
|
||||
setVisibility(visible);
|
||||
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = true;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setVisibility(boolean visible, boolean deferHidingClient) {
|
||||
final AppTransition appTransition = getDisplayContent().mAppTransition;
|
||||
|
||||
@@ -3870,7 +3870,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// transition can be selected.
|
||||
// TODO: Probably a good idea to separate the concept of opening/closing apps from the
|
||||
// concept of setting visibility...
|
||||
if (!visible && hiddenRequested) {
|
||||
if (!visible && !mVisibleRequested) {
|
||||
|
||||
if (!deferHidingClient && mLastDeferHidingClient) {
|
||||
// We previously deferred telling the client to hide itself when visibility was
|
||||
@@ -3882,8 +3882,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
|
||||
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
|
||||
"setAppVisibility(%s, visible=%b): %s hidden=%b hiddenRequested=%b Callers=%s",
|
||||
appToken, visible, appTransition, isHidden(), hiddenRequested,
|
||||
"setAppVisibility(%s, visible=%b): %s hidden=%b mVisibleRequested=%b Callers=%s",
|
||||
appToken, visible, appTransition, isHidden(), mVisibleRequested,
|
||||
Debug.getCallers(6));
|
||||
|
||||
final DisplayContent displayContent = getDisplayContent();
|
||||
@@ -3894,7 +3894,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
displayContent.mChangingApps.remove(this);
|
||||
waitingToShow = false;
|
||||
hiddenRequested = !visible;
|
||||
mVisibleRequested = visible;
|
||||
mLastDeferHidingClient = deferHidingClient;
|
||||
|
||||
if (!visible) {
|
||||
@@ -4033,7 +4033,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
|
||||
setHidden(!visible);
|
||||
hiddenRequested = !visible;
|
||||
mVisibleRequested = visible;
|
||||
visibilityChanged = true;
|
||||
if (!visible) {
|
||||
stopFreezingScreen(true, true);
|
||||
@@ -4051,8 +4051,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
|
||||
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
|
||||
"commitVisibility: %s: hidden=%b hiddenRequested=%b", this,
|
||||
isHidden(), hiddenRequested);
|
||||
"commitVisibility: %s: hidden=%b visibleRequested=%b", this,
|
||||
isHidden(), mVisibleRequested);
|
||||
|
||||
if (changed) {
|
||||
displayContent.getInputMonitor().setUpdateInputWindowsNeededLw();
|
||||
@@ -4397,7 +4397,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
updateOptionsLocked(returningOptions);
|
||||
stack.mUndrawnActivitiesBelowTopTranslucent.add(this);
|
||||
}
|
||||
setVisible(true);
|
||||
setVisibility(true);
|
||||
sleeping = false;
|
||||
app.postPendingUiCleanMsg(true);
|
||||
if (reportToClient) {
|
||||
@@ -4433,7 +4433,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
|
||||
void makeInvisible() {
|
||||
if (!visible) {
|
||||
if (!mVisibleRequested) {
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Already invisible: " + this);
|
||||
return;
|
||||
}
|
||||
@@ -4455,7 +4455,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
final boolean deferHidingClient = canEnterPictureInPicture
|
||||
&& !isState(STOPPING, STOPPED, PAUSED);
|
||||
setDeferHidingClient(deferHidingClient);
|
||||
setVisible(false);
|
||||
setVisibility(false);
|
||||
|
||||
switch (getState()) {
|
||||
case STOPPING:
|
||||
@@ -4642,8 +4642,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
* state to match that fact.
|
||||
*/
|
||||
void completeResumeLocked() {
|
||||
final boolean wasVisible = visible;
|
||||
setVisible(true);
|
||||
final boolean wasVisible = mVisibleRequested;
|
||||
setVisibility(true);
|
||||
if (!wasVisible) {
|
||||
// Visibility has changed, so take a note of it so we call the TaskStackChangedListener
|
||||
mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = true;
|
||||
@@ -4727,15 +4727,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
setState(STOPPING, "stopIfPossible");
|
||||
if (DEBUG_VISIBILITY) {
|
||||
Slog.v(TAG_VISIBILITY, "Stopping visible=" + visible + " for " + this);
|
||||
Slog.v(TAG_VISIBILITY, "Stopping visibleRequested="
|
||||
+ mVisibleRequested + " for " + this);
|
||||
}
|
||||
if (!visible) {
|
||||
setVisible(false);
|
||||
if (!mVisibleRequested) {
|
||||
setVisibility(false);
|
||||
}
|
||||
EventLogTags.writeAmStopActivity(
|
||||
mUserId, System.identityHashCode(this), shortComponentName);
|
||||
mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken,
|
||||
StopActivityItem.obtain(visible, configChangeFlags));
|
||||
StopActivityItem.obtain(mVisibleRequested, configChangeFlags));
|
||||
if (stack.shouldSleepOrShutDownActivities()) {
|
||||
setSleeping(true);
|
||||
}
|
||||
@@ -4898,10 +4899,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|
||||
void startFreezingScreen() {
|
||||
ProtoLog.i(WM_DEBUG_ORIENTATION,
|
||||
"Set freezing of %s: hidden=%b freezing=%b hiddenRequested=%b. %s",
|
||||
appToken, isHidden(), mFreezingScreen, hiddenRequested,
|
||||
"Set freezing of %s: hidden=%b freezing=%b visibleRequested=%b. %s",
|
||||
appToken, isHidden(), mFreezingScreen, mVisibleRequested,
|
||||
new RuntimeException().fillInStackTrace());
|
||||
if (!hiddenRequested) {
|
||||
if (mVisibleRequested) {
|
||||
if (!mFreezingScreen) {
|
||||
mFreezingScreen = true;
|
||||
mWmService.registerAppFreezeListener(this);
|
||||
@@ -5180,7 +5181,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController
|
||||
+ " pv=" + w.isVisibleByPolicy()
|
||||
+ " mDrawState=" + winAnimator.drawStateToString()
|
||||
+ " ph=" + w.isParentWindowHidden() + " th=" + hiddenRequested
|
||||
+ " ph=" + w.isParentWindowHidden() + " th=" + mVisibleRequested
|
||||
+ " a=" + isAnimating(TRANSITION));
|
||||
}
|
||||
}
|
||||
@@ -5288,7 +5289,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
* currently pausing, or is resumed.
|
||||
*/
|
||||
public boolean isInterestingToUserLocked() {
|
||||
return visible || nowVisible || mState == PAUSING || mState == RESUMED;
|
||||
return mVisibleRequested || nowVisible || mState == PAUSING || mState == RESUMED;
|
||||
}
|
||||
|
||||
void setSleeping(boolean _sleeping) {
|
||||
@@ -5362,7 +5363,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// We're not ready for this kind of thing.
|
||||
return false;
|
||||
}
|
||||
if (visible) {
|
||||
if (mVisibleRequested) {
|
||||
// The user would notice this!
|
||||
return false;
|
||||
}
|
||||
@@ -5920,7 +5921,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
"AppWindowToken");
|
||||
|
||||
clearThumbnail();
|
||||
setClientHidden(isHidden() && hiddenRequested);
|
||||
setClientHidden(isHidden() && !mVisibleRequested);
|
||||
|
||||
getDisplayContent().computeImeTargetIfNeeded(this);
|
||||
|
||||
@@ -6516,7 +6517,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
if (display == null) {
|
||||
return;
|
||||
}
|
||||
if (visible) {
|
||||
if (mVisibleRequested) {
|
||||
// It may toggle the UI for user to restart the size compatibility mode activity.
|
||||
display.handleActivitySizeCompatModeIfNeeded(this);
|
||||
} else if (mCompatDisplayInsets != null) {
|
||||
@@ -6813,7 +6814,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
} else {
|
||||
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
|
||||
"Config is relaunching " + this);
|
||||
if (DEBUG_STATES && !visible) {
|
||||
if (DEBUG_STATES && !mVisibleRequested) {
|
||||
Slog.v(TAG_STATES, "Config is relaunching invisible activity " + this
|
||||
+ " called by " + Debug.getCallers(4));
|
||||
}
|
||||
@@ -6999,7 +7000,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// Reset the existing override configuration so it can be updated according to the latest
|
||||
// configuration.
|
||||
clearSizeCompatMode();
|
||||
if (visible) {
|
||||
if (mVisibleRequested) {
|
||||
// Configuration will be ensured when becoming visible, so if it is already visible,
|
||||
// then the manual update is needed.
|
||||
updateSizeCompatMode();
|
||||
@@ -7012,7 +7013,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// The restarting state avoids removing this record when process is died.
|
||||
setState(RESTARTING_PROCESS, "restartActivityProcess");
|
||||
|
||||
if (!visible || mHaveState) {
|
||||
if (!mVisibleRequested || mHaveState) {
|
||||
// Kill its process immediately because the activity should be in background.
|
||||
// The activity state will be update to {@link #DESTROYED} in
|
||||
// {@link ActivityStack#cleanUp} when handling process died.
|
||||
@@ -7303,7 +7304,7 @@ 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, visible);
|
||||
proto.write(VISIBLE, mVisibleRequested);
|
||||
proto.write(FRONT_OF_TASK, isRootOfTask());
|
||||
if (hasProcess()) {
|
||||
proto.write(PROC_ID, app.getPid());
|
||||
@@ -7339,7 +7340,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
proto.write(FILLS_PARENT, mOccludesParent);
|
||||
proto.write(APP_STOPPED, mAppStopped);
|
||||
proto.write(HIDDEN_REQUESTED, hiddenRequested);
|
||||
proto.write(VISIBLE_REQUESTED, mVisibleRequested);
|
||||
proto.write(CLIENT_HIDDEN, mClientHidden);
|
||||
proto.write(DEFER_HIDING_CLIENT, mDeferHidingClient);
|
||||
proto.write(REPORTED_DRAWN, reportedDrawn);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ActivityServiceConnectionsHolder<T> {
|
||||
|
||||
public boolean isActivityVisible() {
|
||||
synchronized (mService.mGlobalLock) {
|
||||
return mActivity.visible || mActivity.isState(RESUMED, PAUSING);
|
||||
return mActivity.mVisibleRequested || mActivity.isState(RESUMED, PAUSING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1693,7 +1693,8 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
prev = prev.completeFinishing("completePausedLocked");
|
||||
} else if (prev.hasProcess()) {
|
||||
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueue pending stop if needed: " + prev
|
||||
+ " wasStopping=" + wasStopping + " visible=" + prev.visible);
|
||||
+ " wasStopping=" + wasStopping
|
||||
+ " visibleRequested=" + prev.mVisibleRequested);
|
||||
if (prev.deferRelaunchUntilPaused) {
|
||||
// Complete the deferred relaunch that was waiting for pause to complete.
|
||||
if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Re-launching after pause: " + prev);
|
||||
@@ -1703,7 +1704,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
// We can't clobber it, because the stop confirmation will not be handled.
|
||||
// We don't need to schedule another stop, we only need to let it happen.
|
||||
prev.setState(STOPPING, "completePausedLocked");
|
||||
} else if (!prev.visible || shouldSleepOrShutDownActivities()) {
|
||||
} else if (!prev.mVisibleRequested || shouldSleepOrShutDownActivities()) {
|
||||
// Clear out any deferred client hide we might currently have.
|
||||
prev.setDeferHidingClient(false);
|
||||
// If we were visible then resumeTopActivities will release resources before
|
||||
@@ -1824,7 +1825,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
|
||||
boolean isTopActivityVisible() {
|
||||
final ActivityRecord topActivity = getTopNonFinishingActivity();
|
||||
return topActivity != null && topActivity.visible;
|
||||
return topActivity != null && topActivity.mVisibleRequested;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1965,7 +1966,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
for (int taskNdx = getChildCount() - 1; taskNdx >= 0; --taskNdx) {
|
||||
final Task task = getChildAt(taskNdx);
|
||||
ActivityRecord r = task.topRunningActivityLocked();
|
||||
if (r == null || r.finishing || !r.visible) {
|
||||
if (r == null || r.finishing || !r.mVisibleRequested) {
|
||||
task.mLayerRank = -1;
|
||||
} else {
|
||||
task.mLayerRank = baseLayer + layer++;
|
||||
@@ -2054,7 +2055,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
if (!r.attachedToProcess()) {
|
||||
makeVisibleAndRestartIfNeeded(starting, configChanges, isTop,
|
||||
resumeTopActivity && isTop, r);
|
||||
} else if (r.visible) {
|
||||
} else if (r.mVisibleRequested) {
|
||||
// If this activity is already visible, then there is nothing to do here.
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
|
||||
"Skipping: already visible at " + r);
|
||||
@@ -2231,16 +2232,16 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
// invisible. If the app is already visible, it must have died while it was visible. In this
|
||||
// case, we'll show the dead window but will not restart the app. Otherwise we could end up
|
||||
// thrashing.
|
||||
if (isTop || !r.visible) {
|
||||
if (isTop || !r.mVisibleRequested) {
|
||||
// This activity needs to be visible, but isn't even running...
|
||||
// get it started and resume if no other stack in this stack is resumed.
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Start and freeze screen for " + r);
|
||||
if (r != starting) {
|
||||
r.startFreezingScreenLocked(configChanges);
|
||||
}
|
||||
if (!r.visible || r.mLaunchTaskBehind) {
|
||||
if (!r.mVisibleRequested || r.mLaunchTaskBehind) {
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Starting and making visible: " + r);
|
||||
r.setVisible(true);
|
||||
r.setVisibility(true);
|
||||
}
|
||||
if (r != starting) {
|
||||
mStackSupervisor.startSpecificActivityLocked(r, andResume, true /* checkConfig */);
|
||||
@@ -2683,7 +2684,8 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
|
||||
if (next.attachedToProcess()) {
|
||||
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next
|
||||
+ " stopped=" + next.stopped + " visible=" + next.visible);
|
||||
+ " stopped=" + next.stopped
|
||||
+ " visibleRequested=" + next.mVisibleRequested);
|
||||
|
||||
// If the previous activity is translucent, force a visibility update of
|
||||
// the next activity, so that it's added to WM's opening app list, and
|
||||
@@ -2698,7 +2700,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
&& !lastFocusedStack.mLastPausedActivity.occludesParent()));
|
||||
|
||||
// This activity is now becoming visible.
|
||||
if (!next.visible || next.stopped || lastActivityTranslucent) {
|
||||
if (!next.mVisibleRequested || next.stopped || lastActivityTranslucent) {
|
||||
next.setVisibility(true);
|
||||
}
|
||||
|
||||
@@ -2753,7 +2755,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
// Do over!
|
||||
mStackSupervisor.scheduleResumeTopActivities();
|
||||
}
|
||||
if (!next.visible || next.stopped) {
|
||||
if (!next.mVisibleRequested || next.stopped) {
|
||||
next.setVisibility(true);
|
||||
}
|
||||
next.completeResumeLocked();
|
||||
@@ -3422,7 +3424,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
|
||||
final ActivityRecord top = stack.topRunningActivityLocked();
|
||||
|
||||
if (stack.isActivityTypeHome() && (top == null || !top.visible)) {
|
||||
if (stack.isActivityTypeHome() && (top == null || !top.mVisibleRequested)) {
|
||||
// If we will be focusing on the home stack next and its current top activity isn't
|
||||
// visible, then use the move the home stack task to top to make the activity visible.
|
||||
stack.getDisplay().moveHomeActivityToTop(reason);
|
||||
@@ -3919,7 +3921,10 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
"Record #" + targetIndex + " " + r + ": app=" + r.app);
|
||||
|
||||
if (r.app == app) {
|
||||
if (r.visible) {
|
||||
if (r.isVisible() || r.mVisibleRequested) {
|
||||
// While an activity launches a new activity, it's possible that the old
|
||||
// activity is already requested to be hidden (mVisibleRequested=false), but
|
||||
// this visibility is not yet committed, so isVisible()=true.
|
||||
hasVisibleActivities = true;
|
||||
}
|
||||
final boolean remove;
|
||||
@@ -3935,8 +3940,8 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
// Don't currently have state for the activity, or
|
||||
// it is finishing -- always remove it.
|
||||
remove = true;
|
||||
} else if (!r.visible && r.launchCount > 2 &&
|
||||
r.lastLaunchTime > (SystemClock.uptimeMillis() - 60000)) {
|
||||
} else if (!r.mVisibleRequested && r.launchCount > 2
|
||||
&& r.lastLaunchTime > (SystemClock.uptimeMillis() - 60000)) {
|
||||
// We have launched this activity too many times since it was
|
||||
// able to run, so give up and remove it.
|
||||
// (Note if the activity is visible, we don't remove the record.
|
||||
@@ -3972,7 +3977,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
// it died, we leave the dead window on screen so it's basically visible.
|
||||
// This is needed when user later tap on the dead window, we need to stop
|
||||
// other apps when user transfers focus to the restarted activity.
|
||||
r.nowVisible = r.visible;
|
||||
r.nowVisible = r.mVisibleRequested;
|
||||
}
|
||||
r.cleanUp(true /* cleanServices */, true /* setState */);
|
||||
if (remove) {
|
||||
@@ -4155,7 +4160,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
* Ensures all visible activities at or below the input activity have the right configuration.
|
||||
*/
|
||||
void ensureVisibleActivitiesConfigurationLocked(ActivityRecord start, boolean preserveWindow) {
|
||||
if (start == null || !start.visible) {
|
||||
if (start == null || !start.mVisibleRequested) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4550,7 +4555,7 @@ class ActivityStack extends WindowContainer<Task> implements BoundsAnimationTarg
|
||||
final ActivityRecord a = task.getChildAt(activityNdx);
|
||||
if (a.info.packageName.equals(packageName)) {
|
||||
a.forceNewConfig = true;
|
||||
if (starting != null && a == starting && a.visible) {
|
||||
if (starting != null && a == starting && a.mVisibleRequested) {
|
||||
a.startFreezingScreenLocked(CONFIG_SCREEN_LAYOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,12 +773,11 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
}
|
||||
|
||||
if (r.getActivityStack().checkKeyguardVisibility(r, true /* shouldBeVisible */,
|
||||
true /* isTop */)) {
|
||||
// We only set the visibility to true if the activity is allowed to be visible
|
||||
// based on
|
||||
// keyguard state. This avoids setting this into motion in window manager that is
|
||||
// later cancelled due to later calls to ensure visible activities that set
|
||||
// visibility back to false.
|
||||
true /* isTop */) && r.allowMoveToFront()) {
|
||||
// We only set the visibility to true if the activity is not being launched in
|
||||
// background, and is allowed to be visible based on keyguard state. This avoids
|
||||
// setting this into motion in window manager that is later cancelled due to later
|
||||
// calls to ensure visible activities that set visibility back to false.
|
||||
r.setVisibility(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -653,11 +653,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
final ActivityRecord activity = w.mActivityRecord;
|
||||
if (gone) Slog.v(TAG, " GONE: mViewVisibility=" + w.mViewVisibility
|
||||
+ " mRelayoutCalled=" + w.mRelayoutCalled + " hidden=" + w.mToken.isHidden()
|
||||
+ " hiddenRequested=" + (activity != null && activity.hiddenRequested)
|
||||
+ " visibleRequested=" + (activity != null && activity.mVisibleRequested)
|
||||
+ " parentHidden=" + w.isParentWindowHidden());
|
||||
else Slog.v(TAG, " VIS: mViewVisibility=" + w.mViewVisibility
|
||||
+ " mRelayoutCalled=" + w.mRelayoutCalled + " hidden=" + w.mToken.isHidden()
|
||||
+ " hiddenRequested=" + (activity != null && activity.hiddenRequested)
|
||||
+ " visibleRequested=" + (activity != null && activity.mVisibleRequested)
|
||||
+ " parentHidden=" + w.isParentWindowHidden());
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
|
||||
mTargetActivityType);
|
||||
ActivityRecord targetActivity = getTargetActivity(targetStack);
|
||||
if (targetActivity != null) {
|
||||
if (targetActivity.visible || targetActivity.isTopRunningActivity()) {
|
||||
if (targetActivity.mVisibleRequested || targetActivity.isTopRunningActivity()) {
|
||||
// The activity is ready.
|
||||
return;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
|
||||
|
||||
// Send launch hint if we are actually launching the target. If it's already visible
|
||||
// (shouldn't happen in general) we don't need to send it.
|
||||
if (targetActivity == null || !targetActivity.visible) {
|
||||
if (targetActivity == null || !targetActivity.mVisibleRequested) {
|
||||
mService.mRootActivityContainer.sendPowerHintForLaunchStartIfNeeded(
|
||||
true /* forceSend */, targetActivity);
|
||||
}
|
||||
|
||||
@@ -2212,7 +2212,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
|
||||
void addStartingWindowsForVisibleActivities(boolean taskSwitch) {
|
||||
for (int activityNdx = getChildCount() - 1; activityNdx >= 0; --activityNdx) {
|
||||
final ActivityRecord r = getChildAt(activityNdx);
|
||||
if (r.visible) {
|
||||
if (r.mVisibleRequested) {
|
||||
r.showStartingWindow(null /* prev */, false /* newTask */, taskSwitch);
|
||||
}
|
||||
}
|
||||
@@ -2533,7 +2533,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
|
||||
for (int i = mChildren.size() - 1; i >= 0; i--) {
|
||||
final ActivityRecord token = mChildren.get(i);
|
||||
// skip hidden (or about to hide) apps
|
||||
if (token.mIsExiting || token.isClientHidden() || token.hiddenRequested) {
|
||||
if (token.mIsExiting || token.isClientHidden() || !token.mVisibleRequested) {
|
||||
continue;
|
||||
}
|
||||
final WindowState win = token.findMainWindow();
|
||||
@@ -2753,7 +2753,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
|
||||
for (int i = mChildren.size() - 1; i >= 0; i--) {
|
||||
final ActivityRecord token = mChildren.get(i);
|
||||
// skip hidden (or about to hide) apps
|
||||
if (!token.mIsExiting && !token.isClientHidden() && !token.hiddenRequested) {
|
||||
if (!token.mIsExiting && !token.isClientHidden() && token.mVisibleRequested) {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,9 +532,9 @@ class WallpaperController {
|
||||
}
|
||||
|
||||
final boolean newTargetHidden = wallpaperTarget.mActivityRecord != null
|
||||
&& wallpaperTarget.mActivityRecord.hiddenRequested;
|
||||
&& !wallpaperTarget.mActivityRecord.mVisibleRequested;
|
||||
final boolean oldTargetHidden = prevWallpaperTarget.mActivityRecord != null
|
||||
&& prevWallpaperTarget.mActivityRecord.hiddenRequested;
|
||||
&& !prevWallpaperTarget.mActivityRecord.mVisibleRequested;
|
||||
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Animating wallpapers:" + " old: "
|
||||
+ prevWallpaperTarget + " hidden=" + oldTargetHidden + " new: " + wallpaperTarget
|
||||
|
||||
@@ -533,7 +533,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
synchronized (mAtm.mGlobalLockWithoutBoost) {
|
||||
for (int i = mActivities.size() - 1; i >= 0; --i) {
|
||||
final ActivityRecord r = mActivities.get(i);
|
||||
if (r.visible) {
|
||||
if (r.mVisibleRequested) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -555,7 +555,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
continue;
|
||||
}
|
||||
ActivityRecord topActivity = task.getTopNonFinishingActivity();
|
||||
if (topActivity != null && topActivity.visible) {
|
||||
if (topActivity != null && topActivity.mVisibleRequested) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -589,7 +589,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
// - no longer visible OR
|
||||
// - not focusable (in PiP mode for instance)
|
||||
if (topDisplay == null
|
||||
|| !mPreQTopResumedActivity.visible
|
||||
|| !mPreQTopResumedActivity.mVisibleRequested
|
||||
|| !mPreQTopResumedActivity.isFocusable()) {
|
||||
canUpdate = true;
|
||||
}
|
||||
@@ -739,7 +739,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
}
|
||||
// Don't consider any activities that are currently not in a state where they
|
||||
// can be destroyed.
|
||||
if (r.visible || !r.stopped || !r.hasSavedState()
|
||||
if (r.mVisibleRequested || !r.stopped || !r.hasSavedState()
|
||||
|| r.isState(STARTED, RESUMED, PAUSING, PAUSED, STOPPING)) {
|
||||
if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Not releasing in-use activity: " + r);
|
||||
continue;
|
||||
@@ -793,7 +793,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (r.visible) {
|
||||
if (r.mVisibleRequested) {
|
||||
final Task task = r.getTask();
|
||||
if (task != null && minTaskLayer > 0) {
|
||||
final int layer = task.mLayerRank;
|
||||
|
||||
@@ -1560,7 +1560,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
*/
|
||||
// TODO: Can we consolidate this with #isVisible() or have a more appropriate name for this?
|
||||
boolean isWinVisibleLw() {
|
||||
return (mActivityRecord == null || !mActivityRecord.hiddenRequested
|
||||
return (mActivityRecord == null || mActivityRecord.mVisibleRequested
|
||||
|| mActivityRecord.isAnimating(TRANSITION)) && isVisible();
|
||||
}
|
||||
|
||||
@@ -1591,7 +1591,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
final ActivityRecord atoken = mActivityRecord;
|
||||
return (mHasSurface || (!mRelayoutCalled && mViewVisibility == View.VISIBLE))
|
||||
&& isVisibleByPolicy() && !isParentWindowHidden()
|
||||
&& (atoken == null || !atoken.hiddenRequested)
|
||||
&& (atoken == null || atoken.mVisibleRequested)
|
||||
&& !mAnimatingExit && !mDestroying;
|
||||
}
|
||||
|
||||
@@ -1606,7 +1606,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
final ActivityRecord atoken = mActivityRecord;
|
||||
if (atoken != null) {
|
||||
return ((!isParentWindowHidden() && !atoken.hiddenRequested)
|
||||
return ((!isParentWindowHidden() && atoken.mVisibleRequested)
|
||||
|| isAnimating(TRANSITION | PARENTS));
|
||||
}
|
||||
return !isParentWindowHidden() || isAnimating(TRANSITION | PARENTS);
|
||||
@@ -1673,7 +1673,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
public boolean isDisplayedLw() {
|
||||
final ActivityRecord atoken = mActivityRecord;
|
||||
return isDrawnLw() && isVisibleByPolicy()
|
||||
&& ((!isParentWindowHidden() && (atoken == null || !atoken.hiddenRequested))
|
||||
&& ((!isParentWindowHidden() && (atoken == null || atoken.mVisibleRequested))
|
||||
|| isAnimating(TRANSITION | PARENTS));
|
||||
}
|
||||
|
||||
@@ -1691,7 +1691,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return mViewVisibility == View.GONE
|
||||
|| !mRelayoutCalled
|
||||
|| (atoken == null && mToken.isHidden())
|
||||
|| (atoken != null && atoken.hiddenRequested)
|
||||
|| (atoken != null && !atoken.mVisibleRequested)
|
||||
|| isParentWindowGoneForLayout()
|
||||
|| (mAnimatingExit && !isAnimatingLw())
|
||||
|| mDestroying;
|
||||
@@ -2183,7 +2183,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
+ " parentHidden=" + isParentWindowHidden()
|
||||
+ " exiting=" + mAnimatingExit + " destroying=" + mDestroying);
|
||||
if (mActivityRecord != null) {
|
||||
Slog.i(TAG_WM, " mActivityRecord.hiddenRequested=" + mActivityRecord.hiddenRequested);
|
||||
Slog.i(TAG_WM, " mActivityRecord.visibleRequested="
|
||||
+ mActivityRecord.mVisibleRequested);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2631,14 +2632,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return showBecauseOfActivity || showBecauseOfWindow;
|
||||
}
|
||||
|
||||
/** @return false if this window desires touch events. */
|
||||
/** @return {@code false} if this window desires touch events. */
|
||||
boolean cantReceiveTouchInput() {
|
||||
if (mActivityRecord == null || mActivityRecord.getTask() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mActivityRecord.getTask().getTaskStack().shouldIgnoreInput()
|
||||
|| mActivityRecord.hiddenRequested
|
||||
|| !mActivityRecord.mVisibleRequested
|
||||
|| isAnimatingToRecents();
|
||||
}
|
||||
|
||||
@@ -4167,8 +4168,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
+ " starting=" + (mAttrs.type == TYPE_APPLICATION_STARTING)
|
||||
+ " during animation: policyVis=" + isVisibleByPolicy()
|
||||
+ " parentHidden=" + isParentWindowHidden()
|
||||
+ " tok.hiddenRequested="
|
||||
+ (mActivityRecord != null && mActivityRecord.hiddenRequested)
|
||||
+ " tok.visibleRequested="
|
||||
+ (mActivityRecord != null && mActivityRecord.mVisibleRequested)
|
||||
+ " tok.hidden=" + (mActivityRecord != null && mActivityRecord.isHidden())
|
||||
+ " animating=" + isAnimating(TRANSITION | PARENTS)
|
||||
+ " tok animating="
|
||||
@@ -4576,7 +4577,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
+ " pv=" + isVisibleByPolicy()
|
||||
+ " mDrawState=" + mWinAnimator.mDrawState
|
||||
+ " ph=" + isParentWindowHidden()
|
||||
+ " th=" + (mActivityRecord != null ? mActivityRecord.hiddenRequested : false)
|
||||
+ " th=" + (mActivityRecord != null && mActivityRecord.mVisibleRequested)
|
||||
+ " a=" + isAnimating(TRANSITION | PARENTS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ActivityMetricsLaunchObserverTests extends ActivityTestsBase {
|
||||
public void testOnActivityLaunchCancelled_hasDrawn() {
|
||||
onActivityLaunched();
|
||||
|
||||
mTopActivity.visible = mTopActivity.mDrawn = true;
|
||||
mTopActivity.mVisibleRequested = mTopActivity.mDrawn = true;
|
||||
|
||||
// Cannot time already-visible activities.
|
||||
mActivityMetricsLogger.notifyActivityLaunched(START_TASK_TO_FRONT, mTopActivity);
|
||||
@@ -171,7 +171,7 @@ public class ActivityMetricsLaunchObserverTests extends ActivityTestsBase {
|
||||
|
||||
@Test
|
||||
public void testOnActivityLaunchCancelled_finishedBeforeDrawn() {
|
||||
mTopActivity.visible = mTopActivity.mDrawn = true;
|
||||
mTopActivity.mVisibleRequested = mTopActivity.mDrawn = true;
|
||||
|
||||
// Suppress resume when creating the record because we want to notify logger manually.
|
||||
mSupervisor.beginDeferResume();
|
||||
|
||||
@@ -591,7 +591,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
// Prepare the activity record to be ready for immediate removal. It should be invisible and
|
||||
// have no process. Otherwise, request to finish it will send a message to client first.
|
||||
mActivity.setState(STOPPED, "test");
|
||||
mActivity.visible = false;
|
||||
mActivity.mVisibleRequested = false;
|
||||
mActivity.nowVisible = false;
|
||||
// Set process to 'null' to allow immediate removal, but don't call mActivity.setProcess() -
|
||||
// this will cause NPE when updating task's process.
|
||||
@@ -600,7 +600,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
// Put a visible activity on top, so the finishing activity doesn't have to wait until the
|
||||
// next activity reports idle to destroy it.
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = true;
|
||||
topActivity.mVisibleRequested = true;
|
||||
topActivity.nowVisible = true;
|
||||
topActivity.setState(RESUMED, "test");
|
||||
|
||||
@@ -686,7 +686,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testFinishActivityIfPossible_visibleResumedPreparesAppTransition() {
|
||||
mActivity.finishing = false;
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.setState(RESUMED, "test");
|
||||
mActivity.finishIfPossible("test", false /* oomAdj */);
|
||||
|
||||
@@ -702,7 +702,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testFinishActivityIfPossible_visibleNotResumedExecutesAppTransition() {
|
||||
mActivity.finishing = false;
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.setState(PAUSED, "test");
|
||||
mActivity.finishIfPossible("test", false /* oomAdj */);
|
||||
|
||||
@@ -720,7 +720,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
// Put an activity on top of test activity to make it invisible and prevent us from
|
||||
// accidentally resuming the topmost one again.
|
||||
new ActivityBuilder(mService).build();
|
||||
mActivity.visible = false;
|
||||
mActivity.mVisibleRequested = false;
|
||||
mActivity.setState(STOPPED, "test");
|
||||
|
||||
mActivity.finishIfPossible("test", false /* oomAdj */);
|
||||
@@ -772,7 +772,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_keepStateOfNextInvisible() {
|
||||
final ActivityRecord currentTop = mActivity;
|
||||
currentTop.visible = currentTop.nowVisible = true;
|
||||
currentTop.mVisibleRequested = currentTop.nowVisible = true;
|
||||
|
||||
// Simulates that {@code currentTop} starts an existing activity from background (so its
|
||||
// state is stopped) and the starting flow just goes to place it at top.
|
||||
@@ -798,13 +798,13 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_waitForNextVisible() {
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = true;
|
||||
topActivity.mVisibleRequested = true;
|
||||
topActivity.nowVisible = true;
|
||||
topActivity.finishing = true;
|
||||
topActivity.setState(PAUSED, "true");
|
||||
// Mark the bottom activity as not visible, so that we will wait for it before removing
|
||||
// the top one.
|
||||
mActivity.visible = false;
|
||||
mActivity.mVisibleRequested = false;
|
||||
mActivity.nowVisible = false;
|
||||
mActivity.setState(STOPPED, "test");
|
||||
|
||||
@@ -823,13 +823,13 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_noWaitForNextVisible_alreadyInvisible() {
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = false;
|
||||
topActivity.mVisibleRequested = false;
|
||||
topActivity.nowVisible = false;
|
||||
topActivity.finishing = true;
|
||||
topActivity.setState(PAUSED, "true");
|
||||
// Mark the bottom activity as not visible, so that we would wait for it before removing
|
||||
// the top one.
|
||||
mActivity.visible = false;
|
||||
mActivity.mVisibleRequested = false;
|
||||
mActivity.nowVisible = false;
|
||||
mActivity.setState(STOPPED, "test");
|
||||
|
||||
@@ -845,12 +845,12 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_waitForIdle() {
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = true;
|
||||
topActivity.mVisibleRequested = true;
|
||||
topActivity.nowVisible = true;
|
||||
topActivity.finishing = true;
|
||||
topActivity.setState(PAUSED, "true");
|
||||
// Mark the bottom activity as already visible, so that there is no need to wait for it.
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.nowVisible = true;
|
||||
mActivity.setState(RESUMED, "test");
|
||||
|
||||
@@ -866,12 +866,12 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_noWaitForNextVisible_stopped() {
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = false;
|
||||
topActivity.mVisibleRequested = false;
|
||||
topActivity.nowVisible = false;
|
||||
topActivity.finishing = true;
|
||||
topActivity.setState(STOPPED, "true");
|
||||
// Mark the bottom activity as already visible, so that there is no need to wait for it.
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.nowVisible = true;
|
||||
mActivity.setState(RESUMED, "test");
|
||||
|
||||
@@ -887,12 +887,12 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
@Test
|
||||
public void testCompleteFinishing_noWaitForNextVisible_nonFocusedStack() {
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build();
|
||||
topActivity.visible = true;
|
||||
topActivity.mVisibleRequested = true;
|
||||
topActivity.nowVisible = true;
|
||||
topActivity.finishing = true;
|
||||
topActivity.setState(PAUSED, "true");
|
||||
// Mark the bottom activity as already visible, so that there is no need to wait for it.
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.nowVisible = true;
|
||||
mActivity.setState(RESUMED, "test");
|
||||
|
||||
@@ -901,7 +901,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
||||
final ActivityStack stack = new StackBuilder(mRootActivityContainer).build();
|
||||
final ActivityRecord focusedActivity = stack.getChildAt(0).getChildAt(0);
|
||||
focusedActivity.nowVisible = true;
|
||||
focusedActivity.visible = true;
|
||||
focusedActivity.mVisibleRequested = true;
|
||||
focusedActivity.setState(RESUMED, "test");
|
||||
stack.mResumedActivity = focusedActivity;
|
||||
|
||||
|
||||
@@ -1006,7 +1006,7 @@ public class ActivityStackTests extends ActivityTestsBase {
|
||||
|
||||
// There is still an activity1 in stack1 so the activity2 should be added to finishing list
|
||||
// that will be destroyed until idle.
|
||||
stack2.getTopNonFinishingActivity().visible = true;
|
||||
stack2.getTopNonFinishingActivity().mVisibleRequested = true;
|
||||
final ActivityRecord activity2 = finishTopActivity(stack2);
|
||||
assertEquals(STOPPING, activity2.getState());
|
||||
assertThat(mSupervisor.mStoppingActivities).contains(activity2);
|
||||
|
||||
@@ -394,7 +394,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
assertEquals(window1, mWm.mRoot.getTopFocusedDisplayContent().mCurrentFocus);
|
||||
|
||||
// Make sure top focused display not changed if there is a focused app.
|
||||
window1.mActivityRecord.hiddenRequested = true;
|
||||
window1.mActivityRecord.mVisibleRequested = false;
|
||||
window1.getDisplayContent().setFocusedApp(window1.mActivityRecord);
|
||||
updateFocusedWindow();
|
||||
assertTrue(!window1.isFocused());
|
||||
|
||||
@@ -106,12 +106,12 @@ public class RecentsAnimationTest extends ActivityTestsBase {
|
||||
RecentsAnimationCallbacks recentsAnimation = startRecentsActivity(
|
||||
mRecentsComponent, true /* getRecentsAnimation */);
|
||||
// The launch-behind state should make the recents activity visible.
|
||||
assertTrue(recentActivity.visible);
|
||||
assertTrue(recentActivity.mVisibleRequested);
|
||||
|
||||
// Simulate the animation is cancelled without changing the stack order.
|
||||
recentsAnimation.onAnimationFinished(REORDER_KEEP_IN_PLACE, false /* sendUserLeaveHint */);
|
||||
// The non-top recents activity should be invisible by the restored launch-behind state.
|
||||
assertFalse(recentActivity.visible);
|
||||
assertFalse(recentActivity.mVisibleRequested);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -158,7 +158,7 @@ public class RecentsAnimationTest extends ActivityTestsBase {
|
||||
// The activity is started in background so it should be invisible and will be stopped.
|
||||
assertThat(recentsActivity).isNotNull();
|
||||
assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity);
|
||||
assertFalse(recentsActivity.visible);
|
||||
assertFalse(recentsActivity.mVisibleRequested);
|
||||
|
||||
// Assume it is stopped to test next use case.
|
||||
recentsActivity.activityStoppedLocked(null /* newIcicle */, null /* newPersistentState */,
|
||||
@@ -361,7 +361,7 @@ public class RecentsAnimationTest extends ActivityTestsBase {
|
||||
true);
|
||||
|
||||
// Ensure we find the task for the right user and it is made visible
|
||||
assertTrue(otherUserHomeActivity.visible);
|
||||
assertTrue(otherUserHomeActivity.mVisibleRequested);
|
||||
}
|
||||
|
||||
private void startRecentsActivity() {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SizeCompatTests extends ActivityTestsBase {
|
||||
public void testRestartProcessIfVisible() {
|
||||
setUpApp(new TestActivityDisplay.Builder(mService, 1000, 2500).build());
|
||||
doNothing().when(mSupervisor).scheduleRestartTimeout(mActivity);
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
mActivity.setSavedState(null /* savedState */);
|
||||
mActivity.setState(ActivityStack.ActivityState.RESUMED, "testRestart");
|
||||
prepareUnresizable(1.5f /* maxAspect */, SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
@@ -167,7 +167,7 @@ public class SizeCompatTests extends ActivityTestsBase {
|
||||
.setResizeMode(RESIZE_MODE_UNRESIZEABLE)
|
||||
.setMaxAspectRatio(1.5f)
|
||||
.build();
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
|
||||
final Rect originalBounds = new Rect(mActivity.getBounds());
|
||||
final int originalDpi = mActivity.getConfiguration().densityDpi;
|
||||
@@ -320,7 +320,7 @@ public class SizeCompatTests extends ActivityTestsBase {
|
||||
|
||||
prepareUnresizable(1.5f, SCREEN_ORIENTATION_UNSPECIFIED);
|
||||
mActivity.setState(STOPPED, "testSizeCompatMode");
|
||||
mActivity.visible = false;
|
||||
mActivity.mVisibleRequested = false;
|
||||
mActivity.app.setReportedProcState(ActivityManager.PROCESS_STATE_CACHED_ACTIVITY);
|
||||
// Make the parent bounds to be different so the activity is in size compatibility mode.
|
||||
mTask.getWindowConfiguration().setAppBounds(new Rect(0, 0, 600, 1200));
|
||||
@@ -383,7 +383,7 @@ public class SizeCompatTests extends ActivityTestsBase {
|
||||
compatTokens.clear();
|
||||
// Make the activity resizable again by restarting it
|
||||
activity.info.resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE;
|
||||
activity.visible = true;
|
||||
activity.mVisibleRequested = true;
|
||||
activity.restartProcessIfVisible();
|
||||
// The full lifecycle isn't hooked up so manually set state to resumed
|
||||
activity.setState(ActivityStack.ActivityState.RESUMED, "testHandleActivitySizeCompatMode");
|
||||
@@ -400,7 +400,7 @@ public class SizeCompatTests extends ActivityTestsBase {
|
||||
*/
|
||||
private void prepareUnresizable(float maxAspect, int screenOrientation) {
|
||||
mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
|
||||
mActivity.visible = true;
|
||||
mActivity.mVisibleRequested = true;
|
||||
if (maxAspect >= 0) {
|
||||
mActivity.info.maxAspectRatio = maxAspect;
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ public class WindowStateTests extends WindowTestsBase {
|
||||
@Test
|
||||
public void testCantReceiveTouchWhenAppTokenHiddenRequested() {
|
||||
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");
|
||||
win0.mActivityRecord.hiddenRequested = true;
|
||||
win0.mActivityRecord.mVisibleRequested = false;
|
||||
assertTrue(win0.cantReceiveTouchInput());
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class WindowTestUtils {
|
||||
activity.onDisplayChanged(dc);
|
||||
activity.setOccludesParent(true);
|
||||
activity.setHidden(false);
|
||||
activity.hiddenRequested = false;
|
||||
activity.mVisibleRequested = true;
|
||||
}
|
||||
|
||||
static TestWindowToken createTestWindowToken(int type, DisplayContent dc) {
|
||||
|
||||
Reference in New Issue
Block a user