Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af221d16 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

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
parent 05675c80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+10 −3
Original line number Diff line number Diff line
@@ -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);