From cb6dfdf83b4fbbd430572bb2973bba6e4342c2e0 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 30 Mar 2023 13:55:33 -0700 Subject: [PATCH] Ensure that setVisibility is the first operation that is done when isShowing state is collected. Before, visibility is set to VISIBLE after view is inflated. I think there is a race condition happening here where when isShowing is set to false, visible is set to INVISIBLE before view inflation has completed and then view is set to VISIBLE. Fixes: 274608304 Test: I was able to reproduce the bug by longpressing the lock icon and tapping the arrow icon in the notifications at the same time. The unscrimmed bouncer would show ~1/60 times. After the change, I can no longer repro. Change-Id: I539598ff83344ec92fdf0afaddd9c5a374d343ac --- .../systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt index 468a6b52c5e5e..fc0e6cb1a63bf 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt @@ -110,11 +110,11 @@ object KeyguardBouncerViewBinder { viewModel.setBouncerViewDelegate(delegate) launch { viewModel.isShowing.collect { isShowing -> + view.visibility = if (isShowing) View.VISIBLE else View.INVISIBLE if (isShowing) { // Reset Security Container entirely. securityContainerController.reinflateViewFlipper { // Reset Security Container entirely. - view.visibility = View.VISIBLE securityContainerController.onBouncerVisibilityChanged( /* isVisible= */ true ) @@ -127,7 +127,6 @@ object KeyguardBouncerViewBinder { ) } } else { - view.visibility = View.INVISIBLE securityContainerController.onBouncerVisibilityChanged( /* isVisible= */ false )