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

Commit 0d6e9b95 authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Merge "Revert "Alternate bouncer focuses on FP indicator"" into main

parents c1ef3ca9 bf985f02
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
    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">

+2 −1
Original line number Diff line number Diff line
@@ -22,4 +22,5 @@
    android:layout_height="wrap_content"
    app:lottie_autoPlay="true"
    app:lottie_loop="true"
    app:lottie_rawRes="@raw/sfps_pulse" />
 No newline at end of file
    app:lottie_rawRes="@raw/sfps_pulse"
    android:importantForAccessibility="no"/>
 No newline at end of file
+25 −12
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ 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
@@ -46,11 +47,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)
@@ -126,11 +127,6 @@ 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(
@@ -139,13 +135,11 @@ constructor(
                displayStateInteractor.get(),
                sfpsSensorInteractor.get(),
            )
        overlayView?.let { overlayView ->
            bind(overlayView, overlayViewModel, windowManager.get())
            overlayView.visibility = View.INVISIBLE
        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() {
@@ -185,6 +179,25 @@ 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 ->
+1 −5
Original line number Diff line number Diff line
@@ -81,9 +81,7 @@ constructor(
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED or
                            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or
                            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
                    Utils.FINGERPRINT_OVERLAY_LAYOUT_PARAM_FLAGS,
                    PixelFormat.TRANSLUCENT
                )
                .apply {
@@ -93,8 +91,6 @@ 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> =
+0 −1
Original line number Diff line number Diff line
@@ -126,7 +126,6 @@ class SideFpsOverlayViewBinderTest : SysuiTestCase() {
        `when`(layoutInflater.inflate(R.layout.sidefps_view, null, false)).thenReturn(sideFpsView)
        `when`(sideFpsView.requireViewById<LottieAnimationView>(eq(R.id.sidefps_animation)))
            .thenReturn(mock(LottieAnimationView::class.java))
        `when`(sideFpsView.context).thenReturn(mContext)
        with(mock(ViewPropertyAnimator::class.java)) {
            `when`(sideFpsView.animate()).thenReturn(this)
            `when`(alpha(Mockito.anyFloat())).thenReturn(this)