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

Commit 7f5272e6 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

setHandleTouch in UdfpsTouchOverlayBinder

Some devices rely on setHandleTouch while others rely on SystemUI's
touch overlay.

Flag: ACONFIG com.android.systemui.device_entry_udfps_refactor DEVELOPMENT
Bug: 323018891
Test: manual
Change-Id: I61b6fe561609368148d47e2af43c43bea96e1cbf
parent 14f93277
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -198,11 +198,13 @@ class UdfpsControllerOverlay @JvmOverloads constructor(
                                UdfpsTouchOverlayBinder.bind(
                                    view = this,
                                    viewModel = deviceEntryUdfpsTouchOverlayViewModel.get(),
                                    udfpsOverlayInteractor = udfpsOverlayInteractor,
                                )
                            else ->
                                UdfpsTouchOverlayBinder.bind(
                                    view = this,
                                    viewModel = defaultUdfpsTouchOverlayViewModel.get(),
                                    udfpsOverlayInteractor = udfpsOverlayInteractor,
                                )
                        }
                    }
+10 −1
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package com.android.systemui.biometrics.ui.binder

import android.util.Log
import androidx.core.view.isInvisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor
import com.android.systemui.biometrics.ui.view.UdfpsTouchOverlay
import com.android.systemui.biometrics.ui.viewmodel.UdfpsTouchOverlayViewModel
import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor
@@ -31,19 +33,26 @@ object UdfpsTouchOverlayBinder {

    /**
     * Updates visibility for the UdfpsTouchOverlay which controls whether the view will receive
     * touches or not.
     * touches or not. For some devices, this is instead handled by UdfpsOverlayInteractor, so this
     * viewBinder will send the information to the interactor.
     */
    @JvmStatic
    fun bind(
        view: UdfpsTouchOverlay,
        viewModel: UdfpsTouchOverlayViewModel,
        udfpsOverlayInteractor: UdfpsOverlayInteractor,
    ) {
        if (DeviceEntryUdfpsRefactor.isUnexpectedlyInLegacyMode()) return
        view.repeatWhenAttached {
            repeatOnLifecycle(Lifecycle.State.CREATED) {
                launch {
                    viewModel.shouldHandleTouches.collect { shouldHandleTouches ->
                        Log.d(
                            "UdfpsTouchOverlayBinder",
                            "[$view]: update shouldHandleTouches=$shouldHandleTouches"
                        )
                        view.isInvisible = !shouldHandleTouches
                        udfpsOverlayInteractor.setHandleTouches(shouldHandleTouches)
                    }
                }
            }