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

Commit 4d4fae4a authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add missing visible frame copy

Test: Inspect systrace, ensure not a constant ping-pong between
apps and server
Test: InsetsStateTest
Bug: 118118435

Change-Id: I35937971897cf76ad9187c7c23a7abf394d59e46
parent b29730fc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ public class InsetsSource implements Parcelable {
        mType = other.mType;
        mFrame = new Rect(other.mFrame);
        mVisible = other.mVisible;
        mVisibleFrame = other.mVisibleFrame != null
                ? new Rect(other.mVisibleFrame)
                : null;
    }

    public void setFrame(Rect frame) {
@@ -165,6 +168,7 @@ public class InsetsSource implements Parcelable {
    public int hashCode() {
        int result = mType;
        result = 31 * result + mFrame.hashCode();
        result = 31 * result + (mVisibleFrame != null ? mVisibleFrame.hashCode() : 0);
        result = 31 * result + (mVisible ? 1 : 0);
        return result;
    }
+11 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ public class InsetsStateTest {
    @Test
    public void testParcelUnparcel() {
        mState.getSource(ITYPE_IME).setFrame(new Rect(0, 0, 100, 100));
        mState.getSource(ITYPE_IME).setVisibleFrame(new Rect(0, 0, 50, 10));
        mState.getSource(ITYPE_IME).setVisible(true);
        mState.getSource(ITYPE_STATUS_BAR).setFrame(new Rect(0, 0, 100, 100));
        Parcel p = Parcel.obtain();
@@ -223,6 +224,16 @@ public class InsetsStateTest {
        assertEquals(mState, mState2);
    }

    @Test
    public void testCopy() {
        mState.getSource(ITYPE_IME).setFrame(new Rect(0, 0, 100, 100));
        mState.getSource(ITYPE_IME).setVisibleFrame(new Rect(0, 0, 50, 10));
        mState.getSource(ITYPE_IME).setVisible(true);
        mState.getSource(ITYPE_STATUS_BAR).setFrame(new Rect(0, 0, 100, 100));
        mState2.set(mState, true);
        assertEquals(mState, mState2);
    }

    @Test
    public void testGetDefaultVisibility() {
        assertTrue(InsetsState.getDefaultVisibility(ITYPE_STATUS_BAR));