Fix isVisibleOrAdding and update name/docs
At some point, the functionality drifted from the name and documentation. This changes the functionality back to the mismatching functionality, but renames the method and updates the documentation to match the behavior. Bug: 205075200 Bug: 205761007 Bug: 204948120 Bug: 204731658 Test: open dev options in settings, click search, observe ime showing Test: atest OpenImeWindowAndCloseTest Change-Id: I3ec44ef6c444bbcfa60571ce8e39e3d531af64d7
This commit is contained in:
@@ -1863,7 +1863,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE, "addWindow: New client %s"
|
||||
+ ": window=%s Callers=%s", client.asBinder(), win, Debug.getCallers(5));
|
||||
|
||||
if (win.isVisibleOrAdding() && displayContent.updateOrientation()) {
|
||||
if (win.isVisibleRequestedOrAdding() && displayContent.updateOrientation()) {
|
||||
displayContent.sendNewConfiguration();
|
||||
}
|
||||
|
||||
|
||||
@@ -1993,14 +1993,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as isVisible(), but we also count it as visible between the
|
||||
* call to IWindowSession.add() and the first relayout().
|
||||
* Is this window capable of being visible (policy and content), in a visible part of the
|
||||
* hierarchy, and, if an activity window, the activity is visible-requested. Note, this means
|
||||
* if the activity is going-away, this will be {@code false} even when the window is visible.
|
||||
*
|
||||
* The 'adding' part refers to the period of time between IWindowSession.add() and the first
|
||||
* relayout() -- which, for activities, is the same as visibleRequested.
|
||||
*
|
||||
* TODO(b/206005136): This is very similar to isVisibleRequested(). Investigate merging them.
|
||||
*/
|
||||
boolean isVisibleOrAdding() {
|
||||
boolean isVisibleRequestedOrAdding() {
|
||||
final ActivityRecord atoken = mActivityRecord;
|
||||
return (mHasSurface || (!mRelayoutCalled && mViewVisibility == View.VISIBLE))
|
||||
&& isVisibleByPolicy() && !isParentWindowHidden()
|
||||
&& (atoken == null || atoken.isVisible())
|
||||
&& (atoken == null || atoken.mVisibleRequested)
|
||||
&& !mAnimatingExit && !mDestroying;
|
||||
}
|
||||
|
||||
@@ -2732,8 +2738,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
if (DEBUG_INPUT_METHOD) {
|
||||
Slog.i(TAG_WM, "isVisibleOrAdding " + this + ": " + isVisibleOrAdding());
|
||||
if (!isVisibleOrAdding()) {
|
||||
Slog.i(TAG_WM, "isVisibleRequestedOrAdding " + this + ": "
|
||||
+ isVisibleRequestedOrAdding());
|
||||
if (!isVisibleRequestedOrAdding()) {
|
||||
Slog.i(TAG_WM, " mSurfaceController=" + mWinAnimator.mSurfaceController
|
||||
+ " relayoutCalled=" + mRelayoutCalled
|
||||
+ " viewVis=" + mViewVisibility
|
||||
@@ -2747,7 +2754,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
}
|
||||
}
|
||||
return isVisibleOrAdding();
|
||||
return isVisibleRequestedOrAdding();
|
||||
}
|
||||
|
||||
private final class DeadWindowEventReceiver extends InputEventReceiver {
|
||||
@@ -3173,7 +3180,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
public String canReceiveKeysReason(boolean fromUserTouch) {
|
||||
return "fromTouch= " + fromUserTouch
|
||||
+ " isVisibleOrAdding=" + isVisibleOrAdding()
|
||||
+ " isVisibleRequestedOrAdding=" + isVisibleRequestedOrAdding()
|
||||
+ " mViewVisibility=" + mViewVisibility
|
||||
+ " mRemoveOnExit=" + mRemoveOnExit
|
||||
+ " flags=" + mAttrs.flags
|
||||
@@ -3185,7 +3192,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
public boolean canReceiveKeys(boolean fromUserTouch) {
|
||||
final boolean canReceiveKeys = isVisibleOrAdding()
|
||||
final boolean canReceiveKeys = isVisibleRequestedOrAdding()
|
||||
&& (mViewVisibility == View.VISIBLE) && !mRemoveOnExit
|
||||
&& ((mAttrs.flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0)
|
||||
&& (mActivityRecord == null || mActivityRecord.windowsAreFocusable(fromUserTouch))
|
||||
@@ -3451,7 +3458,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
public void pokeDrawLockLw(long timeout) {
|
||||
if (isVisibleOrAdding()) {
|
||||
if (isVisibleRequestedOrAdding()) {
|
||||
if (mDrawLock == null) {
|
||||
// We want the tag name to be somewhat stable so that it is easier to correlate
|
||||
// in wake lock statistics. So in particular, we don't want to include the
|
||||
|
||||
Reference in New Issue
Block a user