diff options
| author | 2021-12-15 17:05:15 +0000 | |
|---|---|---|
| committer | 2021-12-15 17:05:15 +0000 | |
| commit | 1f0415d24bbedd7b678d2f91c302bbbc59faec51 (patch) | |
| tree | a036f4bc63825dd5d48e4949c3b80995897985fa | |
| parent | dc1455f2e3df42439b3d8caa0703c06badf55bf0 (diff) | |
| parent | 65ce0da897d75b40e89205186db13b0a46fea297 (diff) | |
Merge "Fix dialog accessibility issues." into sc-v2-dev am: 65ce0da897
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16477357
Change-Id: I8725e95c208ca3409897f456f7274f3a992df10c
2 files changed, 20 insertions, 3 deletions
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt index 066e169dcde3..f7a7603944f6 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/DialogLaunchAnimator.kt @@ -299,6 +299,13 @@ private class AnimatedDialog( fullscreenTransparentBackground.setOnClickListener { dialog.dismiss() } dialogContentWithBackground.isClickable = true + // Make sure the transparent and dialog backgrounds are not focusable by accessibility + // features. + fullscreenTransparentBackground.importantForAccessibility = + View.IMPORTANT_FOR_ACCESSIBILITY_NO + dialogContentWithBackground.importantForAccessibility = + View.IMPORTANT_FOR_ACCESSIBILITY_NO + fullscreenTransparentBackground.addView( dialogContentWithBackground, FrameLayout.LayoutParams( @@ -342,8 +349,10 @@ private class AnimatedDialog( ?.color ?.defaultColor ?: Color.BLACK - // Make the background view invisible until we start the animation. - dialogContentWithBackground.visibility = View.INVISIBLE + // Make the background view invisible until we start the animation. We use the transition + // visibility like GhostView does so that we don't mess up with the accessibility tree (see + // b/204944038#comment17). + dialogContentWithBackground.setTransitionVisibility(View.INVISIBLE) // Make sure the dialog is visible instantly and does not do any window animation. window.attributes.windowAnimations = R.style.Animation_LaunchAnimation diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt index 3ccf5e4fbdd0..86cd357d061e 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/GhostedViewLaunchAnimatorController.kt @@ -186,7 +186,11 @@ open class GhostedViewLaunchAnimatorController( // Making the ghost view invisible will make the ghosted view visible, so order is // important here. ghostView.visibility = View.INVISIBLE - ghostedView.visibility = View.INVISIBLE + + // Make the ghosted view invisible again. We use the transition visibility like + // GhostView does so that we don't mess up with the accessibility tree (see + // b/204944038#comment17). + ghostedView.setTransitionVisibility(View.INVISIBLE) backgroundView.visibility = View.INVISIBLE } return @@ -257,6 +261,10 @@ open class GhostedViewLaunchAnimatorController( GhostView.removeGhost(ghostedView) launchContainerOverlay.remove(backgroundView) + + // Make sure that the view is considered VISIBLE by accessibility by first making it + // INVISIBLE then VISIBLE (see b/204944038#comment17 for more info). + ghostedView.visibility = View.INVISIBLE ghostedView.visibility = View.VISIBLE ghostedView.invalidate() } |