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

Commit a13fe06a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Play device entry haptics from the mainImmediateDispatcher" into main

parents da35c607 47f371c6
Loading
Loading
Loading
Loading
+34 −34
Original line number Diff line number Diff line
@@ -147,6 +147,40 @@ object KeyguardRootViewBinder {
        disposables +=
            view.repeatWhenAttached(mainImmediateDispatcher) {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
                    if (deviceEntryHapticsInteractor != null && vibratorHelper != null) {
                        launch {
                            deviceEntryHapticsInteractor.playSuccessHapticOnDeviceEntry.collect {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.UNLOCK,
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.BIOMETRIC_CONFIRM,
                                    )
                                }
                            }
                        }

                        launch {
                            deviceEntryHapticsInteractor.playErrorHaptic.collect {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.FAILURE,
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.BIOMETRIC_REJECT,
                                    )
                                }
                            }
                        }
                    }

                    launch("$TAG#topClippingBounds") {
                        val clipBounds = Rect()
                        viewModel.topClippingBounds.collect { clipTop ->
@@ -318,40 +352,6 @@ object KeyguardRootViewBinder {

                    launch { burnInParams.collect { viewModel.updateBurnInParams(it) } }

                    if (deviceEntryHapticsInteractor != null && vibratorHelper != null) {
                        launch {
                            deviceEntryHapticsInteractor.playSuccessHapticOnDeviceEntry.collect {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.UNLOCK,
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.BIOMETRIC_CONFIRM,
                                    )
                                }
                            }
                        }

                        launch {
                            deviceEntryHapticsInteractor.playErrorHaptic.collect {
                                if (msdlFeedback()) {
                                    msdlPlayer?.playToken(
                                        MSDLToken.FAILURE,
                                        authInteractionProperties,
                                    )
                                } else {
                                    vibratorHelper.performHapticFeedback(
                                        view,
                                        HapticFeedbackConstants.BIOMETRIC_REJECT,
                                    )
                                }
                            }
                        }
                    }

                    launch {
                        wallpaperFocalAreaViewModel.wallpaperFocalAreaBounds.collect {
                            wallpaperFocalAreaViewModel.setFocalAreaBounds(it)