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

Commit e05d29e3 authored by Adrian Roos's avatar Adrian Roos
Browse files

InsetsSourceProvider: Fix serverVisible update order in onPostLayout

Fixes an issue where serverVisible was only updated after updateFrames, but
updating the frames depends on the server visibility being correct since [1].

Also addresses an issue in the test fixture which prevented this regression
from being caught: the server visibility is now set by onPostLayout, instead
of onSetup, to mirror how the server visibility would be set at runtime.

[1]: Id2c482e112c1d73cf7d5b3ba5e1a2d5775f47298

Fixes: 156226586
Test: atest ScreenDecorWindowTests InsetsSourceProviderTest
Change-Id: Id90e6315e9fe230307929a8d992a76a5dae1107c
parent 8fdb8d4f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -219,6 +219,8 @@ class InsetsSourceProvider {
            return;
        }

        setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy()
                && !mWin.mGivenInsetsPending);
        updateSourceFrame();
        if (mControl != null) {
            final Rect frame = mWin.getWindowFrames().mFrame;
@@ -228,8 +230,6 @@ class InsetsSourceProvider {
                mStateController.notifyControlChanged(mControlTarget);
            }
        }
        setServerVisible(mWin.wouldBeVisibleIfPolicyIgnored() && mWin.isVisibleByPolicy()
                && !mWin.mGivenInsetsPending);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
        mSource.setVisible(true);
        mProvider = new InsetsSourceProvider(mSource,
                mDisplayContent.getInsetsStateController(), mDisplayContent);
        mProvider.setServerVisible(true);
        mImeProvider = new InsetsSourceProvider(mImeSource,
                mDisplayContent.getInsetsStateController(), mDisplayContent);
    }
@@ -106,6 +105,7 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
    public void testPostLayout_frameProvider() {
        final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
        statusBar.getFrameLw().set(0, 0, 500, 100);
        statusBar.mHasSurface = true;
        mProvider.setWindow(statusBar,
                (displayFrames, windowState, rect) -> {
                    rect.set(10, 10, 20, 20);