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

Commit acfdabf2 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Fix AlternateBouncer touch handling" into udc-dev

parents f2c1506e a439c288
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -823,7 +823,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks,

            final Rect overlayBounds = new Rect(
                    0, /* left */
                    mCachedDisplayInfo.getNaturalHeight() / 2, /* top */
                    0, /* top */
                    mCachedDisplayInfo.getNaturalWidth(), /* right */
                    mCachedDisplayInfo.getNaturalHeight() /* botom */);

+0 −1
Original line number Diff line number Diff line
@@ -607,7 +607,6 @@ public class UdfpsController implements DozeReceiver, Dumpable {
            case UNCHANGED:
                if (!isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(),
                        true) && mActivePointerId == MotionEvent.INVALID_POINTER_ID
                        && event.getActionMasked() == MotionEvent.ACTION_DOWN
                        && mAlternateBouncerInteractor.isVisibleState()) {
                    // No pointer on sensor, forward to keyguard if alternateBouncer is visible
                    mKeyguardViewManager.onTouch(event);
+4 −4
Original line number Diff line number Diff line
@@ -37,12 +37,12 @@ class UdfpsOverlayInteractor
@Inject
constructor(private val authController: AuthController, @Application scope: CoroutineScope) {

    /** Whether a touch should be intercepted or allowed to pass to the UdfpsOverlay */
    fun canInterceptTouchInUdfpsBounds(ev: MotionEvent): Boolean {
    /** Whether a touch is within the under-display fingerprint sensor area */
    fun isTouchWithinUdfpsArea(ev: MotionEvent): Boolean {
        val isUdfpsEnrolled = authController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser())
        val isWithinUdfpsOverlayBounds =
        val isWithinOverlayBounds =
            udfpsOverlayParams.value.overlayBounds.contains(ev.rawX.toInt(), ev.rawY.toInt())
        return !isUdfpsEnrolled || !isWithinUdfpsOverlayBounds
        return isUdfpsEnrolled && isWithinOverlayBounds
    }

    /** Returns the current udfpsOverlayParams */
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ constructor(
    var legacyAlternateBouncer: LegacyAlternateBouncer? = null
    var legacyAlternateBouncerVisibleTime: Long = NOT_VISIBLE

    var receivedDownTouch = false
    val isVisible: Flow<Boolean> = bouncerRepository.alternateBouncerVisible

    /**
@@ -79,6 +80,7 @@ constructor(
     * @return true if the alternate bouncer was newly hidden, else false.
     */
    fun hide(): Boolean {
        receivedDownTouch = false
        return if (isModernAlternateBouncerEnabled) {
            val wasAlternateBouncerVisible = isVisibleState()
            bouncerRepository.setAlternateVisible(false)
+9 −15
Original line number Diff line number Diff line
@@ -37,14 +37,12 @@ import com.android.keyguard.AuthKeyguardMessageArea;
import com.android.keyguard.LockIconViewController;
import com.android.keyguard.dagger.KeyguardBouncerComponent;
import com.android.systemui.R;
import com.android.systemui.biometrics.domain.interactor.UdfpsOverlayInteractor;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.compose.ComposeFacade;
import com.android.systemui.dock.DockManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
import com.android.systemui.keyguard.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor;
import com.android.systemui.keyguard.shared.model.TransitionState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
@@ -94,8 +92,6 @@ public class NotificationShadeWindowViewController {
    private final AmbientState mAmbientState;
    private final PulsingGestureListener mPulsingGestureListener;
    private final NotificationInsetsController mNotificationInsetsController;
    private final AlternateBouncerInteractor mAlternateBouncerInteractor;
    private final UdfpsOverlayInteractor mUdfpsOverlayInteractor;
    private final boolean mIsTrackpadCommonEnabled;
    private GestureDetector mPulsingWakeupGestureHandler;
    private View mBrightnessMirror;
@@ -145,8 +141,6 @@ public class NotificationShadeWindowViewController {
            PulsingGestureListener pulsingGestureListener,
            KeyguardBouncerViewModel keyguardBouncerViewModel,
            KeyguardBouncerComponent.Factory keyguardBouncerComponentFactory,
            AlternateBouncerInteractor alternateBouncerInteractor,
            UdfpsOverlayInteractor udfpsOverlayInteractor,
            KeyguardTransitionInteractor keyguardTransitionInteractor,
            PrimaryBouncerToGoneTransitionViewModel primaryBouncerToGoneTransitionViewModel,
            FeatureFlags featureFlags,
@@ -170,8 +164,6 @@ public class NotificationShadeWindowViewController {
        mAmbientState = ambientState;
        mPulsingGestureListener = pulsingGestureListener;
        mNotificationInsetsController = notificationInsetsController;
        mAlternateBouncerInteractor = alternateBouncerInteractor;
        mUdfpsOverlayInteractor = udfpsOverlayInteractor;
        mIsTrackpadCommonEnabled = featureFlags.isEnabled(TRACKPAD_GESTURE_COMMON);

        // This view is not part of the newly inflated expanded status bar.
@@ -269,6 +261,9 @@ public class NotificationShadeWindowViewController {

                mFalsingCollector.onTouchEvent(ev);
                mPulsingWakeupGestureHandler.onTouchEvent(ev);
                if (mStatusBarKeyguardViewManager.dispatchTouchEvent(ev)) {
                    return true;
                }
                if (mBrightnessMirror != null
                        && mBrightnessMirror.getVisibility() == View.VISIBLE) {
                    // Disallow new pointers while the brightness mirror is visible. This is so that
@@ -343,9 +338,10 @@ public class NotificationShadeWindowViewController {
                    return true;
                }

                if (mAlternateBouncerInteractor.isVisibleState()) {
                    // If using UDFPS, don't intercept touches that are within its overlay bounds
                    return mUdfpsOverlayInteractor.canInterceptTouchInUdfpsBounds(ev);
                if (mStatusBarKeyguardViewManager.shouldInterceptTouchEvent(ev)) {
                    // Don't allow touches to proceed to underlying views if alternate
                    // bouncer is showing
                    return true;
                }

                if (mLockIconViewController.onInterceptTouchEvent(ev)) {
@@ -381,10 +377,8 @@ public class NotificationShadeWindowViewController {
                    handled = !mService.isPulsing();
                }

                if (mAlternateBouncerInteractor.isVisibleState()) {
                    // eat the touch
                    mStatusBarKeyguardViewManager.onTouch(ev);
                    handled = true;
                if (mStatusBarKeyguardViewManager.onTouch(ev)) {
                    return true;
                }

                if ((mDragDownHelper.isDragDownEnabled() && !handled)
Loading