From 1a0b343bce93b0de481a62802b3eef51efc97032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6llner?= Date: Thu, 24 Feb 2022 18:12:05 +0100 Subject: [PATCH] MediaHierarchyManager: prevent crash when previousLocation is -1 This can happen when expanding split shade on lock screen with no media. Because we are expanding on lock screen in split shade, the transformation type is TRANSITION. Bug: 221193561 Test: Manually Change-Id: Ide21f54d80113e646729cd40c42ed1039d6a0413 --- .../src/com/android/systemui/media/MediaHierarchyManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt index eee39552bcc85..d00630ead8e13 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt @@ -785,7 +785,11 @@ class MediaHierarchyManager @Inject constructor( * @return true if this transformation is guided by an external progress like a finger */ private fun isCurrentlyInGuidedTransformation(): Boolean { - return getTransformationProgress() >= 0 + return hasValidStartAndEndLocations() && getTransformationProgress() >= 0 + } + + private fun hasValidStartAndEndLocations(): Boolean { + return previousLocation != -1 && desiredLocation != -1 } /**