Loading packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { .thenReturn(dreamOverlayComponent) val ambientTouchComponent = mock<AmbientTouchComponent>() whenever(ambientTouchComponentFactory.create(any(), any(), any())) whenever(ambientTouchComponentFactory.create(any(), any(), any(), any())) .thenReturn(ambientTouchComponent) whenever(ambientTouchComponent.getTouchMonitor()).thenReturn(mTouchMonitor) Loading Loading @@ -1320,7 +1320,8 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { ) mMainExecutor.runAllReady() verify(mAmbientTouchComponentFactory).create(any(), mTouchHandlersCaptor.capture(), any()) verify(mAmbientTouchComponentFactory) .create(any(), mTouchHandlersCaptor.capture(), any(), any()) assertThat(mTouchHandlersCaptor.firstValue) .containsExactly(mHideComplicationTouchHandler, mCommunalTouchHandler) } Loading @@ -1342,7 +1343,8 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { ) mMainExecutor.runAllReady() verify(mAmbientTouchComponentFactory).create(any(), mTouchHandlersCaptor.capture(), any()) verify(mAmbientTouchComponentFactory) .create(any(), mTouchHandlersCaptor.capture(), any(), any()) assertThat(mTouchHandlersCaptor.firstValue).containsExactly(mHideComplicationTouchHandler) } Loading packages/SystemUI/src/com/android/systemui/ambient/dagger/AmbientModule.kt +1 −0 Original line number Diff line number Diff line Loading @@ -33,5 +33,6 @@ interface AmbientModule { companion object { const val TOUCH_HANDLERS = "touch_handlers" const val LOGGING_NAME = "logging_name" const val SURFACE = "surface" } } packages/SystemUI/src/com/android/systemui/ambient/touch/TouchSurface.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.ambient.touch import androidx.annotation.IntDef /** Enum for the surface we are running the touch monitor on. */ @Retention(AnnotationRetention.SOURCE) @IntDef(value = [SURFACE_DREAM, SURFACE_HUB]) internal annotation class TouchSurface const val SURFACE_DREAM = 0 const val SURFACE_HUB = 1 packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/AmbientTouchComponent.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.systemui.ambient.touch.dagger import androidx.lifecycle.LifecycleOwner import com.android.systemui.ambient.dagger.AmbientModule.Companion.LOGGING_NAME import com.android.systemui.ambient.dagger.AmbientModule.Companion.SURFACE import com.android.systemui.ambient.dagger.AmbientModule.Companion.TOUCH_HANDLERS import com.android.systemui.ambient.touch.TouchHandler import com.android.systemui.ambient.touch.TouchMonitor import com.android.systemui.ambient.touch.TouchSurface import dagger.BindsInstance import dagger.Subcomponent import javax.inject.Named Loading @@ -39,6 +41,7 @@ interface AmbientTouchComponent { @Named(TOUCH_HANDLERS) touchHandlers: Set<@JvmSuppressWildcards TouchHandler>, @BindsInstance @Named(LOGGING_NAME) loggingName: String, @BindsInstance @Named(SURFACE) @TouchSurface surface: Int, ): AmbientTouchComponent } Loading packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/BouncerSwipeModule.java +15 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.ambient.touch.dagger; import static android.service.dreams.Flags.dreamsV2; import static com.android.systemui.ambient.touch.TouchSurfaceKt.SURFACE_DREAM; import android.animation.ValueAnimator; import android.content.res.Resources; import android.util.TypedValue; import android.view.VelocityTracker; import com.android.systemui.ambient.dagger.AmbientModule; import com.android.systemui.ambient.touch.BouncerSwipeTouchHandler; import com.android.systemui.ambient.touch.TouchHandler; import com.android.systemui.dagger.qualifiers.Main; Loading @@ -30,7 +35,9 @@ import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoSet; import dagger.multibindings.ElementsIntoSet; import java.util.Set; import javax.inject.Named; import javax.inject.Provider; Loading Loading @@ -65,10 +72,13 @@ public class BouncerSwipeModule { * Provides {@link BouncerSwipeTouchHandler} for inclusion in touch handling over the dream. */ @Provides @IntoSet public static TouchHandler providesBouncerSwipeTouchHandler( BouncerSwipeTouchHandler touchHandler) { return touchHandler; @ElementsIntoSet public static Set<TouchHandler> providesBouncerSwipeTouchHandler( BouncerSwipeTouchHandler touchHandler, @Named(AmbientModule.SURFACE) Integer surface) { if (dreamsV2() && surface == SURFACE_DREAM) { return Set.of(); } return Set.of(touchHandler); } /** Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/DreamOverlayServiceTest.kt +5 −3 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { .thenReturn(dreamOverlayComponent) val ambientTouchComponent = mock<AmbientTouchComponent>() whenever(ambientTouchComponentFactory.create(any(), any(), any())) whenever(ambientTouchComponentFactory.create(any(), any(), any(), any())) .thenReturn(ambientTouchComponent) whenever(ambientTouchComponent.getTouchMonitor()).thenReturn(mTouchMonitor) Loading Loading @@ -1320,7 +1320,8 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { ) mMainExecutor.runAllReady() verify(mAmbientTouchComponentFactory).create(any(), mTouchHandlersCaptor.capture(), any()) verify(mAmbientTouchComponentFactory) .create(any(), mTouchHandlersCaptor.capture(), any(), any()) assertThat(mTouchHandlersCaptor.firstValue) .containsExactly(mHideComplicationTouchHandler, mCommunalTouchHandler) } Loading @@ -1342,7 +1343,8 @@ class DreamOverlayServiceTest(flags: FlagsParameterization?) : SysuiTestCase() { ) mMainExecutor.runAllReady() verify(mAmbientTouchComponentFactory).create(any(), mTouchHandlersCaptor.capture(), any()) verify(mAmbientTouchComponentFactory) .create(any(), mTouchHandlersCaptor.capture(), any(), any()) assertThat(mTouchHandlersCaptor.firstValue).containsExactly(mHideComplicationTouchHandler) } Loading
packages/SystemUI/src/com/android/systemui/ambient/dagger/AmbientModule.kt +1 −0 Original line number Diff line number Diff line Loading @@ -33,5 +33,6 @@ interface AmbientModule { companion object { const val TOUCH_HANDLERS = "touch_handlers" const val LOGGING_NAME = "logging_name" const val SURFACE = "surface" } }
packages/SystemUI/src/com/android/systemui/ambient/touch/TouchSurface.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.ambient.touch import androidx.annotation.IntDef /** Enum for the surface we are running the touch monitor on. */ @Retention(AnnotationRetention.SOURCE) @IntDef(value = [SURFACE_DREAM, SURFACE_HUB]) internal annotation class TouchSurface const val SURFACE_DREAM = 0 const val SURFACE_HUB = 1
packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/AmbientTouchComponent.kt +3 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.systemui.ambient.touch.dagger import androidx.lifecycle.LifecycleOwner import com.android.systemui.ambient.dagger.AmbientModule.Companion.LOGGING_NAME import com.android.systemui.ambient.dagger.AmbientModule.Companion.SURFACE import com.android.systemui.ambient.dagger.AmbientModule.Companion.TOUCH_HANDLERS import com.android.systemui.ambient.touch.TouchHandler import com.android.systemui.ambient.touch.TouchMonitor import com.android.systemui.ambient.touch.TouchSurface import dagger.BindsInstance import dagger.Subcomponent import javax.inject.Named Loading @@ -39,6 +41,7 @@ interface AmbientTouchComponent { @Named(TOUCH_HANDLERS) touchHandlers: Set<@JvmSuppressWildcards TouchHandler>, @BindsInstance @Named(LOGGING_NAME) loggingName: String, @BindsInstance @Named(SURFACE) @TouchSurface surface: Int, ): AmbientTouchComponent } Loading
packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/BouncerSwipeModule.java +15 −5 Original line number Diff line number Diff line Loading @@ -16,11 +16,16 @@ package com.android.systemui.ambient.touch.dagger; import static android.service.dreams.Flags.dreamsV2; import static com.android.systemui.ambient.touch.TouchSurfaceKt.SURFACE_DREAM; import android.animation.ValueAnimator; import android.content.res.Resources; import android.util.TypedValue; import android.view.VelocityTracker; import com.android.systemui.ambient.dagger.AmbientModule; import com.android.systemui.ambient.touch.BouncerSwipeTouchHandler; import com.android.systemui.ambient.touch.TouchHandler; import com.android.systemui.dagger.qualifiers.Main; Loading @@ -30,7 +35,9 @@ import com.android.wm.shell.animation.FlingAnimationUtils; import dagger.Module; import dagger.Provides; import dagger.multibindings.IntoSet; import dagger.multibindings.ElementsIntoSet; import java.util.Set; import javax.inject.Named; import javax.inject.Provider; Loading Loading @@ -65,10 +72,13 @@ public class BouncerSwipeModule { * Provides {@link BouncerSwipeTouchHandler} for inclusion in touch handling over the dream. */ @Provides @IntoSet public static TouchHandler providesBouncerSwipeTouchHandler( BouncerSwipeTouchHandler touchHandler) { return touchHandler; @ElementsIntoSet public static Set<TouchHandler> providesBouncerSwipeTouchHandler( BouncerSwipeTouchHandler touchHandler, @Named(AmbientModule.SURFACE) Integer surface) { if (dreamsV2() && surface == SURFACE_DREAM) { return Set.of(); } return Set.of(touchHandler); } /** Loading