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

Commit fc4e76f4 authored by Darrell Shi's avatar Darrell Shi
Browse files

Share communal between keyguard blueprint and flexiglass scene

This change moves the existing placeholder communal view in flexiglass
to a common place be shared with keyguard blueprint. This allows us to
develop communal UI in one place while supporting both infrastructures.

Bug: 304359682
Fix: 304359682
Test: atest DefaultCommunalBlueprintTest
Test: verified communal is shown in both keyguard blueprint by
adb shell cmd statusbar blueprint communal, and flexiglass by swiping
left on the lockscreen

Change-Id: If895046ce088d553143108cafdfa7c92df00484c
parent f2a089d3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -64,6 +64,12 @@ object ComposeFacade : BaseComposeFacade {
        throwComposeUnavailableError()
    }

    override fun createCommunalView(
        context: Context,
    ): View {
        throwComposeUnavailableError()
    }

    private fun throwComposeUnavailableError(): Nothing {
        error(
            "Compose is not available. Make sure to check isComposeAvailable() before calling any" +
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.compose.theme.PlatformTheme
import com.android.systemui.common.ui.compose.windowinsets.CutoutLocation
import com.android.systemui.common.ui.compose.windowinsets.DisplayCutout
import com.android.systemui.common.ui.compose.windowinsets.DisplayCutoutProvider
import com.android.systemui.communal.ui.compose.CommunalHub
import com.android.systemui.people.ui.compose.PeopleScreen
import com.android.systemui.people.ui.viewmodel.PeopleViewModel
import com.android.systemui.qs.footer.ui.compose.FooterActions
@@ -93,6 +94,12 @@ object ComposeFacade : BaseComposeFacade {
        }
    }

    override fun createCommunalView(
        context: Context,
    ): View {
        return ComposeView(context).apply { setContent { PlatformTheme { CommunalHub() } } }
    }

    // TODO(b/298525212): remove once Compose exposes window inset bounds.
    private fun displayCutoutFromWindowInsets(
        scope: CoroutineScope,
+22 −0
Original line number Diff line number Diff line
package com.android.systemui.communal.ui.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color

@Composable
fun CommunalHub(modifier: Modifier = Modifier) {
    Box(
        modifier = modifier.fillMaxSize().background(Color.White),
    ) {
        Text(
            modifier = Modifier.align(Alignment.Center),
            text = "Hello Communal!",
        )
    }
}
+1 −14
Original line number Diff line number Diff line
@@ -16,14 +16,8 @@

package com.android.systemui.communal.ui.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.android.compose.animation.scene.SceneScope
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.shared.model.Direction
@@ -51,13 +45,6 @@ class CommunalScene @Inject constructor() : ComposableScene {

    @Composable
    override fun SceneScope.Content(modifier: Modifier) {
        Box(
            modifier = modifier.fillMaxSize().background(Color.White),
        ) {
            Text(
                modifier = Modifier.align(Alignment.Center),
                text = "Hello Communal!",
            )
        }
        CommunalHub(modifier)
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -229,6 +229,7 @@
    <item type="id" name="privacy_dialog_manage_app_button" />

    <!-- Communal mode -->
    <item type="id" name="communal_hub" />
    <item type="id" name="communal_widget_wrapper" />

    <!-- Values assigned to the views in Biometrics Prompt -->
Loading