Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fc3ffe0 authored by Bryce Lee's avatar Bryce Lee
Browse files

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
parent 042ef941
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.systemui.ambient.touch;
package com.android.systemui.dreams.touch;


import static com.google.common.truth.Truth.assertThat;
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 androidx.test.filters.SmallTest;


import com.android.systemui.SysuiTestCase;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.ambient.touch.TouchHandler;
import com.android.systemui.kosmos.KosmosJavaAdapter;
import com.android.systemui.kosmos.KosmosJavaAdapter;
import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.CentralSurfaces;
+0 −18
Original line number Original line Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.systemui.ambient.touch.dagger;


import android.content.res.Resources;
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.ShadeTouchHandler;
import com.android.systemui.ambient.touch.TouchHandler;
import com.android.systemui.ambient.touch.TouchHandler;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.Main;
@@ -43,10 +42,6 @@ public abstract class ShadeModule {
    public static final String NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT =
    public static final String NOTIFICATION_SHADE_GESTURE_INITIATION_HEIGHT =
            "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.
     * Provides {@link ShadeTouchHandler} to handle notification swipe down over dream.
     */
     */
@@ -55,11 +50,6 @@ public abstract class ShadeModule {
    public abstract TouchHandler providesNotificationShadeTouchHandler(
    public abstract TouchHandler providesNotificationShadeTouchHandler(
            ShadeTouchHandler touchHandler);
            ShadeTouchHandler touchHandler);


    /** Provides {@link CommunalTouchHandler}. */
    @Binds
    @IntoSet
    public abstract TouchHandler bindCommunalTouchHandler(CommunalTouchHandler touchHandler);

    /**
    /**
     * Provides the height of the gesture area for notification swipe down.
     * 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);
        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);
    }
}
}
+2 −1
Original line number Original line Diff line number Diff line
@@ -201,7 +201,8 @@ public class DreamOverlayService extends android.service.dreams.DreamOverlayServ
                mComplicationComponent.getComplicationHostViewController(), touchInsetManager);
                mComplicationComponent.getComplicationHostViewController(), touchInsetManager);
        mAmbientTouchComponent = ambientTouchComponentFactory.create(lifecycleOwner,
        mAmbientTouchComponent = ambientTouchComponentFactory.create(lifecycleOwner,
                new HashSet<>(Arrays.asList(
                new HashSet<>(Arrays.asList(
                        mDreamComplicationComponent.getHideComplicationTouchHandler())));
                        mDreamComplicationComponent.getHideComplicationTouchHandler(),
                        mDreamOverlayComponent.getCommunalTouchHandler())));
        mLifecycleOwner = lifecycleOwner;
        mLifecycleOwner = lifecycleOwner;
        mLifecycleRegistry = mLifecycleOwner.getRegistry();
        mLifecycleRegistry = mLifecycleOwner.getRegistry();


+6 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,8 @@ import androidx.lifecycle.LifecycleOwner;


import com.android.systemui.complication.ComplicationHostViewController;
import com.android.systemui.complication.ComplicationHostViewController;
import com.android.systemui.dreams.DreamOverlayContainerViewController;
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 com.android.systemui.touch.TouchInsetManager;


import dagger.BindsInstance;
import dagger.BindsInstance;
@@ -37,6 +39,7 @@ import javax.inject.Scope;
 */
 */
@Subcomponent(modules = {
@Subcomponent(modules = {
        DreamOverlayModule.class,
        DreamOverlayModule.class,
        CommunalTouchModule.class
})
})
@DreamOverlayComponent.DreamOverlayScope
@DreamOverlayComponent.DreamOverlayScope
public interface DreamOverlayComponent {
public interface DreamOverlayComponent {
@@ -57,4 +60,7 @@ public interface DreamOverlayComponent {


    /** Builds a {@link DreamOverlayContainerViewController}. */
    /** Builds a {@link DreamOverlayContainerViewController}. */
    DreamOverlayContainerViewController getDreamOverlayContainerViewController();
    DreamOverlayContainerViewController getDreamOverlayContainerViewController();

    /** Builds communal touch handler */
    CommunalTouchHandler getCommunalTouchHandler();
}
}
+4 −3
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * 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;
import static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow;


@@ -26,8 +26,9 @@ import android.view.MotionEvent;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.Lifecycle;
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.communal.domain.interactor.CommunalInteractor;
import com.android.systemui.dreams.touch.dagger.CommunalTouchModule;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.CentralSurfaces;


import java.util.Optional;
import java.util.Optional;
@@ -53,7 +54,7 @@ public class CommunalTouchHandler implements TouchHandler {
    @Inject
    @Inject
    public CommunalTouchHandler(
    public CommunalTouchHandler(
            Optional<CentralSurfaces> centralSurfaces,
            Optional<CentralSurfaces> centralSurfaces,
            @Named(ShadeModule.COMMUNAL_GESTURE_INITIATION_WIDTH) int initiationWidth,
            @Named(CommunalTouchModule.COMMUNAL_GESTURE_INITIATION_WIDTH) int initiationWidth,
            CommunalInteractor communalInteractor,
            CommunalInteractor communalInteractor,
            Lifecycle lifecycle) {
            Lifecycle lifecycle) {
        mInitiationWidth = initiationWidth;
        mInitiationWidth = initiationWidth;
Loading