From 608087aa121bf26474d67aa9f59da4524dda4e59 Mon Sep 17 00:00:00 2001 From: Shan Huang Date: Wed, 14 Apr 2021 09:57:15 +0800 Subject: [PATCH] Fix a bug that ripple might get readded to WM and cause crash. Bug: 184868310 Test: SystemUITests Test: Manually Change-Id: Idfd7d25ee60065ef3b2d9b48a35b5a8c570fc945 --- .../statusbar/charging/WiredChargingRippleController.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/charging/WiredChargingRippleController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/charging/WiredChargingRippleController.kt index fd060e6d486d8..c27aa5768a469 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/charging/WiredChargingRippleController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/charging/WiredChargingRippleController.kt @@ -103,7 +103,10 @@ class WiredChargingRippleController @Inject constructor( } fun startRipple() { - if (rippleView.rippleInProgress) { + if (rippleView.rippleInProgress || rippleView.parent != null) { + // Skip if ripple is still playing, or not playing but already added the parent + // (which might happen just before the animation starts or right after + // the animation ends.) return } val mWM = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager