diff options
| author | 2024-04-11 21:45:19 -0700 | |
|---|---|---|
| committer | 2024-04-12 06:29:52 +0000 | |
| commit | 9fc3ffe00f9e90ed9cb3e111df8dbf0a014d4f3f (patch) | |
| tree | ee2aa1b6287cff22c5fc93361eeab0fd5ab2dee1 | |
| parent | 042ef94178620fe5453090e14c3cc6b00743dd18 (diff) | |
Only use CommunalTouchHandler for Dream Overlay.
This changelist removes CommunalTouchHandler from the general
TouchHandler set and instead moves it to be part of the
DreamOverlayComponent.
Test: atest DreamOverlayServiceTest
Test: atest CommunalTouchHandlerTest
Flag: N/A
Fixes: 333885071
Change-Id: I4ca69b60749f27baf2300a1a338c87aaa9c5b5d1
| -rw-r--r-- | packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/touch/CommunalTouchHandlerTest.java (renamed from packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/CommunalTouchHandlerTest.java) | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/ShadeModule.java | 18 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java | 3 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayComponent.java | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/dreams/touch/CommunalTouchHandler.java (renamed from packages/SystemUI/src/com/android/systemui/ambient/touch/CommunalTouchHandler.java) | 7 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/CommunalTouchModule.kt | 39 |
6 files changed, 53 insertions, 23 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/CommunalTouchHandlerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/touch/CommunalTouchHandlerTest.java index baa1f029b8a2..29fbee01a18b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/CommunalTouchHandlerTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/dreams/touch/CommunalTouchHandlerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.ambient.touch; +package com.android.systemui.dreams.touch; import static com.google.common.truth.Truth.assertThat; @@ -31,6 +31,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; +import com.android.systemui.ambient.touch.TouchHandler; import com.android.systemui.kosmos.KosmosJavaAdapter; import com.android.systemui.shared.system.InputChannelCompat; import com.android.systemui.statusbar.phone.CentralSurfaces; diff --git a/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/ShadeModule.java b/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/ShadeModule.java index 07610ac86406..bc2f35467312 100644 --- a/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/ShadeModule.java +++ b/packages/SystemUI/src/com/android/systemui/ambient/touch/dagger/ShadeModule.java @@ -18,7 +18,6 @@ package com.android.systemui.ambient.touch.dagger; import android.content.res.Resources; -import com.android.systemui.ambient.touch.CommunalTouchHandler; import com.android.systemui.ambient.touch.ShadeTouchHandler; import com.android.systemui.ambient.touch.TouchHandler; import com.android.systemui.dagger.qualifiers.Main; @@ -43,10 +42,6 @@ public abstract class ShadeModule { public static final String NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT = "notification_shade_gesture_initiation_height"; - /** Width of swipe gesture edge to show communal hub. */ - public static final String COMMUNAL_GESTURE_INITIATION_WIDTH = - "communal_gesture_initiation_width"; - /** * Provides {@link ShadeTouchHandler} to handle notification swipe down over dream. */ @@ -55,11 +50,6 @@ public abstract class ShadeModule { public abstract TouchHandler providesNotificationShadeTouchHandler( ShadeTouchHandler touchHandler); - /** Provides {@link CommunalTouchHandler}. */ - @Binds - @IntoSet - public abstract TouchHandler bindCommunalTouchHandler(CommunalTouchHandler touchHandler); - /** * Provides the height of the gesture area for notification swipe down. */ @@ -69,12 +59,4 @@ public abstract class ShadeModule { return resources.getDimensionPixelSize(R.dimen.dream_overlay_status_bar_height); } - /** - * Provides the width of the gesture area for swiping open communal hub. - */ - @Provides - @Named(COMMUNAL_GESTURE_INITIATION_WIDTH) - public static int providesCommunalGestureInitiationWidth(@Main Resources resources) { - return resources.getDimensionPixelSize(R.dimen.communal_gesture_initiation_width); - } } diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java index 6f1d48f76b3b..1135afeb6f83 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayService.java @@ -201,7 +201,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ mComplicationComponent.getComplicationHostViewController(), touchInsetManager); mAmbientTouchComponent = ambientTouchComponentFactory.create(lifecycleOwner, new HashSet<>(Arrays.asList( - mDreamComplicationComponent.getHideComplicationTouchHandler()))); + mDreamComplicationComponent.getHideComplicationTouchHandler(), + mDreamOverlayComponent.getCommunalTouchHandler()))); mLifecycleOwner = lifecycleOwner; mLifecycleRegistry = mLifecycleOwner.getRegistry(); diff --git a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayComponent.java b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayComponent.java index 9a4d7656227b..16276fe81afc 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayComponent.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/dagger/DreamOverlayComponent.java @@ -22,6 +22,8 @@ import androidx.lifecycle.LifecycleOwner; import com.android.systemui.complication.ComplicationHostViewController; import com.android.systemui.dreams.DreamOverlayContainerViewController; +import com.android.systemui.dreams.touch.CommunalTouchHandler; +import com.android.systemui.dreams.touch.dagger.CommunalTouchModule; import com.android.systemui.touch.TouchInsetManager; import dagger.BindsInstance; @@ -37,6 +39,7 @@ import javax.inject.Scope; */ @Subcomponent(modules = { DreamOverlayModule.class, + CommunalTouchModule.class }) @DreamOverlayComponent.DreamOverlayScope public interface DreamOverlayComponent { @@ -57,4 +60,7 @@ public interface DreamOverlayComponent { /** Builds a {@link DreamOverlayContainerViewController}. */ DreamOverlayContainerViewController getDreamOverlayContainerViewController(); + + /** Builds communal touch handler */ + CommunalTouchHandler getCommunalTouchHandler(); } diff --git a/packages/SystemUI/src/com/android/systemui/ambient/touch/CommunalTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/CommunalTouchHandler.java index 9df70d23d0b6..1c047ddcd3d8 100644 --- a/packages/SystemUI/src/com/android/systemui/ambient/touch/CommunalTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/CommunalTouchHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.ambient.touch; +package com.android.systemui.dreams.touch; import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; @@ -26,8 +26,9 @@ import android.view.MotionEvent; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.Lifecycle; -import com.android.systemui.ambient.touch.dagger.ShadeModule; +import com.android.systemui.ambient.touch.TouchHandler; import com.android.systemui.communal.domain.interactor.CommunalInteractor; +import com.android.systemui.dreams.touch.dagger.CommunalTouchModule; import com.android.systemui.statusbar.phone.CentralSurfaces; import java.util.Optional; @@ -53,7 +54,7 @@ public class CommunalTouchHandler implements TouchHandler { @Inject public CommunalTouchHandler( Optional<CentralSurfaces> centralSurfaces, - @Named(ShadeModule.COMMUNAL_GESTURE_INITIATION_WIDTH) int initiationWidth, + @Named(CommunalTouchModule.COMMUNAL_GESTURE_INITIATION_WIDTH) int initiationWidth, CommunalInteractor communalInteractor, Lifecycle lifecycle) { mInitiationWidth = initiationWidth; diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/CommunalTouchModule.kt b/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/CommunalTouchModule.kt new file mode 100644 index 000000000000..927ea4ec6d4b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/dagger/CommunalTouchModule.kt @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 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.dreams.touch.dagger + +import android.content.res.Resources +import com.android.systemui.dagger.qualifiers.Main +import com.android.systemui.res.R +import dagger.Module +import dagger.Provides +import javax.inject.Named + +@Module +interface CommunalTouchModule { + companion object { + /** Provides the width of the gesture area for swiping open communal hub. */ + @JvmStatic + @Provides + @Named(COMMUNAL_GESTURE_INITIATION_WIDTH) + fun providesCommunalGestureInitiationWidth(@Main resources: Resources): Int { + return resources.getDimensionPixelSize(R.dimen.communal_gesture_initiation_width) + } + + /** Width of swipe gesture edge to show communal hub. */ + const val COMMUNAL_GESTURE_INITIATION_WIDTH = "communal_gesture_initiation_width" + } +} |