Merge "When quick affordance enabled and device screen turns on or off, vibration always happens" into tm-qpr-dev am: 7d8b12a206
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20919322 Change-Id: I85fa95882a13ecbbae4d723ff112f125f0470a4a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -45,7 +45,6 @@ import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewMod
|
||||
import com.android.systemui.lifecycle.repeatWhenAttached
|
||||
import com.android.systemui.plugins.FalsingManager
|
||||
import com.android.systemui.statusbar.VibratorHelper
|
||||
import com.android.systemui.util.kotlin.pairwise
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.sqrt
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
@@ -128,18 +127,6 @@ object KeyguardBottomAreaViewBinder {
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.startButton
|
||||
.map { it.isActivated }
|
||||
.pairwise()
|
||||
.collect { (prev, next) ->
|
||||
when {
|
||||
!prev && next -> vibratorHelper?.vibrate(Vibrations.Activated)
|
||||
prev && !next -> vibratorHelper?.vibrate(Vibrations.Deactivated)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.endButton.collect { buttonModel ->
|
||||
updateButton(
|
||||
@@ -152,18 +139,6 @@ object KeyguardBottomAreaViewBinder {
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.endButton
|
||||
.map { it.isActivated }
|
||||
.pairwise()
|
||||
.collect { (prev, next) ->
|
||||
when {
|
||||
!prev && next -> vibratorHelper?.vibrate(Vibrations.Activated)
|
||||
prev && !next -> vibratorHelper?.vibrate(Vibrations.Deactivated)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.isOverlayContainerVisible.collect { isVisible ->
|
||||
overlayContainer.visibility =
|
||||
@@ -383,6 +358,13 @@ object KeyguardBottomAreaViewBinder {
|
||||
.setDuration(longPressDurationMs)
|
||||
.withEndAction {
|
||||
view.setOnClickListener {
|
||||
vibratorHelper?.vibrate(
|
||||
if (viewModel.isActivated) {
|
||||
Vibrations.Activated
|
||||
} else {
|
||||
Vibrations.Deactivated
|
||||
}
|
||||
)
|
||||
viewModel.onClicked(
|
||||
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
||||
configKey = viewModel.configKey,
|
||||
|
||||
Reference in New Issue
Block a user