From 2a367007d37c0ee94403a6f74203a3ee4d0e4958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Kurucz?= Date: Wed, 9 Aug 2023 12:27:22 +0000 Subject: [PATCH] Make keyguard binders update their own views The modified binder classes (among other things) are binding an alpha value to their views. Previously they were changing the alpha value of their own views, but setting the accessibility flags on the root view that is injected to them. This was sometimes leading into marking the NotificationShadeWindowView as IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, which lead to skipping refreshing the accessibility node cache, which lead to flaky or failing integration tests. Fixes: 294229320 Bug: 257543607 Test: execute Notification integration tests Change-Id: Iff9a2865187b2ecbba92b7cf992fdcdbb3e2993e --- ...KeyguardAmbientIndicationAreaViewBinder.kt | 17 +++++----- .../ui/binder/KeyguardBottomAreaViewBinder.kt | 17 +++++----- .../ui/binder/KeyguardIndicationAreaBinder.kt | 34 ++++++++++--------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardAmbientIndicationAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardAmbientIndicationAreaViewBinder.kt index d6883dddba26c..5c072fbfdb01e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardAmbientIndicationAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardAmbientIndicationAreaViewBinder.kt @@ -67,14 +67,15 @@ object KeyguardAmbientIndicationAreaViewBinder { repeatOnLifecycle(Lifecycle.State.STARTED) { launch { keyguardRootViewModel.alpha.collect { alpha -> - view.importantForAccessibility = - if (alpha == 0f) { - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - } else { - View.IMPORTANT_FOR_ACCESSIBILITY_AUTO - } - - ambientIndicationArea?.alpha = alpha + ambientIndicationArea?.apply { + this.importantForAccessibility = + if (alpha == 0f) { + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + } else { + View.IMPORTANT_FOR_ACCESSIBILITY_AUTO + } + this.alpha = alpha + } } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt index a0a2abe833155..0ead8c4a5b4f9 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt @@ -176,14 +176,15 @@ object KeyguardBottomAreaViewBinder { launch { viewModel.alpha.collect { alpha -> - view.importantForAccessibility = - if (alpha == 0f) { - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - } else { - View.IMPORTANT_FOR_ACCESSIBILITY_AUTO - } - - ambientIndicationArea?.alpha = alpha + ambientIndicationArea?.apply { + this.importantForAccessibility = + if (alpha == 0f) { + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + } else { + View.IMPORTANT_FOR_ACCESSIBILITY_AUTO + } + this.alpha = alpha + } } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt index a385a0e5754b6..dc51944ddc083 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardIndicationAreaBinder.kt @@ -73,25 +73,27 @@ object KeyguardIndicationAreaBinder { launch { if (featureFlags.isEnabled(Flags.MIGRATE_SPLIT_KEYGUARD_BOTTOM_AREA)) { keyguardRootViewModel.alpha.collect { alpha -> - view.importantForAccessibility = - if (alpha == 0f) { - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - } else { - View.IMPORTANT_FOR_ACCESSIBILITY_AUTO - } - - indicationArea.alpha = alpha + indicationArea.apply { + this.importantForAccessibility = + if (alpha == 0f) { + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + } else { + View.IMPORTANT_FOR_ACCESSIBILITY_AUTO + } + this.alpha = alpha + } } } else { viewModel.alpha.collect { alpha -> - view.importantForAccessibility = - if (alpha == 0f) { - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS - } else { - View.IMPORTANT_FOR_ACCESSIBILITY_AUTO - } - - indicationArea.alpha = alpha + indicationArea.apply { + this.importantForAccessibility = + if (alpha == 0f) { + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + } else { + View.IMPORTANT_FOR_ACCESSIBILITY_AUTO + } + this.alpha = alpha + } } } }