Loading packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt +25 −9 Original line number Diff line number Diff line Loading @@ -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( Loading @@ -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 Loading Loading
packages/SystemUI/compose/scene/src/com/android/compose/animation/scene/SwipeAnimation.kt +25 −9 Original line number Diff line number Diff line Loading @@ -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( Loading @@ -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 Loading