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

Commit 5fecca53 authored by Coco Duan's avatar Coco Duan Committed by Android (Google) Code Review
Browse files

Merge "Remove swipe-up to bouncer from hub" into main

parents 01cd3b70 ba971655
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -121,6 +121,10 @@ val sceneTransitionsV2 = transitions {
        spec = tween(durationMillis = TO_GONE_DURATION.toInt(DurationUnit.MILLISECONDS))
        fade(AllElements)
    }
    to(CommunalScenes.Blank, key = CommunalTransitionKeys.SwipeUp) {
        spec = tween(durationMillis = TO_LOCKSCREEN_DURATION.toInt(DurationUnit.MILLISECONDS))
        fade(AllElements)
    }
    to(CommunalScenes.Blank, key = CommunalTransitionKeys.SwipeInLandscape) {
        spec = tween(durationMillis = TO_LOCKSCREEN_DURATION.toInt(DurationUnit.MILLISECONDS))
        translate(Communal.Elements.Grid, Edge.End)
@@ -294,7 +298,9 @@ fun CommunalContainer(
                            } else {
                                CommunalTransitionKeys.Swipe
                            },
                        )
                        ),
                    Swipe.Up to
                        UserActionResult(CommunalScenes.Blank, CommunalTransitionKeys.SwipeUp),
                ),
        ) {
            CommunalScene(
+15 −5
Original line number Diff line number Diff line
@@ -16,11 +16,15 @@

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

import static com.android.systemui.ambient.touch.TouchSurfaceKt.SURFACE_HUB;

import android.animation.ValueAnimator;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.VelocityTracker;

import com.android.systemui.Flags;
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;
@@ -30,7 +34,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;
@@ -65,10 +71,14 @@ 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 (Flags.glanceableHubV2() && surface == SURFACE_HUB) {
            return Set.of();
        }
        return Set.of(touchHandler);
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ object CommunalTransitionKeys {
    val FromOccluded = TransitionKey("FromOccluded")
    /** Swipes out of glanceable hub in landscape orientation */
    val SwipeInLandscape = TransitionKey("SwipeInLandscape")
    /** Swipes up to exit glanceable hub to lockscreen */
    val SwipeUp = TransitionKey("SwipeUp")
    /** Transition from AOD state to the glanceable hub */
    val FromAod = TransitionKey("FromAod")
}
+15 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.SwipeDetector
import com.android.compose.animation.scene.SwipeSource
import com.android.compose.animation.scene.SwipeSourceDetector
import com.android.systemui.Flags
import kotlin.math.abs

/**
@@ -49,10 +50,20 @@ class CommunalSwipeDetector(private var lastDirection: SwipeSource.Resolved? = n
    }

    override fun detectSwipe(change: PointerInputChange): Boolean {
        if (
            Flags.glanceableHubV2() &&
                change.positionChange().y < 0 &&
                abs(change.positionChange().y / change.positionChange().x) > TRAVEL_RATIO_THRESHOLD
        ) {
            lastDirection = Edge.Resolved.Bottom
            return true
        }

        lastDirection =
            if (change.positionChange().x > 0) {
            lastDirection = Edge.Resolved.Left
                Edge.Resolved.Left
            } else {
            lastDirection = Edge.Resolved.Right
                Edge.Resolved.Right
            }

        // Determine whether the ratio of the distance traveled horizontally to the distance