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

Commit cf3c99f4 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Alternate bouncer focuses on FP indicator

Make the SFPS indicator focusable and update its label
to be more informative.

Fixes: 344763543
Test: atest SideFpsOverlayViewBinderTest
Test: manually enable talkback on UDFPS & SFPS devices.
Tap on notification intent to show alternate bouncer.
Observe information about fingerprint sensor is
announced.
Flag: EXEMPT bugfix

Change-Id: Iaaa8b00faa35917c9770631ddd54a1f1d87a47e6
parent 0a0d7866
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sysui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/alternate_bouncer"
    android:focusable="true"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

+1 −2
Original line number Diff line number Diff line
@@ -22,5 +22,4 @@
    android:layout_height="wrap_content"
    app:lottie_autoPlay="true"
    app:lottie_loop="true"
    app:lottie_rawRes="@raw/sfps_pulse"
    android:importantForAccessibility="no"/>
 No newline at end of file
    app:lottie_rawRes="@raw/sfps_pulse" />
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -3121,6 +3121,8 @@

    <!-- Accessibility label for a11y action to show the bouncer (pin/pattern/password) screen lock [CHAR LIMIT=NONE] -->
    <string name="accessibility_bouncer">enter screen lock</string>
    <!-- Accessibility label for side fingerprint sensor indicator [CHAR LIMIT=NONE] -->
    <string name="accessibility_side_fingerprint_indicator_label">Touch the fingerprint sensor. It\u2019s the shorter button on the side of the phone</string>
    <!-- Accessibility label for fingerprint sensor [CHAR LIMIT=NONE] -->
    <string name="accessibility_fingerprint_label">Fingerprint sensor</string>
    <!-- Accessibility action for tapping on an affordance that will bring up the user's
+12 −25
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.view.accessibility.AccessibilityEvent
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.airbnb.lottie.LottieAnimationView
@@ -47,11 +46,11 @@ import com.android.systemui.lifecycle.repeatWhenAttached
import com.android.systemui.res.R
import com.android.systemui.util.kotlin.sample
import dagger.Lazy
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.launch
import javax.inject.Inject

/** Binds the side fingerprint sensor indicator view to [SideFpsOverlayViewModel]. */
@OptIn(ExperimentalCoroutinesApi::class)
@@ -127,6 +126,11 @@ constructor(
        }

        overlayView = layoutInflater.get().inflate(R.layout.sidefps_view, null, false)
            .apply {
                contentDescription = context.resources.getString(
                        R.string.accessibility_side_fingerprint_indicator_label
                )
            }

        val overlayViewModel =
            SideFpsOverlayViewModel(
@@ -135,11 +139,13 @@ constructor(
                displayStateInteractor.get(),
                sfpsSensorInteractor.get(),
            )
        bind(overlayView!!, overlayViewModel, windowManager.get())
        overlayView!!.visibility = View.INVISIBLE
        overlayView?.let { overlayView ->
            bind(overlayView, overlayViewModel, windowManager.get())
            overlayView.visibility = View.INVISIBLE
            Log.d(TAG, "show(): adding overlayView $overlayView")
            windowManager.get().addView(overlayView, overlayViewModel.defaultOverlayViewParams)
        }
    }

    /** Hide the side fingerprint sensor indicator */
    private fun hide() {
@@ -179,25 +185,6 @@ constructor(

                overlayShowAnimator.start()

                it.setAccessibilityDelegate(
                    object : View.AccessibilityDelegate() {
                        override fun dispatchPopulateAccessibilityEvent(
                            host: View,
                            event: AccessibilityEvent
                        ): Boolean {
                            return if (
                                event.getEventType() ===
                                    android.view.accessibility.AccessibilityEvent
                                        .TYPE_WINDOW_STATE_CHANGED
                            ) {
                                true
                            } else {
                                super.dispatchPopulateAccessibilityEvent(host, event)
                            }
                        }
                    }
                )

                repeatOnLifecycle(Lifecycle.State.STARTED) {
                    launch {
                        viewModel.lottieCallbacks.collect { callbacks ->
+5 −1
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ constructor(
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
                    Utils.FINGERPRINT_OVERLAY_LAYOUT_PARAM_FLAGS,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED or
                            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or
                            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                    PixelFormat.TRANSLUCENT
                )
                .apply {
@@ -91,6 +93,8 @@ constructor(
                    layoutInDisplayCutoutMode =
                        WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
                    privateFlags = PRIVATE_FLAG_TRUSTED_OVERLAY or PRIVATE_FLAG_NO_MOVE_ANIMATION
                    // Avoid announcing window title.
                    accessibilityTitle = " "
                }

    private val indicatorAsset: Flow<Int> =
Loading