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

Commit 01223bb5 authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Add swipe gesture indicator for glanceable hub" into main

parents 9a1fb8f3 07cbc24d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -951,3 +951,10 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "glanceable_hub_gesture_handle"
  namespace: "systemui"
  description: "Shows a vertical bar at the right edge to indicate the user can swipe to open the glanceable hub"
  bug: "339667383"
}
+24 −1
Original line number Diff line number Diff line
@@ -2,16 +2,24 @@ package com.android.systemui.communal.ui.compose

import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.Edge
import com.android.compose.animation.scene.ElementKey
@@ -26,6 +34,7 @@ import com.android.compose.animation.scene.Swipe
import com.android.compose.animation.scene.SwipeDirection
import com.android.compose.animation.scene.observableTransitionState
import com.android.compose.animation.scene.transitions
import com.android.systemui.Flags
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.CommunalTransitionKeys
import com.android.systemui.communal.ui.compose.extensions.allowGestures
@@ -88,6 +97,8 @@ fun CommunalContainer(
    val currentSceneKey: SceneKey by
        viewModel.currentScene.collectAsStateWithLifecycle(CommunalScenes.Blank)
    val touchesAllowed by viewModel.touchesAllowed.collectAsStateWithLifecycle(initialValue = false)
    val showGestureIndicator by
        viewModel.showGestureIndicator.collectAsStateWithLifecycle(initialValue = false)
    val state: MutableSceneTransitionLayoutState = remember {
        MutableSceneTransitionLayoutState(
            initialScene = currentSceneKey,
@@ -126,7 +137,19 @@ fun CommunalContainer(
                )
        ) {
            // This scene shows nothing only allowing for transitions to the communal scene.
            Box(modifier = Modifier.fillMaxSize())
            // TODO(b/339667383): remove this temporary swipe gesture handle
            Row(modifier = Modifier.fillMaxSize(), horizontalArrangement = Arrangement.End) {
                if (showGestureIndicator && Flags.glanceableHubGestureHandle()) {
                    Box(
                        modifier =
                            Modifier.height(220.dp)
                                .width(4.dp)
                                .align(Alignment.CenterVertically)
                                .background(color = Color.White, RoundedCornerShape(4.dp))
                    )
                    Spacer(modifier = Modifier.width(12.dp))
                }
            }
        }

        scene(
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.domain.interactor.keyguardInteractor
import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.StatusBarState
@@ -141,6 +142,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
                testScope,
                context.resources,
                kosmos.keyguardTransitionInteractor,
                kosmos.keyguardInteractor,
                kosmos.communalInteractor,
                kosmos.communalTutorialInteractor,
                kosmos.shadeInteractor,
+20 −0
Original line number Diff line number Diff line
@@ -31,8 +31,11 @@ import android.app.DreamManager;
import android.content.res.Resources;
import android.graphics.Region;
import android.os.Handler;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.testing.TestableLooper.RunWithLooper;
import android.view.AttachedSurfaceControl;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
@@ -42,6 +45,7 @@ import androidx.test.filters.SmallTest;

import com.android.dream.lowlight.LowLightTransitionCoordinator;
import com.android.keyguard.BouncerPanelExpansionCalculator;
import com.android.systemui.Flags;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.ambient.touch.scrim.BouncerlessScrimController;
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerCallbackInteractor;
@@ -93,6 +97,9 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
    @Mock
    ViewGroup mDreamOverlayContentView;

    @Mock
    View mHubGestureIndicatorView;

    @Mock
    Handler mHandler;

@@ -142,6 +149,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
                mDreamOverlayContainerView,
                mComplicationHostViewController,
                mDreamOverlayContentView,
                mHubGestureIndicatorView,
                mDreamOverlayStatusBarViewController,
                mLowLightTransitionCoordinator,
                mBlurUtils,
@@ -161,6 +169,18 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
                mDreamManager);
    }

    @DisableFlags(Flags.FLAG_COMMUNAL_HUB)
    @Test
    public void testHubGestureIndicatorGoneWhenFlagOff() {
        verify(mHubGestureIndicatorView, never()).setVisibility(View.VISIBLE);
    }

    @EnableFlags({Flags.FLAG_COMMUNAL_HUB, Flags.FLAG_GLANCEABLE_HUB_GESTURE_HANDLE})
    @Test
    public void testHubGestureIndicatorVisibleWhenFlagOn() {
        verify(mHubGestureIndicatorView).setVisibility(View.VISIBLE);
    }

    @Test
    public void testRootSurfaceControlInsetSetOnAttach() {
        mController.onViewAttached();
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ 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.
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="4dp" />
    <solid android:color="#FFFFFF" />
</shape>
 No newline at end of file
Loading