A11y - Focus on customize lock screen button

When activated. Talkback makes it clear to the user that
long-pressing on the lockscreen should activate the customize
lock screen button. Set focus to this element.

Fixes: 318028938
Test: manual - use talkback to activate customize lock screen
Flag: EXEMPT bugfix
Change-Id: I4b3e09127b66889bf62b55beee157aa8f14b03c0
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt
index 79360370..13c2ffb 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt
@@ -19,6 +19,8 @@
 
 import android.graphics.Rect
 import android.view.View
+import android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED
+import android.widget.TextView
 import androidx.core.view.isVisible
 import androidx.lifecycle.Lifecycle
 import androidx.lifecycle.repeatOnLifecycle
@@ -47,7 +49,7 @@
         touchHandlingViewModel: KeyguardTouchHandlingViewModel,
         rootViewModel: KeyguardRootViewModel?,
         vibratorHelper: VibratorHelper,
-        activityStarter: ActivityStarter
+        activityStarter: ActivityStarter,
     ): DisposableHandle {
         val disposableHandle =
             view.repeatWhenAttached {
@@ -57,19 +59,16 @@
                             view.animateVisibility(visible = isVisible)
                             if (isVisible) {
                                 vibratorHelper.vibrate(KeyguardBottomAreaVibrations.Activated)
+                                val textView = view.requireViewById(R.id.text) as TextView
                                 view.setOnTouchListener(
-                                    KeyguardSettingsButtonOnTouchListener(
-                                        viewModel = viewModel,
-                                    )
+                                    KeyguardSettingsButtonOnTouchListener(viewModel = viewModel)
                                 )
                                 IconViewBinder.bind(
                                     icon = viewModel.icon,
                                     view = view.requireViewById(R.id.icon),
                                 )
-                                TextViewBinder.bind(
-                                    view = view.requireViewById(R.id.text),
-                                    viewModel = viewModel.text,
-                                )
+                                TextViewBinder.bind(view = textView, viewModel = viewModel.text)
+                                textView.sendAccessibilityEvent(TYPE_VIEW_FOCUSED)
                             }
                         }
                     }
@@ -108,15 +107,12 @@
     }
 
     /** Opens the wallpaper picker screen after the device is unlocked by the user. */
-    private fun navigateToLockScreenSettings(
-        activityStarter: ActivityStarter,
-        view: View,
-    ) {
+    private fun navigateToLockScreenSettings(activityStarter: ActivityStarter, view: View) {
         activityStarter.postStartActivityDismissingKeyguard(
             WallpaperPickerIntentUtils.getIntent(view.context, LAUNCH_SOURCE_KEYGUARD),
             /* delay= */ 0,
             /* animationController= */ ActivityTransitionAnimator.Controller.fromView(view),
-            /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls)
+            /* customMessage= */ view.context.getString(R.string.keyguard_unlock_to_customize_ls),
         )
     }