From 85a7e84034b0a3e9dd2203bb7c202bb7aac8ea13 Mon Sep 17 00:00:00 2001 From: Beth Thibodeau Date: Wed, 23 Jun 2021 23:08:55 -0400 Subject: [PATCH] Fix settings gear visibility When the settings gear is first initialized the width can be reported as 0, which lead to NaN in the `map` function and throwing off the other calculations. This adds a check to the width so it will simply be set invisible in that case instead Fixes: 185929062 Test: manual (repro steps in bug) Change-Id: Id2a8582e8342d807825536bfcaac7d79a042c7cc --- .../com/android/systemui/media/MediaCarouselScrollHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt index b0d4cb1c98187..cbcec9531ce42 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt @@ -236,7 +236,7 @@ class MediaCarouselScrollHandler( } private fun updateSettingsPresentation() { - if (showsSettingsButton) { + if (showsSettingsButton && settingsButton.width > 0) { val settingsOffset = MathUtils.map( 0.0f, getMaxTranslation().toFloat(),