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

Commit 9964f40c authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Add missing visible frame copy"

parents 7bbfd92d 4d4fae4a
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));