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

Commit 4c525672 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Add log for b/431165757

Bug: 431165757
Test: N/A
Flag: EXEMPT simple log to help understand b/431165757
Change-Id: I3034d9aed733fb4dff16de21b7127e920b467e60
parent 115083e3
Loading
Loading
Loading
Loading
+25 −9
Original line number Diff line number Diff line
@@ -491,7 +491,9 @@ internal fun willDecayFasterThanAnimating(
    //
    // For the decay, we can use a simple binary search given that once the decay has reached
    // the target value it will never change direction.
    val decayDuration = binarySearch { timeMs ->
    val decayDuration =
        try {
            binarySearch { timeMs ->
                hasReachedTargetOffset(
                    converter.convertFromVector(
                        decayAnimationSpecVector.getValueFromNanos(
@@ -502,6 +504,20 @@ internal fun willDecayFasterThanAnimating(
                    )
                )
            }
        } catch (e: Exception) {
            // TODO(b/431165757): Find the root cause of the crash and remove this log.
            throw IllegalStateException(
                buildString {
                    appendLine("binarySearch() threw an exception")
                    appendLine("  initialOffset=$initialOffset")
                    appendLine("  targetOffset=$targetOffset")
                    appendLine("  initialVelocity=$initialVelocity")
                    appendLine("  decayAnimationSpec=$decayAnimationSpec")
                    appendLine("  animationSpec=$animationSpec")
                },
                e,
            )
        }

    // For the animation we can't use binary search given that springs and eased interpolations
    // can oscillate around the target offset. Given that it's ok to estimate this duration, we