Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d8de9ce authored by Matt Pietal's avatar Matt Pietal
Browse files

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
parent ff05aae2
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.systemui.keyguard.ui.binder

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 @@ object KeyguardSettingsViewBinder {
        touchHandlingViewModel: KeyguardTouchHandlingViewModel,
        rootViewModel: KeyguardRootViewModel?,
        vibratorHelper: VibratorHelper,
        activityStarter: ActivityStarter
        activityStarter: ActivityStarter,
    ): DisposableHandle {
        val disposableHandle =
            view.repeatWhenAttached {
@@ -57,19 +59,16 @@ object KeyguardSettingsViewBinder {
                            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 @@ object KeyguardSettingsViewBinder {
    }

    /** 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),
        )
    }