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

Commit acfe9054 authored by Beverly's avatar Beverly Committed by Android Build Coastguard Worker
Browse files

On registerForDismissGestures coroutine completion, unregister for dismiss gestures

Else, the touch handlers will continue to be registered when they're
undesirable.

Flag: com.android.systemui.device_entry_udfps_refactor
Fixes: 341217019
Test: Enroll fingerprint on device that supports the alternate bouncer.
Double tap the power button to trigger the camera activity. Press an
affordance (gallery) to trigger the alternate bouncer. Tap on the screen
to get the primary bouncer. Navigate back gesture to the camera
activity. Observe that camera activity still works normally. Touches
are not intercepted.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:837e6ae420ff55aa1f11e81c70b2d7ebbbf76cf9)
Merged-In: I2bf9452009b2782fda343631b7fdb8c493758fa1
Change-Id: I2bf9452009b2782fda343631b7fdb8c493758fa1
parent 41aa421e
Loading
Loading
Loading
Loading
+21 −14
Original line number Original line Diff line number Diff line
@@ -190,8 +190,9 @@ constructor(
                launch("$TAG#viewModel.registerForDismissGestures") {
                launch("$TAG#viewModel.registerForDismissGestures") {
                        viewModel.registerForDismissGestures.collect { registerForDismissGestures ->
                        viewModel.registerForDismissGestures.collect { registerForDismissGestures ->
                            if (registerForDismissGestures) {
                            if (registerForDismissGestures) {
                            swipeUpAnywhereGestureHandler.addOnGestureDetectedCallback(swipeTag) { _
                                swipeUpAnywhereGestureHandler.addOnGestureDetectedCallback(
                                ->
                                    swipeTag
                                ) { _ ->
                                    alternateBouncerDependencies.powerInteractor.onUserTouch()
                                    alternateBouncerDependencies.powerInteractor.onUserTouch()
                                    viewModel.showPrimaryBouncer()
                                    viewModel.showPrimaryBouncer()
                                }
                                }
@@ -200,11 +201,17 @@ constructor(
                                    viewModel.showPrimaryBouncer()
                                    viewModel.showPrimaryBouncer()
                                }
                                }
                            } else {
                            } else {
                            swipeUpAnywhereGestureHandler.removeOnGestureDetectedCallback(swipeTag)
                                swipeUpAnywhereGestureHandler.removeOnGestureDetectedCallback(
                                    swipeTag
                                )
                                tapGestureDetector.removeOnGestureDetectedCallback(tapTag)
                                tapGestureDetector.removeOnGestureDetectedCallback(tapTag)
                            }
                            }
                        }
                        }
                    }
                    }
                    .invokeOnCompletion {
                        swipeUpAnywhereGestureHandler.removeOnGestureDetectedCallback(swipeTag)
                        tapGestureDetector.removeOnGestureDetectedCallback(tapTag)
                    }


                launch("$TAG#viewModel.scrimAlpha") {
                launch("$TAG#viewModel.scrimAlpha") {
                    viewModel.scrimAlpha.collect { scrim.viewAlpha = it }
                    viewModel.scrimAlpha.collect { scrim.viewAlpha = it }