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

Commit 349a2873 authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Ambient indication section." into main

parents d3161d80 5414c5cb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.systemui.keyguard.ui.composable.blueprint.CommunalBlueprintMo
import com.android.systemui.keyguard.ui.composable.blueprint.DefaultBlueprintModule
import com.android.systemui.keyguard.ui.composable.blueprint.ShortcutsBesideUdfpsBlueprintModule
import com.android.systemui.keyguard.ui.composable.blueprint.SplitShadeBlueprintModule
import com.android.systemui.keyguard.ui.composable.section.OptionalSectionModule
import dagger.Module

@Module(
@@ -27,6 +28,7 @@ import dagger.Module
        [
            CommunalBlueprintModule::class,
            DefaultBlueprintModule::class,
            OptionalSectionModule::class,
            ShortcutsBesideUdfpsBlueprintModule::class,
            SplitShadeBlueprintModule::class,
        ],
+6 −5
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoSet
import java.util.Optional
import javax.inject.Inject

/**
@@ -53,7 +54,7 @@ constructor(
    private val smartSpaceSection: SmartSpaceSection,
    private val notificationSection: NotificationSection,
    private val lockSection: LockSection,
    private val ambientIndicationSection: AmbientIndicationSection,
    private val ambientIndicationSectionOptional: Optional<AmbientIndicationSection>,
    private val bottomAreaSection: BottomAreaSection,
    private val settingsMenuSection: SettingsMenuSection,
    private val clockInteractor: KeyguardClockInteractor,
@@ -94,8 +95,8 @@ constructor(
                        with(notificationSection) {
                            Notifications(modifier = Modifier.fillMaxWidth().weight(1f))
                        }
                        if (!isUdfpsVisible) {
                            with(ambientIndicationSection) {
                        if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
                            with(ambientIndicationSectionOptional.get()) {
                                AmbientIndication(modifier = Modifier.fillMaxWidth())
                            }
                        }
@@ -105,8 +106,8 @@ constructor(

                    // Aligned to bottom and constrained to below the lock icon.
                    Column(modifier = Modifier.fillMaxWidth()) {
                        if (isUdfpsVisible) {
                            with(ambientIndicationSection) {
                        if (isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
                            with(ambientIndicationSectionOptional.get()) {
                                AmbientIndication(modifier = Modifier.fillMaxWidth())
                            }
                        }
+6 −5
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.keyguard.ui.viewmodel.LockscreenContentViewModel
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoSet
import java.util.Optional
import javax.inject.Inject

/**
@@ -53,7 +54,7 @@ constructor(
    private val smartSpaceSection: SmartSpaceSection,
    private val notificationSection: NotificationSection,
    private val lockSection: LockSection,
    private val ambientIndicationSection: AmbientIndicationSection,
    private val ambientIndicationSectionOptional: Optional<AmbientIndicationSection>,
    private val bottomAreaSection: BottomAreaSection,
    private val settingsMenuSection: SettingsMenuSection,
    private val clockInteractor: KeyguardClockInteractor,
@@ -94,8 +95,8 @@ constructor(
                        with(notificationSection) {
                            Notifications(modifier = Modifier.fillMaxWidth().weight(1f))
                        }
                        if (!isUdfpsVisible) {
                            with(ambientIndicationSection) {
                        if (!isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
                            with(ambientIndicationSectionOptional.get()) {
                                AmbientIndication(modifier = Modifier.fillMaxWidth())
                            }
                        }
@@ -111,8 +112,8 @@ constructor(

                    // Aligned to bottom and constrained to below the lock icon.
                    Column(modifier = Modifier.fillMaxWidth()) {
                        if (isUdfpsVisible) {
                            with(ambientIndicationSection) {
                        if (isUdfpsVisible && ambientIndicationSectionOptional.isPresent) {
                            with(ambientIndicationSectionOptional.get()) {
                                AmbientIndication(modifier = Modifier.fillMaxWidth())
                            }
                        }
+3 −30
Original line number Diff line number Diff line
@@ -16,38 +16,11 @@

package com.android.systemui.keyguard.ui.composable.section

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
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.ElementKey
import com.android.compose.animation.scene.SceneScope
import javax.inject.Inject

class AmbientIndicationSection @Inject constructor() {
    @Composable
    fun SceneScope.AmbientIndication(modifier: Modifier = Modifier) {
        MovableElement(
            key = AmbientIndicationElementKey,
            modifier = modifier,
        ) {
            content {
                Box(
                    modifier = Modifier.fillMaxWidth().background(Color.Green),
                ) {
                    Text(
                        text = "TODO(b/316211368): Ambient indication",
                        color = Color.White,
                        modifier = Modifier.align(Alignment.Center),
                    )
/** Defines interface for classes that can render the ambient indication area. */
interface AmbientIndicationSection {
    @Composable fun SceneScope.AmbientIndication(modifier: Modifier)
}
            }
        }
    }
}

private val AmbientIndicationElementKey = ElementKey("AmbientIndication")
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.
 */

package com.android.systemui.keyguard.ui.composable.section

import dagger.BindsOptionalOf
import dagger.Module

/**
 * Dagger module for providing placeholders for optional lockscreen scene sections that don't exist
 * in AOSP but may be provided by OEMs.
 */
@Module
interface OptionalSectionModule {
    @BindsOptionalOf fun ambientIndicationSection(): AmbientIndicationSection
}