Merge "Make unfold timeout configurable in resources" into tm-dev am: 915970e486
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17539068 Change-Id: Idab20b0e78ee0030ea419d4fef26fce091165125 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -674,6 +674,10 @@
|
|||||||
<!-- Indicates whether to enable hinge angle sensor when using unfold animation -->
|
<!-- Indicates whether to enable hinge angle sensor when using unfold animation -->
|
||||||
<bool name="config_unfoldTransitionHingeAngle">false</bool>
|
<bool name="config_unfoldTransitionHingeAngle">false</bool>
|
||||||
|
|
||||||
|
<!-- Indicates the time needed to time out the fold animation if the device stops in half folded
|
||||||
|
mode. -->
|
||||||
|
<integer name="config_unfoldTransitionHalfFoldedTimeout">600</integer>
|
||||||
|
|
||||||
<!-- 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
|
||||||
|
|||||||
@@ -3957,6 +3957,7 @@
|
|||||||
<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="bool" name="config_unfoldTransitionHingeAngle" />
|
||||||
|
<java-symbol type="integer" name="config_unfoldTransitionHalfFoldedTimeout" />
|
||||||
<java-symbol type="array" name="config_perDeviceStateRotationLockDefaults" />
|
<java-symbol type="array" name="config_perDeviceStateRotationLockDefaults" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,15 @@ constructor(
|
|||||||
private val foldStateListener = FoldStateListener(context)
|
private val foldStateListener = FoldStateListener(context)
|
||||||
private val timeoutRunnable = TimeoutRunnable()
|
private val timeoutRunnable = TimeoutRunnable()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time after which [FOLD_UPDATE_FINISH_HALF_OPEN] is emitted following a
|
||||||
|
* [FOLD_UPDATE_START_CLOSING] or [FOLD_UPDATE_START_OPENING] event, if an end state is not
|
||||||
|
* reached.
|
||||||
|
*/
|
||||||
|
private val halfOpenedTimeoutMillis: Int =
|
||||||
|
context.resources.getInteger(
|
||||||
|
com.android.internal.R.integer.config_unfoldTransitionHalfFoldedTimeout)
|
||||||
|
|
||||||
private var isFolded = false
|
private var isFolded = false
|
||||||
private var isUnfoldHandled = true
|
private var isUnfoldHandled = true
|
||||||
|
|
||||||
@@ -171,7 +180,7 @@ constructor(
|
|||||||
if (isTransitionInProgess) {
|
if (isTransitionInProgess) {
|
||||||
cancelTimeout()
|
cancelTimeout()
|
||||||
}
|
}
|
||||||
handler.postDelayed(timeoutRunnable, HALF_OPENED_TIMEOUT_MILLIS)
|
handler.postDelayed(timeoutRunnable, halfOpenedTimeoutMillis.toLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cancelTimeout() {
|
private fun cancelTimeout() {
|
||||||
@@ -222,12 +231,6 @@ private fun stateToString(@FoldUpdate update: Int): String {
|
|||||||
private const val TAG = "DeviceFoldProvider"
|
private const val TAG = "DeviceFoldProvider"
|
||||||
private const val DEBUG = false
|
private const val DEBUG = false
|
||||||
|
|
||||||
/**
|
|
||||||
* Time after which [FOLD_UPDATE_FINISH_HALF_OPEN] is emitted following a
|
|
||||||
* [FOLD_UPDATE_START_CLOSING] or [FOLD_UPDATE_START_OPENING] event, if an end state is not reached.
|
|
||||||
*/
|
|
||||||
@VisibleForTesting const val HALF_OPENED_TIMEOUT_MILLIS = 600L
|
|
||||||
|
|
||||||
/** Threshold after which we consider the device fully unfolded. */
|
/** Threshold after which we consider the device fully unfolded. */
|
||||||
@VisibleForTesting const val FULLY_OPEN_THRESHOLD_DEGREES = 15f
|
@VisibleForTesting const val FULLY_OPEN_THRESHOLD_DEGREES = 15f
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ class DeviceFoldStateProviderTest : SysuiTestCase() {
|
|||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
|
overrideResource(
|
||||||
|
com.android.internal.R.integer.config_unfoldTransitionHalfFoldedTimeout,
|
||||||
|
HALF_OPENED_TIMEOUT_MILLIS.toInt())
|
||||||
deviceStates = FoldableTestUtils.findDeviceStates(context)
|
deviceStates = FoldableTestUtils.findDeviceStates(context)
|
||||||
|
|
||||||
foldStateProvider =
|
foldStateProvider =
|
||||||
@@ -319,4 +322,8 @@ class DeviceFoldStateProviderTest : SysuiTestCase() {
|
|||||||
private fun sendHingeAngleEvent(angle: Int) {
|
private fun sendHingeAngleEvent(angle: Int) {
|
||||||
hingeAngleCaptor.value.accept(angle.toFloat())
|
hingeAngleCaptor.value.accept(angle.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val HALF_OPENED_TIMEOUT_MILLIS = 300L
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user