Loading packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +0 −13 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.haptics.qs import android.animation.ValueAnimator import android.os.VibrationEffect import android.view.View import android.view.ViewConfiguration import android.view.animation.AccelerateDecelerateInterpolator import androidx.annotation.VisibleForTesting import androidx.core.animation.doOnCancel Loading @@ -32,7 +31,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map /** * A class that handles the long press visuo-haptic effect for a QS tile. Loading Loading @@ -76,9 +74,6 @@ constructor( } } // Should a tap timeout countdown begin val shouldWaitForTapTimeout: Flow<Boolean> = state.map { it == State.TIMEOUT_WAIT } /** Haptic effects */ private val durations = vibratorHelper?.getPrimitiveDurations( Loading Loading @@ -247,12 +242,4 @@ constructor( LONG_PRESS, RESET_AND_LONG_PRESS, } companion object { /** * A timeout to let the tile resolve if it is being swiped/scrolled. Since QS tiles are * inside a scrollable container, they will be considered pressed only after a tap timeout. */ val PRESSED_TIMEOUT = ViewConfiguration.getTapTimeout().toLong() + 20L } } packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffectViewBinder.kt +8 −18 Original line number Diff line number Diff line Loading @@ -18,15 +18,13 @@ package com.android.systemui.haptics.qs import android.annotation.SuppressLint import android.view.MotionEvent import android.view.ViewConfiguration import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launch import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.qs.tileimpl.QSTileViewImpl import kotlinx.coroutines.CancellationException import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.delay import kotlinx.coroutines.flow.filter object QSLongPressEffectViewBinder { Loading Loading @@ -71,20 +69,6 @@ object QSLongPressEffectViewBinder { } } } // Tap timeout wait launch({ "${tileSpec ?: "unknownTileSpec"}#LongPressEffect#timeout" }) { qsLongPressEffect.shouldWaitForTapTimeout .filter { it } .collect { try { delay(QSLongPressEffect.PRESSED_TIMEOUT) qsLongPressEffect.handleTimeoutComplete() } catch (_: CancellationException) { qsLongPressEffect.resetEffect() } } } } } } Loading @@ -93,7 +77,13 @@ object QSLongPressEffectViewBinder { private fun setTouchListener(tile: QSTileViewImpl, longPressEffect: QSLongPressEffect?) { tile.setOnTouchListener { _, event -> when (event.actionMasked) { MotionEvent.ACTION_DOWN -> longPressEffect?.handleActionDown() MotionEvent.ACTION_DOWN -> { tile.postDelayed( { longPressEffect?.handleTimeoutComplete() }, ViewConfiguration.getTapTimeout().toLong(), ) longPressEffect?.handleActionDown() } MotionEvent.ACTION_UP -> longPressEffect?.handleActionUp() MotionEvent.ACTION_CANCEL -> longPressEffect?.handleActionCancel() } Loading Loading
packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +0 −13 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.haptics.qs import android.animation.ValueAnimator import android.os.VibrationEffect import android.view.View import android.view.ViewConfiguration import android.view.animation.AccelerateDecelerateInterpolator import androidx.annotation.VisibleForTesting import androidx.core.animation.doOnCancel Loading @@ -32,7 +31,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map /** * A class that handles the long press visuo-haptic effect for a QS tile. Loading Loading @@ -76,9 +74,6 @@ constructor( } } // Should a tap timeout countdown begin val shouldWaitForTapTimeout: Flow<Boolean> = state.map { it == State.TIMEOUT_WAIT } /** Haptic effects */ private val durations = vibratorHelper?.getPrimitiveDurations( Loading Loading @@ -247,12 +242,4 @@ constructor( LONG_PRESS, RESET_AND_LONG_PRESS, } companion object { /** * A timeout to let the tile resolve if it is being swiped/scrolled. Since QS tiles are * inside a scrollable container, they will be considered pressed only after a tap timeout. */ val PRESSED_TIMEOUT = ViewConfiguration.getTapTimeout().toLong() + 20L } }
packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffectViewBinder.kt +8 −18 Original line number Diff line number Diff line Loading @@ -18,15 +18,13 @@ package com.android.systemui.haptics.qs import android.annotation.SuppressLint import android.view.MotionEvent import android.view.ViewConfiguration import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launch import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.qs.tileimpl.QSTileViewImpl import kotlinx.coroutines.CancellationException import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.delay import kotlinx.coroutines.flow.filter object QSLongPressEffectViewBinder { Loading Loading @@ -71,20 +69,6 @@ object QSLongPressEffectViewBinder { } } } // Tap timeout wait launch({ "${tileSpec ?: "unknownTileSpec"}#LongPressEffect#timeout" }) { qsLongPressEffect.shouldWaitForTapTimeout .filter { it } .collect { try { delay(QSLongPressEffect.PRESSED_TIMEOUT) qsLongPressEffect.handleTimeoutComplete() } catch (_: CancellationException) { qsLongPressEffect.resetEffect() } } } } } } Loading @@ -93,7 +77,13 @@ object QSLongPressEffectViewBinder { private fun setTouchListener(tile: QSTileViewImpl, longPressEffect: QSLongPressEffect?) { tile.setOnTouchListener { _, event -> when (event.actionMasked) { MotionEvent.ACTION_DOWN -> longPressEffect?.handleActionDown() MotionEvent.ACTION_DOWN -> { tile.postDelayed( { longPressEffect?.handleTimeoutComplete() }, ViewConfiguration.getTapTimeout().toLong(), ) longPressEffect?.handleActionDown() } MotionEvent.ACTION_UP -> longPressEffect?.handleActionUp() MotionEvent.ACTION_CANCEL -> longPressEffect?.handleActionCancel() } Loading