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

Commit a7cb2966 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add log for b/431165757" into main

parents a9492910 4c525672
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