Merge "Make WindowState.isVisibleRequested actually report requested" into sc-v2-dev
This commit is contained in:
@@ -1842,21 +1842,27 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return super.hasContentToDisplay();
|
return super.hasContentToDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private boolean isVisibleByPolicyOrInsets() {
|
||||||
boolean isVisible() {
|
return isVisibleByPolicy()
|
||||||
return wouldBeVisibleIfPolicyIgnored() && isVisibleByPolicy()
|
|
||||||
// If we don't have a provider, this window isn't used as a window generating
|
// If we don't have a provider, this window isn't used as a window generating
|
||||||
// insets, so nobody can hide it over the inset APIs.
|
// insets, so nobody can hide it over the inset APIs.
|
||||||
&& (mControllableInsetProvider == null
|
&& (mControllableInsetProvider == null
|
||||||
|| mControllableInsetProvider.isClientVisible());
|
|| mControllableInsetProvider.isClientVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isVisible() {
|
||||||
|
return wouldBeVisibleIfPolicyIgnored() && isVisibleByPolicyOrInsets();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isVisibleRequested() {
|
boolean isVisibleRequested() {
|
||||||
if (shouldCheckTokenVisibleRequested()) {
|
final boolean localVisibleRequested =
|
||||||
return isVisible() && mToken.isVisibleRequested();
|
wouldBeVisibleRequestedIfPolicyIgnored() && isVisibleByPolicyOrInsets();
|
||||||
|
if (localVisibleRequested && shouldCheckTokenVisibleRequested()) {
|
||||||
|
return mToken.isVisibleRequested();
|
||||||
}
|
}
|
||||||
return isVisible();
|
return localVisibleRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1903,6 +1909,16 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return !isWallpaper || mToken.isVisible();
|
return !isWallpaper || mToken.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean wouldBeVisibleRequestedIfPolicyIgnored() {
|
||||||
|
final WindowState parent = getParentWindow();
|
||||||
|
final boolean isParentHiddenRequested = parent != null && !parent.isVisibleRequested();
|
||||||
|
if (isParentHiddenRequested || mAnimatingExit || mDestroying) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final boolean isWallpaper = mToken.asWallpaperToken() != null;
|
||||||
|
return !isWallpaper || mToken.isVisibleRequested();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this window visible, ignoring its app token? It is not visible if there is no surface,
|
* Is this window visible, ignoring its app token? It is not visible if there is no surface,
|
||||||
* or we are in the process of running an exit animation that will remove the surface.
|
* or we are in the process of running an exit animation that will remove the surface.
|
||||||
|
|||||||
@@ -946,4 +946,19 @@ public class WindowStateTests extends WindowTestsBase {
|
|||||||
assertNotNull(state.peekSource(ITYPE_IME));
|
assertNotNull(state.peekSource(ITYPE_IME));
|
||||||
assertTrue(state.getSource(ITYPE_IME).isVisible());
|
assertTrue(state.getSource(ITYPE_IME).isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRequestedVisibility() {
|
||||||
|
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||||
|
app.mActivityRecord.setVisible(false);
|
||||||
|
app.mActivityRecord.setVisibility(false /* visible */, false /* deferHidingClient */);
|
||||||
|
assertFalse(app.isVisibleRequested());
|
||||||
|
|
||||||
|
// It doesn't have a surface yet, but should still be visible requested.
|
||||||
|
app.setHasSurface(false);
|
||||||
|
app.mActivityRecord.setVisibility(true /* visible */, false /* deferHidingClient */);
|
||||||
|
|
||||||
|
assertFalse(app.isVisible());
|
||||||
|
assertTrue(app.isVisibleRequested());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user