diff options
author | 2025-02-06 09:30:55 -0800 | |
---|---|---|
committer | 2025-02-06 09:30:55 -0800 | |
commit | 157826ef3380ac52fd186fa11bb0d112fa7dccdc (patch) | |
tree | b58410f732b99cc3d96c38065c9f0fa8bb42cbfc | |
parent | a24b7e641063ab3af901ae3c473b4d0c7572d86a (diff) | |
parent | e451ad6230f3a975887bf81cda5e22284e52627a (diff) |
Merge "Rename LongPressHandlingView to TouchHandlingView" into main
17 files changed, 82 insertions, 87 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalLockSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalLockSection.kt index eab2b8717405..8c681e2a9ba8 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalLockSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/section/CommunalLockSection.kt @@ -38,7 +38,7 @@ import com.android.systemui.flags.Flags import com.android.systemui.keyguard.ui.composable.blueprint.BlueprintAlignmentLines import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.log.dagger.LongPressTouchLog import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R @@ -68,7 +68,7 @@ constructor( DeviceEntryIconView( context, null, - logger = LongPressHandlingViewLogger(logBuffer, tag = TAG), + logger = TouchHandlingViewLogger(logBuffer, tag = TAG), ) .apply { id = R.id.device_entry_icon_view diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt index 500527f4a508..69ac69d8a551 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/AlternateBouncer.kt @@ -55,7 +55,7 @@ import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerDependencies import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerMessageAreaViewModel import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerUdfpsIconViewModel -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.res.R @Composable @@ -156,7 +156,7 @@ private fun StatusMessage( @Composable private fun DeviceEntryIcon( viewModel: AlternateBouncerUdfpsIconViewModel, - logger: LongPressHandlingViewLogger, + logger: TouchHandlingViewLogger, modifier: Modifier = Modifier, ) { AndroidView( diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt index 4795e7cef87c..0db2bb51c971 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/LockSection.kt @@ -42,7 +42,7 @@ import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryBackgroundViewModel import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryForegroundViewModel import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.log.dagger.LongPressTouchLog import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R @@ -74,7 +74,7 @@ constructor( DeviceEntryIconView( context, null, - logger = LongPressHandlingViewLogger(logBuffer, tag = TAG), + logger = TouchHandlingViewLogger(logBuffer, tag = TAG), ) .apply { id = R.id.device_entry_icon_view diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/TouchHandlingViewInteractionHandlerTest.kt index 30da8d8d47ad..0f400892f988 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/TouchHandlingViewInteractionHandlerTest.kt @@ -21,10 +21,10 @@ import android.view.ViewConfiguration import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import com.android.systemui.common.ui.view.LongPressHandlingViewInteractionHandler.MotionEventModel -import com.android.systemui.common.ui.view.LongPressHandlingViewInteractionHandler.MotionEventModel.Down -import com.android.systemui.common.ui.view.LongPressHandlingViewInteractionHandler.MotionEventModel.Move -import com.android.systemui.common.ui.view.LongPressHandlingViewInteractionHandler.MotionEventModel.Up +import com.android.systemui.common.ui.view.TouchHandlingViewInteractionHandler.MotionEventModel +import com.android.systemui.common.ui.view.TouchHandlingViewInteractionHandler.MotionEventModel.Down +import com.android.systemui.common.ui.view.TouchHandlingViewInteractionHandler.MotionEventModel.Move +import com.android.systemui.common.ui.view.TouchHandlingViewInteractionHandler.MotionEventModel.Up import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat @@ -40,13 +40,13 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(AndroidJUnit4::class) -class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { +class TouchHandlingViewInteractionHandlerTest : SysuiTestCase() { @Mock private lateinit var postDelayed: (Runnable, Long) -> DisposableHandle @Mock private lateinit var onLongPressDetected: (Int, Int) -> Unit @Mock private lateinit var onSingleTapDetected: (Int, Int) -> Unit - private lateinit var underTest: LongPressHandlingViewInteractionHandler + private lateinit var underTest: TouchHandlingViewInteractionHandler private var isAttachedToWindow: Boolean = true private var delayedRunnable: Runnable? = null @@ -60,7 +60,7 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { } underTest = - LongPressHandlingViewInteractionHandler( + TouchHandlingViewInteractionHandler( postDelayed = postDelayed, isAttachedToWindow = { isAttachedToWindow }, onLongPressDetected = onLongPressDetected, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 2dce4aa01d24..79fc999e1b50 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -70,7 +70,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor; import com.android.systemui.classifier.FalsingCollectorFake; import com.android.systemui.classifier.FalsingManagerFake; -import com.android.systemui.common.ui.view.LongPressHandlingView; +import com.android.systemui.common.ui.view.TouchHandlingView; import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor; import com.android.systemui.deviceentry.domain.interactor.DeviceEntryUdfpsInteractor; import com.android.systemui.doze.DozeLog; @@ -518,12 +518,12 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mMainHandler = new Handler(Looper.getMainLooper()); - LongPressHandlingView longPressHandlingView = mock(LongPressHandlingView.class); + TouchHandlingView touchHandlingView = mock(TouchHandlingView.class); when(mView.requireViewById(R.id.keyguard_long_press)) - .thenReturn(longPressHandlingView); + .thenReturn(touchHandlingView); Resources longPressHandlingViewRes = mock(Resources.class); - when(longPressHandlingView.getResources()).thenReturn(longPressHandlingViewRes); + when(touchHandlingView.getResources()).thenReturn(longPressHandlingViewRes); when(longPressHandlingViewRes.getString(anyInt())).thenReturn(""); mNotificationPanelViewController = new NotificationPanelViewController( diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index b106ad55fb3c..97c53e742f57 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -26,7 +26,7 @@ android:layout_height="match_parent" android:background="@android:color/transparent"> - <com.android.systemui.common.ui.view.LongPressHandlingView + <com.android.systemui.common.ui.view.TouchHandlingView android:id="@+id/keyguard_long_press" android:layout_width="match_parent" android:layout_height="match_parent" /> diff --git a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt b/packages/SystemUI/src/com/android/systemui/common/ui/view/TouchHandlingView.kt index dbe3dd09cb13..42f1b738ec20 100644 --- a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingView.kt +++ b/packages/SystemUI/src/com/android/systemui/common/ui/view/TouchHandlingView.kt @@ -27,7 +27,7 @@ import android.view.ViewConfiguration import android.view.accessibility.AccessibilityNodeInfo import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction import androidx.core.view.accessibility.AccessibilityNodeInfoCompat -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.shade.TouchLogger import kotlin.math.pow import kotlin.math.sqrt @@ -39,12 +39,12 @@ import kotlinx.coroutines.DisposableHandle * The view will not handle any long pressed by default. To set it up, set up a listener and, when * ready to start consuming long-presses, set [setLongPressHandlingEnabled] to `true`. */ -class LongPressHandlingView( +class TouchHandlingView( context: Context, attrs: AttributeSet?, longPressDuration: () -> Long, allowedTouchSlop: Int = ViewConfiguration.getTouchSlop(), - logger: LongPressHandlingViewLogger? = null, + logger: TouchHandlingViewLogger? = null, ) : View(context, attrs) { init { @@ -68,8 +68,8 @@ class LongPressHandlingView( var accessibilityHintLongPressAction: AccessibilityAction? = null - private val interactionHandler: LongPressHandlingViewInteractionHandler by lazy { - LongPressHandlingViewInteractionHandler( + private val interactionHandler: TouchHandlingViewInteractionHandler by lazy { + TouchHandlingViewInteractionHandler( postDelayed = { block, timeoutMs -> val dispatchToken = Any() @@ -82,7 +82,7 @@ class LongPressHandlingView( listener?.onLongPressDetected(view = this, x = x, y = y) }, onSingleTapDetected = { x, y -> - listener?.onSingleTapDetected(this@LongPressHandlingView, x = x, y = y) + listener?.onSingleTapDetected(this@TouchHandlingView, x = x, y = y) }, longPressDuration = longPressDuration, allowedTouchSlop = allowedTouchSlop, @@ -134,11 +134,11 @@ class LongPressHandlingView( interactionHandler.isLongPressHandlingEnabled && action == AccessibilityNodeInfoCompat.ACTION_LONG_CLICK ) { - val longPressHandlingView = host as? LongPressHandlingView - if (longPressHandlingView != null) { + val touchHandlingView = host as? TouchHandlingView + if (touchHandlingView != null) { // the coordinates are not available as it is an a11y long press listener?.onLongPressDetected( - view = longPressHandlingView, + view = touchHandlingView, x = 0, y = 0, isA11yAction = true, @@ -155,24 +155,21 @@ class LongPressHandlingView( } } -private fun MotionEvent.toModel(): LongPressHandlingViewInteractionHandler.MotionEventModel { +private fun MotionEvent.toModel(): TouchHandlingViewInteractionHandler.MotionEventModel { return when (actionMasked) { MotionEvent.ACTION_DOWN -> - LongPressHandlingViewInteractionHandler.MotionEventModel.Down( - x = x.toInt(), - y = y.toInt(), - ) + TouchHandlingViewInteractionHandler.MotionEventModel.Down(x = x.toInt(), y = y.toInt()) MotionEvent.ACTION_MOVE -> - LongPressHandlingViewInteractionHandler.MotionEventModel.Move( + TouchHandlingViewInteractionHandler.MotionEventModel.Move( distanceMoved = distanceMoved() ) MotionEvent.ACTION_UP -> - LongPressHandlingViewInteractionHandler.MotionEventModel.Up( + TouchHandlingViewInteractionHandler.MotionEventModel.Up( distanceMoved = distanceMoved(), gestureDuration = gestureDuration(), ) - MotionEvent.ACTION_CANCEL -> LongPressHandlingViewInteractionHandler.MotionEventModel.Cancel - else -> LongPressHandlingViewInteractionHandler.MotionEventModel.Other + MotionEvent.ACTION_CANCEL -> TouchHandlingViewInteractionHandler.MotionEventModel.Cancel + else -> TouchHandlingViewInteractionHandler.MotionEventModel.Other } } diff --git a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandler.kt b/packages/SystemUI/src/com/android/systemui/common/ui/view/TouchHandlingViewInteractionHandler.kt index a5d45aff4dc7..5863fc644c8e 100644 --- a/packages/SystemUI/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandler.kt +++ b/packages/SystemUI/src/com/android/systemui/common/ui/view/TouchHandlingViewInteractionHandler.kt @@ -18,11 +18,11 @@ package com.android.systemui.common.ui.view import android.graphics.Point -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import kotlinx.coroutines.DisposableHandle -/** Encapsulates logic to handle complex touch interactions with a [LongPressHandlingView]. */ -class LongPressHandlingViewInteractionHandler( +/** Encapsulates logic to handle complex touch interactions with a [TouchHandlingView]. */ +class TouchHandlingViewInteractionHandler( /** * Callback to run the given [Runnable] with the given delay, returning a [DisposableHandle] * allowing the delayed runnable to be canceled before it is run. @@ -43,7 +43,7 @@ class LongPressHandlingViewInteractionHandler( */ val allowedTouchSlop: Int, /** Optional logger that can be passed in to log touch events */ - val logger: LongPressHandlingViewLogger? = null, + val logger: TouchHandlingViewLogger? = null, ) { sealed class MotionEventModel { object Other : MotionEventModel() diff --git a/packages/SystemUI/src/com/android/systemui/communal/ui/binder/CommunalLockIconViewBinder.kt b/packages/SystemUI/src/com/android/systemui/communal/ui/binder/CommunalLockIconViewBinder.kt index b1407da78816..1699911c6d8f 100644 --- a/packages/SystemUI/src/com/android/systemui/communal/ui/binder/CommunalLockIconViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/communal/ui/binder/CommunalLockIconViewBinder.kt @@ -27,7 +27,7 @@ import androidx.core.view.isInvisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch -import com.android.systemui.common.ui.view.LongPressHandlingView +import com.android.systemui.common.ui.view.TouchHandlingView import com.android.systemui.communal.ui.viewmodel.CommunalLockIconViewModel import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.lifecycle.repeatWhenAttached @@ -57,11 +57,11 @@ object CommunalLockIconViewBinder { vibratorHelper: VibratorHelper, ): DisposableHandle { val disposables = DisposableHandles() - val longPressHandlingView = view.longPressHandlingView + val touchHandlingView = view.touchHandlingView val fgIconView = view.iconView val bgView = view.bgView - longPressHandlingView.listener = - object : LongPressHandlingView.Listener { + touchHandlingView.listener = + object : TouchHandlingView.Listener { override fun onLongPressDetected( view: View, x: Int, @@ -87,9 +87,9 @@ object CommunalLockIconViewBinder { } } - longPressHandlingView.isInvisible = false + touchHandlingView.isInvisible = false view.isClickable = true - longPressHandlingView.longPressDuration = { + touchHandlingView.longPressDuration = { view.resources.getInteger(R.integer.config_lockIconLongPress).toLong() } bgView.visibility = View.GONE @@ -99,7 +99,7 @@ object CommunalLockIconViewBinder { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.isLongPressEnabled") { viewModel.isLongPressEnabled.collect { isEnabled -> - longPressHandlingView.setLongPressHandlingEnabled(isEnabled) + touchHandlingView.setLongPressHandlingEnabled(isEnabled) } } launch("$TAG#viewModel.accessibilityDelegateHint") { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/AlternateBouncerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/AlternateBouncerViewBinder.kt index fa64fc07aad9..b8b032719ef8 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/AlternateBouncerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/AlternateBouncerViewBinder.kt @@ -40,7 +40,7 @@ import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerDependencies import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerUdfpsIconViewModel import com.android.systemui.keyguard.ui.viewmodel.AlternateBouncerWindowViewModel import com.android.systemui.lifecycle.repeatWhenAttached -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.res.R import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scrim.ScrimView @@ -219,7 +219,7 @@ constructor( private fun optionallyAddUdfpsViews( view: ConstraintLayout, - logger: LongPressHandlingViewLogger, + logger: TouchHandlingViewLogger, udfpsIconViewModel: AlternateBouncerUdfpsIconViewModel, udfpsA11yOverlayViewModel: Lazy<AlternateBouncerUdfpsAccessibilityOverlayViewModel>, ) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt index e9a3bd62b9b3..17e14c3e83da 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt @@ -29,7 +29,7 @@ import androidx.core.view.isInvisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch -import com.android.systemui.common.ui.view.LongPressHandlingView +import com.android.systemui.common.ui.view.TouchHandlingView import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryBackgroundViewModel import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryForegroundViewModel @@ -41,7 +41,6 @@ import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.util.kotlin.DisposableHandles import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.DisposableHandle -import com.android.app.tracing.coroutines.launchTraced as launch object DeviceEntryIconViewBinder { private const val TAG = "DeviceEntryIconViewBinder" @@ -66,11 +65,11 @@ object DeviceEntryIconViewBinder { overrideColor: Color? = null, ): DisposableHandle { val disposables = DisposableHandles() - val longPressHandlingView = view.longPressHandlingView + val touchHandlingView = view.touchHandlingView val fgIconView = view.iconView val bgView = view.bgView - longPressHandlingView.listener = - object : LongPressHandlingView.Listener { + touchHandlingView.listener = + object : TouchHandlingView.Listener { override fun onLongPressDetected( view: View, x: Int, @@ -104,18 +103,18 @@ object DeviceEntryIconViewBinder { repeatOnLifecycle(Lifecycle.State.CREATED) { launch("$TAG#viewModel.isVisible") { viewModel.isVisible.collect { isVisible -> - longPressHandlingView.isInvisible = !isVisible + touchHandlingView.isInvisible = !isVisible view.isClickable = isVisible } } launch("$TAG#viewModel.isLongPressEnabled") { viewModel.isLongPressEnabled.collect { isEnabled -> - longPressHandlingView.setLongPressHandlingEnabled(isEnabled) + touchHandlingView.setLongPressHandlingEnabled(isEnabled) } } launch("$TAG#viewModel.isUdfpsSupported") { viewModel.isUdfpsSupported.collect { udfpsSupported -> - longPressHandlingView.longPressDuration = + touchHandlingView.longPressDuration = if (udfpsSupported) { { view.resources diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardTouchViewBinder.kt index f0e5e16b092b..195413a80f4b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardTouchViewBinder.kt @@ -23,13 +23,13 @@ import androidx.core.view.accessibility.AccessibilityNodeInfoCompat import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launchTraced as launch -import com.android.systemui.common.ui.view.LongPressHandlingView +import com.android.systemui.common.ui.view.TouchHandlingView import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.FalsingManager import com.android.systemui.res.R -object KeyguardLongPressViewBinder { +object KeyguardTouchViewBinder { /** * Drives UI for the lock screen long-press feature. * @@ -41,7 +41,7 @@ object KeyguardLongPressViewBinder { */ @JvmStatic fun bind( - view: LongPressHandlingView, + view: TouchHandlingView, viewModel: KeyguardTouchHandlingViewModel, onSingleTap: (x: Int, y: Int) -> Unit, falsingManager: FalsingManager, @@ -52,7 +52,7 @@ object KeyguardLongPressViewBinder { view.resources.getString(R.string.lock_screen_settings), ) view.listener = - object : LongPressHandlingView.Listener { + object : TouchHandlingView.Listener { override fun onLongPressDetected( view: View, x: Int, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt index 8d2e939da032..13331a4da3f7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt @@ -31,8 +31,8 @@ import android.widget.ImageView import androidx.core.view.accessibility.AccessibilityNodeInfoCompat import com.airbnb.lottie.LottieCompositionFactory import com.airbnb.lottie.LottieDrawable -import com.android.systemui.common.ui.view.LongPressHandlingView -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.common.ui.view.TouchHandlingView +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.res.R class DeviceEntryIconView @@ -41,11 +41,11 @@ constructor( context: Context, attrs: AttributeSet?, defStyleAttrs: Int = 0, - logger: LongPressHandlingViewLogger? = null, + logger: TouchHandlingViewLogger? = null, ) : FrameLayout(context, attrs, defStyleAttrs) { - val longPressHandlingView: LongPressHandlingView = - LongPressHandlingView( + val touchHandlingView: TouchHandlingView = + TouchHandlingView( context = context, attrs = attrs, longPressDuration = { ViewConfiguration.getLongPressTimeout().toLong() }, @@ -68,7 +68,7 @@ constructor( // bgView, iconView, longpressHandlingView overlay addBgImageView() addIconImageView() - addLongpressHandlingView() + addTouchHandlingView() } private fun setupAccessibilityDelegate() { @@ -77,17 +77,17 @@ constructor( private val accessibilityBouncerHint = AccessibilityNodeInfo.AccessibilityAction( AccessibilityNodeInfoCompat.ACTION_CLICK, - resources.getString(R.string.accessibility_bouncer) + resources.getString(R.string.accessibility_bouncer), ) private val accessibilityEnterHint = AccessibilityNodeInfo.AccessibilityAction( AccessibilityNodeInfoCompat.ACTION_CLICK, - resources.getString(R.string.accessibility_enter_hint) + resources.getString(R.string.accessibility_enter_hint), ) override fun onInitializeAccessibilityNodeInfo( v: View, - info: AccessibilityNodeInfo + info: AccessibilityNodeInfo, ) { super.onInitializeAccessibilityNodeInfo(v, info) when (accessibilityHintType) { @@ -232,12 +232,12 @@ constructor( ) } - private fun addLongpressHandlingView() { - addView(longPressHandlingView) - val lp = longPressHandlingView.layoutParams as LayoutParams + private fun addTouchHandlingView() { + addView(touchHandlingView) + val lp = touchHandlingView.layoutParams as LayoutParams lp.height = ViewGroup.LayoutParams.MATCH_PARENT lp.width = ViewGroup.LayoutParams.MATCH_PARENT - longPressHandlingView.layoutParams = lp + touchHandlingView.layoutParams = lp } private fun addIconImageView() { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt index 0c7e865a84a4..58d482b8a66f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultDeviceEntrySection.kt @@ -37,7 +37,7 @@ import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryBackgroundViewModel import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryForegroundViewModel import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.log.core.Logger import com.android.systemui.log.dagger.KeyguardBlueprintLog import com.android.systemui.log.dagger.LongPressTouchLog @@ -78,7 +78,7 @@ constructor( DeviceEntryIconView( context, null, - logger = LongPressHandlingViewLogger(logBuffer = logBuffer, TAG), + logger = TouchHandlingViewLogger(logBuffer = logBuffer, TAG), ) .apply { id = deviceEntryIconViewId } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerDependencies.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerDependencies.kt index 848bcabb7767..29ee52482885 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerDependencies.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/AlternateBouncerDependencies.kt @@ -19,7 +19,7 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.deviceentry.ui.viewmodel.AlternateBouncerUdfpsAccessibilityOverlayViewModel import com.android.systemui.keyguard.ui.SwipeUpAnywhereGestureHandler import com.android.systemui.log.LogBuffer -import com.android.systemui.log.LongPressHandlingViewLogger +import com.android.systemui.log.TouchHandlingViewLogger import com.android.systemui.log.dagger.LongPressTouchLog import com.android.systemui.power.domain.interactor.PowerInteractor import com.android.systemui.statusbar.gesture.TapGestureDetector @@ -40,8 +40,8 @@ constructor( val powerInteractor: PowerInteractor, @LongPressTouchLog private val touchLogBuffer: LogBuffer, ) { - val logger: LongPressHandlingViewLogger = - LongPressHandlingViewLogger(logBuffer = touchLogBuffer, TAG) + val logger: TouchHandlingViewLogger = TouchHandlingViewLogger(logBuffer = touchLogBuffer, TAG) + companion object { private const val TAG = "AlternateBouncer" } diff --git a/packages/SystemUI/src/com/android/systemui/log/LongPressHandlingViewLogger.kt b/packages/SystemUI/src/com/android/systemui/log/TouchHandlingViewLogger.kt index 4ff81184d045..90c063e195eb 100644 --- a/packages/SystemUI/src/com/android/systemui/log/LongPressHandlingViewLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/log/TouchHandlingViewLogger.kt @@ -19,17 +19,17 @@ package com.android.systemui.log import com.android.systemui.log.core.LogLevel.DEBUG import com.google.errorprone.annotations.CompileTimeConstant -data class LongPressHandlingViewLogger +data class TouchHandlingViewLogger constructor( private val logBuffer: LogBuffer, - @CompileTimeConstant private val tag: String = "LongPressHandlingViewLogger" + @CompileTimeConstant private val tag: String = "TouchHandlingViewLogger", ) { fun schedulingLongPress(delay: Long) { logBuffer.log( tag, DEBUG, { long1 = delay }, - { "on MotionEvent.Down: scheduling long press activation after $long1 ms" } + { "on MotionEvent.Down: scheduling long press activation after $long1 ms" }, ) } @@ -58,7 +58,7 @@ constructor( "on MotionEvent.Up: distanceMoved: $double1, " + "allowedTouchSlop: $int1, " + "eventDuration: $long1" - } + }, ) } @@ -74,7 +74,7 @@ constructor( "on MotionEvent.Motion: May cancel long press due to movement: " + "distanceMoved: $double1, " + "allowedTouchSlop: $int1 " - } + }, ) } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 7b014dabfd61..c50c3dc07616 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -109,7 +109,7 @@ import com.android.systemui.keyguard.shared.model.ClockSize; import com.android.systemui.keyguard.shared.model.Edge; import com.android.systemui.keyguard.shared.model.TransitionState; import com.android.systemui.keyguard.shared.model.TransitionStep; -import com.android.systemui.keyguard.ui.binder.KeyguardLongPressViewBinder; +import com.android.systemui.keyguard.ui.binder.KeyguardTouchViewBinder; import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel; import com.android.systemui.media.controls.domain.pipeline.MediaDataManager; @@ -752,8 +752,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mKeyguardClockInteractor = keyguardClockInteractor; mWallpaperFocalAreaViewModel = wallpaperFocalAreaViewModel; - - KeyguardLongPressViewBinder.bind( + KeyguardTouchViewBinder.bind( mView.requireViewById(R.id.keyguard_long_press), keyguardTouchHandlingViewModel, (x, y) -> { |