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

Commit 553b386d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add VerticalContainerRevealFlag to disable MM animations" into main

parents 1194725e 2f19d7a9
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.compose.animation.scene.mechanics
object VerticalContainerRevealFlag {
    // TODO(b/435138055) Remove once perf issues are addressed
    const val isEnabled: Boolean = false
}
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.compose.animation.scene.UserActionDistance
import com.android.compose.animation.scene.content.state.TransitionState
import com.android.compose.animation.scene.mechanics.MotionValueInput
import com.android.compose.animation.scene.mechanics.TransitionScopedMechanicsAdapter
import com.android.compose.animation.scene.mechanics.VerticalContainerRevealFlag
import com.android.compose.animation.scene.transformation.CustomPropertyTransformation
import com.android.compose.animation.scene.transformation.PropertyTransformation
import com.android.compose.animation.scene.transformation.PropertyTransformationScope
@@ -74,6 +75,11 @@ fun TransitionBuilder.verticalContainerReveal(
        (targetSizeInToContent?.height ?: targetSizeInFromContent?.height)?.toFloat() ?: 0f
    }

    if (!VerticalContainerRevealFlag.isEnabled) {
        scaleSize(container, height = 0f)
        return
    }

    // TODO(b/392534646) Add haptics back
    val heightInput: MotionValueInput = { progress, content, element ->
        val idleSize = checkNotNull(element.targetSize(content))
+8 −0
Original line number Diff line number Diff line
@@ -45,11 +45,14 @@ import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneTransitionLayoutForTesting
import com.android.compose.animation.scene.Swipe
import com.android.compose.animation.scene.featureOfElement
import com.android.compose.animation.scene.mechanics.VerticalContainerRevealFlag
import com.android.compose.animation.scene.transitions
import com.android.mechanics.behavior.VerticalExpandContainerSpec
import com.android.mechanics.behavior.verticalExpandContainerBackground
import kotlin.math.sin
import kotlinx.coroutines.CoroutineScope
import org.junit.Assume
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -90,6 +93,11 @@ class ContentRevealTest(private val isFloating: Boolean) {

    private val motionSpec = VerticalExpandContainerSpec(isFloating)

    @Before
    fun setUp() {
        Assume.assumeTrue(VerticalContainerRevealFlag.isEnabled)
    }

    @Test
    fun verticalReveal_triggeredRevealOpenTransition() {
        assertVerticalContainerRevealMotion(