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

Commit 03932659 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix possible num format exception when logging bubble stack position"...

Merge "Fix possible num format exception when logging bubble stack position" into udc-dev am: 4c897660 am: 0d7eacd0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22973207



Change-Id: I6ded172eb8a30fe81d070795259d68b30d7cda8e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7debb5e0 0d7eacd0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3320,7 +3320,9 @@ public class BubbleStackView extends FrameLayout
     * @return the normalized x-axis position of the bubble stack rounded to 4 decimal places.
     */
    public float getNormalizedXPosition() {
        return new BigDecimal(getStackPosition().x / mPositioner.getAvailableRect().width())
        int width = mPositioner.getAvailableRect().width();
        float stackPosition = width > 0 ? getStackPosition().x / width : 0;
        return new BigDecimal(stackPosition)
                .setScale(4, RoundingMode.CEILING.HALF_UP)
                .floatValue();
    }
@@ -3329,7 +3331,9 @@ public class BubbleStackView extends FrameLayout
     * @return the normalized y-axis position of the bubble stack rounded to 4 decimal places.
     */
    public float getNormalizedYPosition() {
        return new BigDecimal(getStackPosition().y / mPositioner.getAvailableRect().height())
        int height = mPositioner.getAvailableRect().height();
        float stackPosition = height > 0 ? getStackPosition().y / height : 0;
        return new BigDecimal(stackPosition)
                .setScale(4, RoundingMode.CEILING.HALF_UP)
                .floatValue();
    }