Loading core/java/android/app/WallpaperManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,16 @@ public class WallpaperManager { public static final String COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed"; /** * Command for {@link #sendWallpaperCommand}: Include the tap position within the wallpaper * focal area.The x and y arguments are the absolute tap coordinates, already scaled to match * the wallpaper's dimensions. * * @hide */ public static final String COMMAND_LOCKSCREEN_TAP = "android.wallpaper.lockscreen_tap"; /** * Extra passed back from setWallpaper() giving the new wallpaper's assigned ID. * @hide Loading packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt +14 −39 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { @Mock private lateinit var postDelayed: (Runnable, Long) -> DisposableHandle @Mock private lateinit var onLongPressDetected: (Int, Int) -> Unit @Mock private lateinit var onSingleTapDetected: () -> Unit @Mock private lateinit var onSingleTapDetected: (Int, Int) -> Unit private lateinit var underTest: LongPressHandlingViewInteractionHandler Loading Loading @@ -76,74 +76,51 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { val downX = 123 val downY = 456 dispatchTouchEvents( Down( x = downX, y = downY, ), Move( distanceMoved = ViewConfiguration.getTouchSlop() - 0.1f, ), Down(x = downX, y = downY), Move(distanceMoved = ViewConfiguration.getTouchSlop() - 0.1f), ) delayedRunnable?.run() verify(onLongPressDetected).invoke(downX, downY) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun longPressButFeatureNotEnabled() = runTest { underTest.isLongPressHandlingEnabled = false dispatchTouchEvents( Down( x = 123, y = 456, ), ) dispatchTouchEvents(Down(x = 123, y = 456)) assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun longPressButViewNotAttached() = runTest { isAttachedToWindow = false dispatchTouchEvents( Down( x = 123, y = 456, ), ) dispatchTouchEvents(Down(x = 123, y = 456)) delayedRunnable?.run() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun draggedTooFarToBeConsideredAlongPress() = runTest { dispatchTouchEvents( Down( x = 123, y = 456, ), Move( distanceMoved = ViewConfiguration.getTouchSlop() + 0.1f, ), Down(x = 123, y = 456), Move(distanceMoved = ViewConfiguration.getTouchSlop() + 0.1f), ) assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun heldDownTooBrieflyToBeConsideredAlongPress() = runTest { dispatchTouchEvents( Down( x = 123, y = 456, ), Down(x = 123, y = 456), Up( distanceMoved = ViewConfiguration.getTouchSlop().toFloat(), gestureDuration = ViewConfiguration.getLongPressTimeout() - 1L, Loading @@ -152,12 +129,10 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected).invoke() verify(onSingleTapDetected).invoke(123, 456) } private fun dispatchTouchEvents( vararg models: MotionEventModel, ) { private fun dispatchTouchEvents(vararg models: MotionEventModel) { models.forEach { model -> underTest.onTouchEvent(model) } } } packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ import com.android.systemui.user.domain.interactor.UserSwitcherInteractor; import com.android.systemui.util.kotlin.JavaAdapter; import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Lazy; Loading Loading @@ -270,6 +271,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mDreamingToLockscreenTransitionViewModel; @Mock protected KeyguardTransitionInteractor mKeyguardTransitionInteractor; @Mock protected KeyguardTouchHandlingViewModel mKeyuardTouchHandlingViewModel; @Mock protected WallpaperFocalAreaViewModel mWallpaperFocalAreaViewModel; @Mock protected AlternateBouncerInteractor mAlternateBouncerInteractor; @Mock protected MotionEvent mDownMotionEvent; @Mock protected CoroutineDispatcher mMainDispatcher; Loading Loading @@ -574,6 +576,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardTransitionInteractor, mDumpManager, mKeyuardTouchHandlingViewModel, mWallpaperFocalAreaViewModel, mKeyguardInteractor, mActivityStarter, mSharedNotificationContainerInteractor, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/util/WallpaperControllerTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class WallpaperControllerTest : SysuiTestCase() { @Test fun setUnfoldTransitionZoom_defaultUnfoldTransitionIsDisabled_doesNotUpdateWallpaperZoom() { wallpaperRepository.wallpaperInfo.value = createWallpaperInfo(useDefaultTransition = false) wallpaperRepository.setWallpaperInfo(createWallpaperInfo(useDefaultTransition = false)) wallaperController.setUnfoldTransitionZoom(0.5f) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt +2 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ import androidx.test.filters.SmallTest import com.android.internal.R import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.FakeKeyguardClockRepository import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.res.R as SysUIR import com.android.systemui.shared.Flags as SharedFlags import com.android.systemui.user.data.model.SelectedUserModel Loading @@ -53,8 +51,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { private val testDispatcher = StandardTestDispatcher() private val testScope = TestScope(testDispatcher) private val userRepository = FakeUserRepository() private val keyguardClockRepository = FakeKeyguardClockRepository() private val keyguardRepository = FakeKeyguardRepository() private val wallpaperFocalAreaRepository = FakeWallpaperFocalAreaRepository() private val wallpaperManager: WallpaperManager = mock() private val underTest: WallpaperRepositoryImpl by lazy { Loading @@ -63,7 +60,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { testDispatcher, fakeBroadcastDispatcher, userRepository, keyguardRepository, wallpaperFocalAreaRepository, wallpaperManager, context, ) Loading Loading
core/java/android/app/WallpaperManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -296,6 +296,16 @@ public class WallpaperManager { public static final String COMMAND_LOCKSCREEN_LAYOUT_CHANGED = "android.wallpaper.lockscreen_layout_changed"; /** * Command for {@link #sendWallpaperCommand}: Include the tap position within the wallpaper * focal area.The x and y arguments are the absolute tap coordinates, already scaled to match * the wallpaper's dimensions. * * @hide */ public static final String COMMAND_LOCKSCREEN_TAP = "android.wallpaper.lockscreen_tap"; /** * Extra passed back from setWallpaper() giving the new wallpaper's assigned ID. * @hide Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/common/ui/view/LongPressHandlingViewInteractionHandlerTest.kt +14 −39 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { @Mock private lateinit var postDelayed: (Runnable, Long) -> DisposableHandle @Mock private lateinit var onLongPressDetected: (Int, Int) -> Unit @Mock private lateinit var onSingleTapDetected: () -> Unit @Mock private lateinit var onSingleTapDetected: (Int, Int) -> Unit private lateinit var underTest: LongPressHandlingViewInteractionHandler Loading Loading @@ -76,74 +76,51 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { val downX = 123 val downY = 456 dispatchTouchEvents( Down( x = downX, y = downY, ), Move( distanceMoved = ViewConfiguration.getTouchSlop() - 0.1f, ), Down(x = downX, y = downY), Move(distanceMoved = ViewConfiguration.getTouchSlop() - 0.1f), ) delayedRunnable?.run() verify(onLongPressDetected).invoke(downX, downY) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun longPressButFeatureNotEnabled() = runTest { underTest.isLongPressHandlingEnabled = false dispatchTouchEvents( Down( x = 123, y = 456, ), ) dispatchTouchEvents(Down(x = 123, y = 456)) assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun longPressButViewNotAttached() = runTest { isAttachedToWindow = false dispatchTouchEvents( Down( x = 123, y = 456, ), ) dispatchTouchEvents(Down(x = 123, y = 456)) delayedRunnable?.run() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun draggedTooFarToBeConsideredAlongPress() = runTest { dispatchTouchEvents( Down( x = 123, y = 456, ), Move( distanceMoved = ViewConfiguration.getTouchSlop() + 0.1f, ), Down(x = 123, y = 456), Move(distanceMoved = ViewConfiguration.getTouchSlop() + 0.1f), ) assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected, never()).invoke() verify(onSingleTapDetected, never()).invoke(any(), any()) } @Test fun heldDownTooBrieflyToBeConsideredAlongPress() = runTest { dispatchTouchEvents( Down( x = 123, y = 456, ), Down(x = 123, y = 456), Up( distanceMoved = ViewConfiguration.getTouchSlop().toFloat(), gestureDuration = ViewConfiguration.getLongPressTimeout() - 1L, Loading @@ -152,12 +129,10 @@ class LongPressHandlingViewInteractionHandlerTest : SysuiTestCase() { assertThat(delayedRunnable).isNull() verify(onLongPressDetected, never()).invoke(any(), any()) verify(onSingleTapDetected).invoke() verify(onSingleTapDetected).invoke(123, 456) } private fun dispatchTouchEvents( vararg models: MotionEventModel, ) { private fun dispatchTouchEvents(vararg models: MotionEventModel) { models.forEach { model -> underTest.onTouchEvent(model) } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,7 @@ import com.android.systemui.user.domain.interactor.UserSwitcherInteractor; import com.android.systemui.util.kotlin.JavaAdapter; import com.android.systemui.util.time.FakeSystemClock; import com.android.systemui.util.time.SystemClock; import com.android.systemui.wallpapers.ui.viewmodel.WallpaperFocalAreaViewModel; import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Lazy; Loading Loading @@ -270,6 +271,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mDreamingToLockscreenTransitionViewModel; @Mock protected KeyguardTransitionInteractor mKeyguardTransitionInteractor; @Mock protected KeyguardTouchHandlingViewModel mKeyuardTouchHandlingViewModel; @Mock protected WallpaperFocalAreaViewModel mWallpaperFocalAreaViewModel; @Mock protected AlternateBouncerInteractor mAlternateBouncerInteractor; @Mock protected MotionEvent mDownMotionEvent; @Mock protected CoroutineDispatcher mMainDispatcher; Loading Loading @@ -574,6 +576,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardTransitionInteractor, mDumpManager, mKeyuardTouchHandlingViewModel, mWallpaperFocalAreaViewModel, mKeyguardInteractor, mActivityStarter, mSharedNotificationContainerInteractor, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/util/WallpaperControllerTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class WallpaperControllerTest : SysuiTestCase() { @Test fun setUnfoldTransitionZoom_defaultUnfoldTransitionIsDisabled_doesNotUpdateWallpaperZoom() { wallpaperRepository.wallpaperInfo.value = createWallpaperInfo(useDefaultTransition = false) wallpaperRepository.setWallpaperInfo(createWallpaperInfo(useDefaultTransition = false)) wallaperController.setUnfoldTransitionZoom(0.5f) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/wallpapers/data/repository/WallpaperRepositoryImplTest.kt +2 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,6 @@ import androidx.test.filters.SmallTest import com.android.internal.R import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.keyguard.data.repository.FakeKeyguardClockRepository import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.res.R as SysUIR import com.android.systemui.shared.Flags as SharedFlags import com.android.systemui.user.data.model.SelectedUserModel Loading @@ -53,8 +51,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { private val testDispatcher = StandardTestDispatcher() private val testScope = TestScope(testDispatcher) private val userRepository = FakeUserRepository() private val keyguardClockRepository = FakeKeyguardClockRepository() private val keyguardRepository = FakeKeyguardRepository() private val wallpaperFocalAreaRepository = FakeWallpaperFocalAreaRepository() private val wallpaperManager: WallpaperManager = mock() private val underTest: WallpaperRepositoryImpl by lazy { Loading @@ -63,7 +60,7 @@ class WallpaperRepositoryImplTest : SysuiTestCase() { testDispatcher, fakeBroadcastDispatcher, userRepository, keyguardRepository, wallpaperFocalAreaRepository, wallpaperManager, context, ) Loading