Fix that window was not hidden after policy hiding animation

When we removed WindowState.isOnScreenIgnoringKeyguard we forgot
to change WindowState.isOnScreen to also check policy visibility.

Test: runtest frameworks-services -c com.android.server.wm.WindowStateTests
Test: Open camera app, make sure status bar is hidden

Change-Id: I780f50c8ed3e675f2fab623fdba4fcfc5b6f1d5b
Fixes: 32890266
This commit is contained in:
Jorim Jaggi
2016-11-15 14:59:57 -08:00
parent 05675c80c1
commit af221d16de
2 changed files with 11 additions and 4 deletions

View File

@@ -1400,7 +1400,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* being visible.
*/
boolean isOnScreen() {
if (!mHasSurface || mDestroying) {
if (!mHasSurface || mDestroying || !mPolicyVisibility) {
return false;
}
final AppWindowToken atoken = mAppToken;

View File

@@ -41,9 +41,7 @@ import static org.junit.Assert.assertTrue;
/**
* Tests for the {@link WindowState} class.
*
* Build: mmma -j32 frameworks/base/services/tests/servicestests
* Install: adb install -r out/target/product/$TARGET_PRODUCT/data/app/FrameworksServicesTests/FrameworksServicesTests.apk
* Run: adb shell am instrument -w -e class com.android.server.wm.WindowStateTests com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
* runtest frameworks-services -c com.android.server.wm.WindowStateTests
*/
@SmallTest
@Presubmit
@@ -160,6 +158,15 @@ public class WindowStateTests {
assertEquals(root, child2.getTopParentWindow());
}
@Test
public void testIsOnScreen_hiddenByPolicy() {
final WindowState window = createWindow(null, TYPE_APPLICATION);
window.setHasSurface(true);
assertTrue(window.isOnScreen());
window.hideLw(false /* doAnimation */);
assertFalse(window.isOnScreen());
}
private WindowState createWindow(WindowState parent, int type) {
final WindowManager.LayoutParams attrs = new WindowManager.LayoutParams(type);