diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java | 7 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java index 1858305bb286..58f3f2211d81 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleFlyoutView.java @@ -276,6 +276,13 @@ public class BubbleFlyoutView extends FrameLayout { /** Sets the percentage that the flyout should be collapsed into dot form. */ void setCollapsePercent(float percentCollapsed) { + // This is unlikely, but can happen in a race condition where the flyout view hasn't been + // laid out and returns 0 for getWidth(). We check for this condition at the sites where + // this method is called, but better safe than sorry. + if (Float.isNaN(percentCollapsed)) { + return; + } + mPercentTransitionedToDot = Math.max(0f, Math.min(percentCollapsed, 1f)); mPercentStillFlyout = (1f - mPercentTransitionedToDot); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 335f62cfae05..13d6470a351f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1084,6 +1084,12 @@ public class BubbleStackView extends FrameLayout { } void onFlyoutDragged(float deltaX) { + // This shouldn't happen, but if it does, just wait until the flyout lays out. This method + // is continually called. + if (mFlyout.getWidth() <= 0) { + return; + } + final boolean onLeft = mStackAnimationController.isStackOnLeftSide(); mFlyoutDragDeltaX = deltaX; @@ -1102,7 +1108,6 @@ public class BubbleStackView extends FrameLayout { // after it has already become the dot. final boolean overscrollingLeft = (onLeft && collapsePercent > 1f) || (!onLeft && collapsePercent < 0f); - overscrollTranslation = (overscrollingPastDot ? collapsePercent - 1f : collapsePercent * -1) * (overscrollingLeft ? -1 : 1) |