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
This commit is contained in:
András Kurucz
2023-08-09 12:27:22 +00:00
parent 709d8358ce
commit 2a367007d3
3 changed files with 36 additions and 32 deletions

View File

@@ -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
}
}
}

View File

@@ -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
}
}
}

View File

@@ -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
}
}
}
}