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

Commit 385b03d8 authored by Nick Chameyev's avatar Nick Chameyev Committed by Automerger Merge Worker
Browse files

Merge "Support hinge angle sensor in unfold animation" into sc-v2-dev am: 6de15e59 am: d1147f9e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15638990

Change-Id: I9d3e30401d9e05a5285b53f1f36aa9c6d633683c
parents 5b53d12d d1147f9e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -660,6 +660,9 @@
    <!-- Indicates whether to enable an animation when unfolding a device or not -->
    <bool name="config_unfoldTransitionEnabled">false</bool>

    <!-- Indicates whether to enable hinge angle sensor when using unfold animation -->
    <bool name="config_unfoldTransitionHingeAngle">false</bool>

    <!-- Indicates that the device supports having more than one internal display on at the same
         time. Only applicable to devices with more than one internal display. If this option is
         set to false, DisplayManager will make additional effort to ensure no more than 1 internal
+1 −0
Original line number Diff line number Diff line
@@ -3844,6 +3844,7 @@
  <java-symbol type="string" name="config_foldedArea" />
  <java-symbol type="bool" name="config_supportsConcurrentInternalDisplays" />
  <java-symbol type="bool" name="config_unfoldTransitionEnabled" />
  <java-symbol type="bool" name="config_unfoldTransitionHingeAngle" />
  <java-symbol type="array" name="config_perDeviceStateRotationLockDefaults" />


+8 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.unfold.progress.FixedTimingTransitionProgressProvide
import com.android.systemui.unfold.progress.PhysicsBasedUnfoldTransitionProgressProvider
import com.android.systemui.unfold.updates.DeviceFoldStateProvider
import com.android.systemui.unfold.updates.hinge.EmptyHingeAngleProvider
import com.android.systemui.unfold.updates.hinge.HingeSensorAngleProvider
import com.android.systemui.unfold.updates.hinge.RotationSensorHingeAngleProvider
import java.lang.IllegalStateException
import java.util.concurrent.Executor
@@ -50,7 +51,13 @@ fun createUnfoldTransitionProgressProvider(

    val hingeAngleProvider =
        if (config.mode == ANIMATION_MODE_HINGE_ANGLE) {
            // TODO: after removing temporary "config.mode" we should just
            //       switch between fixed timing and hinge sensor based on this flag
            if (config.isHingeAngleEnabled) {
                HingeSensorAngleProvider(sensorManager)
            } else {
                RotationSensorHingeAngleProvider(sensorManager)
            }
        } else {
            EmptyHingeAngleProvider()
        }
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ internal class ResourceUnfoldTransitionConfig(
    override val isEnabled: Boolean
        get() = readIsEnabled() && mode != ANIMATION_MODE_DISABLED

    override val isHingeAngleEnabled: Boolean
        get() = readIsHingeAngleEnabled()

    @AnimationMode
    override val mode: Int
        get() = SystemProperties.getInt(UNFOLD_TRANSITION_MODE_PROPERTY_NAME,
@@ -32,6 +35,9 @@ internal class ResourceUnfoldTransitionConfig(

    private fun readIsEnabled(): Boolean = context.resources
        .getBoolean(com.android.internal.R.bool.config_unfoldTransitionEnabled)

    private fun readIsHingeAngleEnabled(): Boolean = context.resources
        .getBoolean(com.android.internal.R.bool.config_unfoldTransitionHingeAngle)
}

/**
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.annotation.IntDef

interface UnfoldTransitionConfig {
    val isEnabled: Boolean
    val isHingeAngleEnabled: Boolean

    @AnimationMode
    val mode: Int
Loading