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

Commit 3242e767 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Large clock not clipping away

Fixes layout and clipping issue that was causing the step animation that
pushes the clock digits to the left to make the clock invisible.

Two parts:
a. Let the clock composable be as wide as its parent composable, don't
2x shrink it anymore, the step animation will take care shifting the
digits off to the left when notifications are shown
b. Disable clipping in the AndroidView-wrapped View hierarchy of the
large clock

Two additional bugs were discovered while fixing this one:
1. On tablet in portrait mode, the clock is cut off. See b/384077475
2. The step animation works well when animating from left to right but
   "jumps" when animating from the center to the left. See b/384082024

Fix: 370045350
Test: manually verified on tablet that the large clock is visible with
and without a notification and correctly "step animates" depending on
the notifications being there or not
Test: manually verified the same on an unfolded foldable
Flag: com.android.systemui.scene_container

Change-Id: Ic616fb73fbfe727183e40f4dc899c614c974045a
parent f40858f2
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import androidx.compose.ui.unit.IntRect
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.SceneScope
import com.android.compose.modifiers.padding
import com.android.compose.modifiers.thenIf
import com.android.systemui.compose.modifiers.sysuiResTag
import com.android.systemui.keyguard.ui.composable.LockscreenLongPress
import com.android.systemui.keyguard.ui.composable.section.AmbientIndicationSection
@@ -97,16 +96,13 @@ constructor(
                            )
                        }

                        Box {
                        Box(modifier = Modifier.fillMaxWidth()) {
                            with(topAreaSection) {
                                DefaultClockLayout(
                                    smartSpacePaddingTop = viewModel::getSmartSpacePaddingTop,
                                    isShadeLayoutWide = isShadeLayoutWide,
                                    modifier =
                                        Modifier.thenIf(isShadeLayoutWide) {
                                                Modifier.fillMaxWidth(0.5f)
                                            }
                                            .graphicsLayer {
                                        Modifier.fillMaxWidth().graphicsLayer {
                                            translationX = unfoldTranslations.start
                                        },
                                )
+14 −10
Original line number Diff line number Diff line
@@ -81,10 +81,7 @@ constructor(
                    .padding(horizontal = dimensionResource(R.dimen.clock_padding_start))
                    .padding(top = { smallTopMargin })
                    .onTopPlacementChanged(onTopChanged)
                    .burnInAware(
                        viewModel = aodBurnInViewModel,
                        params = burnInParams,
                    )
                    .burnInAware(viewModel = aodBurnInViewModel, params = burnInParams)
                    .element(smallClockElementKey),
        )
    }
@@ -114,10 +111,7 @@ constructor(
            val dir = if (transition.toContent == splitShadeLargeClockScene) -1f else 1f
            val distance = dir * getClockCenteringDistance()
            val largeClock = checkNotNull(currentClock).largeClock
            largeClock.animations.onPositionUpdated(
                distance = distance,
                fraction = progress,
            )
            largeClock.animations.onPositionUpdated(distance = distance, fraction = progress)
        }

        Element(key = largeClockElementKey, modifier = modifier) {
@@ -125,6 +119,16 @@ constructor(
                AndroidView(
                    factory = { context ->
                        FrameLayout(context).apply {
                            // By default, ViewGroups like FrameLayout clip their children. Turning
                            // off the clipping allows the child view to render outside of its
                            // bounds - letting the step animation of the clock push the digits out
                            // when needed.
                            //
                            // Note that, in Compose, clipping is actually disabled by default so
                            // there's no need to propagate this up the composable hierarchy.
                            clipChildren = false
                            clipToPadding = false

                            ensureClockViewExists(checkNotNull(currentClock).largeClock.view)
                        }
                    },
@@ -136,8 +140,8 @@ constructor(
                            .burnInAware(
                                viewModel = aodBurnInViewModel,
                                params = burnInParams,
                                isClock = true
                            )
                                isClock = true,
                            ),
                )
            }
        }