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

Commit 6de15e59 authored by Nick Chameyev's avatar Nick Chameyev Committed by Android (Google) Code Review
Browse files

Merge "Support hinge angle sensor in unfold animation" into sc-v2-dev

parents eb0b3a89 8c88a0c3
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -660,6 +660,9 @@
    <!-- Indicates whether to enable an animation when unfolding a device or not -->
    <!-- Indicates whether to enable an animation when unfolding a device or not -->
    <bool name="config_unfoldTransitionEnabled">false</bool>
    <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
    <!-- 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
         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
         set to false, DisplayManager will make additional effort to ensure no more than 1 internal
+1 −0
Original line number Original line Diff line number Diff line
@@ -3842,6 +3842,7 @@
  <java-symbol type="string" name="config_foldedArea" />
  <java-symbol type="string" name="config_foldedArea" />
  <java-symbol type="bool" name="config_supportsConcurrentInternalDisplays" />
  <java-symbol type="bool" name="config_supportsConcurrentInternalDisplays" />
  <java-symbol type="bool" name="config_unfoldTransitionEnabled" />
  <java-symbol type="bool" name="config_unfoldTransitionEnabled" />
  <java-symbol type="bool" name="config_unfoldTransitionHingeAngle" />
  <java-symbol type="array" name="config_perDeviceStateRotationLockDefaults" />
  <java-symbol type="array" name="config_perDeviceStateRotationLockDefaults" />




+8 −1
Original line number Original line 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.progress.PhysicsBasedUnfoldTransitionProgressProvider
import com.android.systemui.unfold.updates.DeviceFoldStateProvider
import com.android.systemui.unfold.updates.DeviceFoldStateProvider
import com.android.systemui.unfold.updates.hinge.EmptyHingeAngleProvider
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 com.android.systemui.unfold.updates.hinge.RotationSensorHingeAngleProvider
import java.lang.IllegalStateException
import java.lang.IllegalStateException
import java.util.concurrent.Executor
import java.util.concurrent.Executor
@@ -50,7 +51,13 @@ fun createUnfoldTransitionProgressProvider(


    val hingeAngleProvider =
    val hingeAngleProvider =
        if (config.mode == ANIMATION_MODE_HINGE_ANGLE) {
        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)
                RotationSensorHingeAngleProvider(sensorManager)
            }
        } else {
        } else {
            EmptyHingeAngleProvider()
            EmptyHingeAngleProvider()
        }
        }
+6 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,9 @@ internal class ResourceUnfoldTransitionConfig(
    override val isEnabled: Boolean
    override val isEnabled: Boolean
        get() = readIsEnabled() && mode != ANIMATION_MODE_DISABLED
        get() = readIsEnabled() && mode != ANIMATION_MODE_DISABLED


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

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


    private fun readIsEnabled(): Boolean = context.resources
    private fun readIsEnabled(): Boolean = context.resources
        .getBoolean(com.android.internal.R.bool.config_unfoldTransitionEnabled)
        .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 Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import android.annotation.IntDef


interface UnfoldTransitionConfig {
interface UnfoldTransitionConfig {
    val isEnabled: Boolean
    val isEnabled: Boolean
    val isHingeAngleEnabled: Boolean


    @AnimationMode
    @AnimationMode
    val mode: Int
    val mode: Int
Loading