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

Commit 812b2985 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement back navigation on communal hub" into main

parents 93c94c54 940e63a0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1051,6 +1051,16 @@ flag {
  }
}

flag {
  name: "glanceable_hub_back_gesture"
  namespace: "systemui"
  description: "Enables back gesture on the glanceable hub"
  bug: "346331399"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "glanceable_hub_allow_keyguard_when_dreaming"
  namespace: "systemui"
+13 −4
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.Back
import com.android.compose.animation.scene.CommunalSwipeDetector
import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.ElementKey
@@ -41,6 +42,7 @@ import com.android.compose.animation.scene.SwipeDirection
import com.android.compose.animation.scene.observableTransitionState
import com.android.compose.animation.scene.transitions
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.systemui.Flags.glanceableHubBackGesture
import com.android.systemui.communal.shared.model.CommunalBackgroundType
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.CommunalTransitionKeys
@@ -193,10 +195,17 @@ fun CommunalContainer(
            Box(modifier = Modifier.fillMaxSize())
        }

        scene(
            CommunalScenes.Communal,
            userActions = mapOf(Swipe(SwipeDirection.Right) to CommunalScenes.Blank)
        ) {
        val userActions =
            if (glanceableHubBackGesture()) {
                mapOf(
                    Swipe(SwipeDirection.Right) to CommunalScenes.Blank,
                    Back to CommunalScenes.Blank,
                )
            } else {
                mapOf(Swipe(SwipeDirection.Right) to CommunalScenes.Blank)
            }

        scene(CommunalScenes.Communal, userActions = userActions) {
            CommunalScene(
                backgroundType = backgroundType,
                colors = colors,
+8 −1
Original line number Diff line number Diff line
@@ -126,6 +126,8 @@ public class QuickStepContract {
    public static final long SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED = 1L << 33;
    // PiP animation is running
    public static final long SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING = 1L << 34;
    // Communal hub is showing
    public static final long SYSUI_STATE_COMMUNAL_HUB_SHOWING = 1L << 35;

    // Mask for SystemUiStateFlags to isolate SYSUI_STATE_AWAKE and
    // SYSUI_STATE_WAKEFULNESS_TRANSITION, to match WAKEFULNESS_* constants
@@ -176,6 +178,7 @@ public class QuickStepContract {
            SYSUI_STATE_SHORTCUT_HELPER_SHOWING,
            SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED,
            SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING,
            SYSUI_STATE_COMMUNAL_HUB_SHOWING,
    })
    public @interface SystemUiStateFlags {}

@@ -283,6 +286,9 @@ public class QuickStepContract {
        if ((flags & SYSUI_STATE_DISABLE_GESTURE_PIP_ANIMATING) != 0) {
            str.add("disable_gesture_pip_animating");
        }
        if ((flags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) {
            str.add("communal_hub_showing");
        }

        return str.toString();
    }
@@ -336,7 +342,8 @@ public class QuickStepContract {
        // the keyguard)
        if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0
                || (sysuiStateFlags & SYSUI_STATE_DIALOG_SHOWING) != 0
                || (sysuiStateFlags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0) {
                || (sysuiStateFlags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0
                || (sysuiStateFlags & SYSUI_STATE_COMMUNAL_HUB_SHOWING) != 0) {
            return false;
        }
        if ((sysuiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0) {
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public class SystemActions implements CoreStartable, ConfigurationController.Con
        // NotificationShadeWindowController.registerCallback() only keeps weak references.
        mNotificationShadeCallback =
                (keyguardShowing, keyguardOccluded, keyguardGoingAway, bouncerShowing, mDozing,
                        panelExpanded, isDreaming) ->
                        panelExpanded, isDreaming, communalShowing) ->
                        registerOrUnregisterDismissNotificationShadeAction();
        mScreenshotHelper = new ScreenshotHelper(mContext);
    }
+6 −0
Original line number Diff line number Diff line
@@ -18,12 +18,14 @@ package com.android.systemui.model

import com.android.compose.animation.scene.ObservableTransitionState
import com.android.compose.animation.scene.SceneKey
import com.android.systemui.Flags.glanceableHubBackGesture
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_COMMUNAL_HUB_SHOWING
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE
import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED
@@ -105,6 +107,10 @@ constructor(
                    {
                        it.scene == Scenes.Lockscreen && it.invisibleDueToOcclusion
                    },
                SYSUI_STATE_COMMUNAL_HUB_SHOWING to
                    {
                        glanceableHubBackGesture() && it.scene == Scenes.Communal
                    }
            )
    }

Loading