Merge "Fix a potential NPE" into sc-v2-dev
This commit is contained in:
@@ -346,6 +346,9 @@ public class ExpandedAnimationController
|
||||
* bubble is dragged back into the row.
|
||||
*/
|
||||
public void dragBubbleOut(View bubbleView, float x, float y) {
|
||||
if (mMagnetizedBubbleDraggingOut == null) {
|
||||
return;
|
||||
}
|
||||
if (mSpringToTouchOnNextMotionEvent) {
|
||||
springBubbleTo(mMagnetizedBubbleDraggingOut.getUnderlyingObject(), x, y);
|
||||
mSpringToTouchOnNextMotionEvent = false;
|
||||
|
||||
@@ -59,19 +59,21 @@ public class ExpandedAnimationControllerTest extends PhysicsAnimationLayoutTestC
|
||||
private int mStackOffset;
|
||||
private PointF mExpansionPoint;
|
||||
private BubblePositioner mPositioner;
|
||||
private BubbleStackView.StackViewState mStackViewState;
|
||||
private BubbleStackView.StackViewState mStackViewState = new BubbleStackView.StackViewState();
|
||||
|
||||
@SuppressLint("VisibleForTests")
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
BubbleStackView stackView = mock(BubbleStackView.class);
|
||||
when(stackView.getState()).thenReturn(getStackViewState());
|
||||
mPositioner = new BubblePositioner(getContext(), mock(WindowManager.class));
|
||||
mPositioner.updateInternal(Configuration.ORIENTATION_PORTRAIT,
|
||||
Insets.of(0, 0, 0, 0),
|
||||
new Rect(0, 0, mDisplayWidth, mDisplayHeight));
|
||||
|
||||
BubbleStackView stackView = mock(BubbleStackView.class);
|
||||
when(stackView.getState()).thenReturn(getStackViewState());
|
||||
|
||||
mExpandedController = new ExpandedAnimationController(mPositioner,
|
||||
mOnBubbleAnimatedOutAction,
|
||||
stackView);
|
||||
@@ -135,6 +137,12 @@ public class ExpandedAnimationControllerTest extends PhysicsAnimationLayoutTestC
|
||||
testBubblesInCorrectExpandedPositions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDragBubbleOutDoesntNPE() throws InterruptedException {
|
||||
mExpandedController.onGestureFinished();
|
||||
mExpandedController.dragBubbleOut(mViews.get(0), 1, 1);
|
||||
}
|
||||
|
||||
/** Expand the stack and wait for animations to finish. */
|
||||
private void expand() throws InterruptedException {
|
||||
mExpandedController.expandFromStack(mock(Runnable.class));
|
||||
|
||||
Reference in New Issue
Block a user