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

Commit c798c9cb authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] LockscreenSceneLayout

A Compose slot-based smart layout for the lockscreen scene. It handles
the measurement and positioning of all of the elements on the lockscreen
scene based on the current form factor, folding posture, orientation,
etc.

Bug: 395060439
Bug: 405383415
Bug: 396218588
Bug: 396202921
Bug: 384077475
Bug: 394875986
Bug: 405366494
Bug: 390988286
Test: verified in testbed app and with followup CL(s) on this chain
Flag: com.android.systemui.scene_container
Change-Id: I2b7e0c1d2b5ddf4f335a990d13a72f88237292e0
parent 2b81818d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import com.android.systemui.communal.ui.compose.section.CommunalPopupSection
import com.android.systemui.communal.ui.compose.section.HubOnboardingSection
import com.android.systemui.communal.ui.view.layout.sections.CommunalAppWidgetSection
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.keyguard.ui.composable.blueprint.BlueprintAlignmentLines
import com.android.systemui.keyguard.ui.composable.layout.LockIconAlignmentLines
import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection
import com.android.systemui.keyguard.ui.composable.section.LockSection
import com.android.systemui.statusbar.phone.SystemUIDialogFactory
@@ -138,10 +138,10 @@ constructor(
                        )
                    } else {
                        IntRect(
                            left = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Left],
                            top = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Top],
                            right = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Right],
                            bottom = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Bottom],
                            left = lockIconPlaceable[LockIconAlignmentLines.Left],
                            top = lockIconPlaceable[LockIconAlignmentLines.Top],
                            right = lockIconPlaceable[LockIconAlignmentLines.Right],
                            bottom = lockIconPlaceable[LockIconAlignmentLines.Bottom],
                        )
                    }

+5 −5
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import com.android.systemui.communal.ui.viewmodel.CommunalLockIconViewModel
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.ui.composable.blueprint.BlueprintAlignmentLines
import com.android.systemui.keyguard.ui.composable.layout.LockIconAlignmentLines
import com.android.systemui.keyguard.ui.view.DeviceEntryIconView
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.TouchHandlingViewLogger
@@ -96,10 +96,10 @@ constructor(
                        height = placeable.height,
                        alignmentLines =
                            mapOf(
                                BlueprintAlignmentLines.LockIcon.Left to lockIconBounds.left,
                                BlueprintAlignmentLines.LockIcon.Top to lockIconBounds.top,
                                BlueprintAlignmentLines.LockIcon.Right to lockIconBounds.right,
                                BlueprintAlignmentLines.LockIcon.Bottom to lockIconBounds.bottom,
                                LockIconAlignmentLines.Left to lockIconBounds.left,
                                LockIconAlignmentLines.Top to lockIconBounds.top,
                                LockIconAlignmentLines.Right to lockIconBounds.right,
                                LockIconAlignmentLines.Bottom to lockIconBounds.bottom,
                            ),
                    ) {
                        placeable.place(0, 0)
+0 −81
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.blueprint

import androidx.compose.ui.layout.HorizontalAlignmentLine
import androidx.compose.ui.layout.VerticalAlignmentLine
import kotlin.math.max
import kotlin.math.min

/**
 * Encapsulates all blueprint alignment lines.
 *
 * These can be used to communicate alignment lines emitted by elements that the blueprint should
 * consume and use to know how to constrain and/or place other elements in that blueprint.
 *
 * For more information, please see
 * [the official documentation](https://developer.android.com/jetpack/compose/layouts/alignment-lines).
 */
object BlueprintAlignmentLines {

    /**
     * Encapsulates alignment lines produced by the lock icon element.
     *
     * Because the lock icon is also the same element as the under-display fingerprint sensor
     * (UDFPS), blueprints should use its alignment lines to make sure that other elements on screen
     * do not overlap with the lock icon.
     */
    object LockIcon {

        /** The left edge of the lock icon. */
        val Left =
            VerticalAlignmentLine(
                merger = { old, new ->
                    // When two left alignment line values are provided, choose the leftmost one:
                    min(old, new)
                },
            )

        /** The top edge of the lock icon. */
        val Top =
            HorizontalAlignmentLine(
                merger = { old, new ->
                    // When two top alignment line values are provided, choose the topmost one:
                    min(old, new)
                },
            )

        /** The right edge of the lock icon. */
        val Right =
            VerticalAlignmentLine(
                merger = { old, new ->
                    // When two right alignment line values are provided, choose the rightmost one:
                    max(old, new)
                },
            )

        /** The bottom edge of the lock icon. */
        val Bottom =
            HorizontalAlignmentLine(
                merger = { old, new ->
                    // When two bottom alignment line values are provided, choose the bottommost
                    // one:
                    max(old, new)
                },
            )
    }
}
+5 −4
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.compose.animation.scene.ContentScope
import com.android.compose.modifiers.padding
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.keyguard.ui.composable.LockscreenTouchHandling
import com.android.systemui.keyguard.ui.composable.layout.LockIconAlignmentLines
import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection
import com.android.systemui.keyguard.ui.composable.section.BottomAreaSection
import com.android.systemui.keyguard.ui.composable.section.LockSection
@@ -233,10 +234,10 @@ constructor(
                val lockIconPlaceable = lockIconMeasurable.measure(noMinConstraints)
                val lockIconBounds =
                    IntRect(
                        left = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Left],
                        top = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Top],
                        right = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Right],
                        bottom = lockIconPlaceable[BlueprintAlignmentLines.LockIcon.Bottom],
                        left = lockIconPlaceable[LockIconAlignmentLines.Left],
                        top = lockIconPlaceable[LockIconAlignmentLines.Top],
                        right = lockIconPlaceable[LockIconAlignmentLines.Right],
                        bottom = lockIconPlaceable[LockIconAlignmentLines.Bottom],
                    )

                val aboveLockIconPlaceable =
+553 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading