Loading core/java/android/view/InsetsSource.java +9 −3 Original line number Diff line number Diff line Loading @@ -355,11 +355,17 @@ public class InsetsSource implements Parcelable { final Rect frame = getFrame(); if (mBoundingRects == null) { // No bounding rects set, make a single bounding rect that covers the intersection of // the |frame| and the |relativeFrame|. // the |frame| and the |relativeFrame|. Also make it relative to the window origin. return mTmpBoundingRect.setIntersect(frame, relativeFrame) ? new Rect[]{ new Rect(mTmpBoundingRect) } ? new Rect[]{ new Rect( mTmpBoundingRect.left - relativeFrame.left, mTmpBoundingRect.top - relativeFrame.top, mTmpBoundingRect.right - relativeFrame.left, mTmpBoundingRect.bottom - relativeFrame.top ) } : NO_BOUNDING_RECTS; } // Special treatment for captionBar inset type. During drag-resizing, the |frame| and Loading core/tests/coretests/src/android/view/InsetsSourceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,17 @@ public class InsetsSourceTest { assertEquals(new Rect(0, 0, 1000, 100), rects[0]); } @Test public void testCalculateBoundingRects_noBoundingRectsAndFrameNotAtOrigin_createsSingleRect() { mSource.setFrame(new Rect(100, 100, 1200, 200)); mSource.setBoundingRects(null); final Rect[] rects = mSource.calculateBoundingRects(new Rect(100, 100, 1100, 1100), false); assertEquals(1, rects.length); assertEquals(new Rect(0, 0, 1000, 100), rects[0]); } @Test public void testCalculateBoundingRects_noBoundingRectsAndLargerFrame_singleRectFitsRelFrame() { mSource.setFrame(new Rect(0, 0, 1000, 100)); Loading Loading
core/java/android/view/InsetsSource.java +9 −3 Original line number Diff line number Diff line Loading @@ -355,11 +355,17 @@ public class InsetsSource implements Parcelable { final Rect frame = getFrame(); if (mBoundingRects == null) { // No bounding rects set, make a single bounding rect that covers the intersection of // the |frame| and the |relativeFrame|. // the |frame| and the |relativeFrame|. Also make it relative to the window origin. return mTmpBoundingRect.setIntersect(frame, relativeFrame) ? new Rect[]{ new Rect(mTmpBoundingRect) } ? new Rect[]{ new Rect( mTmpBoundingRect.left - relativeFrame.left, mTmpBoundingRect.top - relativeFrame.top, mTmpBoundingRect.right - relativeFrame.left, mTmpBoundingRect.bottom - relativeFrame.top ) } : NO_BOUNDING_RECTS; } // Special treatment for captionBar inset type. During drag-resizing, the |frame| and Loading
core/tests/coretests/src/android/view/InsetsSourceTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,17 @@ public class InsetsSourceTest { assertEquals(new Rect(0, 0, 1000, 100), rects[0]); } @Test public void testCalculateBoundingRects_noBoundingRectsAndFrameNotAtOrigin_createsSingleRect() { mSource.setFrame(new Rect(100, 100, 1200, 200)); mSource.setBoundingRects(null); final Rect[] rects = mSource.calculateBoundingRects(new Rect(100, 100, 1100, 1100), false); assertEquals(1, rects.length); assertEquals(new Rect(0, 0, 1000, 100), rects[0]); } @Test public void testCalculateBoundingRects_noBoundingRectsAndLargerFrame_singleRectFitsRelFrame() { mSource.setFrame(new Rect(0, 0, 1000, 100)); Loading