Skip to content
Snippets Groups Projects
Commit 42066935 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24802168']...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24802168'] into sparse-10845727-L01900000963173133.
SPARSE_CHANGE: Iaa019d6d0aabdf97af0cb6995ad81270f275f3e7

Change-Id: If5e1447149aad7edee124417932df144c7240872
parents 5927619e 652b1c70
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ import android.graphics.Path ...@@ -25,6 +25,7 @@ import android.graphics.Path
import android.graphics.Rect import android.graphics.Rect
import android.graphics.RectF import android.graphics.RectF
import android.os.Build import android.os.Build
import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.RemoteException import android.os.RemoteException
import android.util.Log import android.util.Log
...@@ -58,7 +59,14 @@ class ActivityLaunchAnimator( ...@@ -58,7 +59,14 @@ class ActivityLaunchAnimator(
/** The animator used when animating a Dialog into an app. */ /** The animator used when animating a Dialog into an app. */
// TODO(b/218989950): Remove this animator and instead set the duration of the dim fade out to // TODO(b/218989950): Remove this animator and instead set the duration of the dim fade out to
// TIMINGS.contentBeforeFadeOutDuration. // TIMINGS.contentBeforeFadeOutDuration.
private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR private val dialogToAppAnimator: LaunchAnimator = DEFAULT_DIALOG_TO_APP_ANIMATOR,
/**
* Whether we should disable the WindowManager timeout. This should be set to true in tests
* only.
*/
// TODO(b/301385865): Remove this flag.
private val disableWmTimeout: Boolean = false,
) { ) {
companion object { companion object {
/** The timings when animating a View into an app. */ /** The timings when animating a View into an app. */
...@@ -252,7 +260,7 @@ class ActivityLaunchAnimator( ...@@ -252,7 +260,7 @@ class ActivityLaunchAnimator(
Log.d( Log.d(
TAG, TAG,
"Calling controller.onIntentStarted(willAnimate=$willAnimate) " + "Calling controller.onIntentStarted(willAnimate=$willAnimate) " +
"[controller=$this]" "[controller=$this]"
) )
} }
this.onIntentStarted(willAnimate) this.onIntentStarted(willAnimate)
...@@ -431,7 +439,8 @@ class ActivityLaunchAnimator( ...@@ -431,7 +439,8 @@ class ActivityLaunchAnimator(
internal val delegate: AnimationDelegate internal val delegate: AnimationDelegate
init { init {
delegate = AnimationDelegate(controller, callback, listener, launchAnimator) delegate =
AnimationDelegate(controller, callback, listener, launchAnimator, disableWmTimeout)
} }
@BinderThread @BinderThread
...@@ -461,13 +470,26 @@ class ActivityLaunchAnimator( ...@@ -461,13 +470,26 @@ class ActivityLaunchAnimator(
/** Listener for animation lifecycle events. */ /** Listener for animation lifecycle events. */
private val listener: Listener? = null, private val listener: Listener? = null,
/** The animator to use to animate the window launch. */ /** The animator to use to animate the window launch. */
private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR private val launchAnimator: LaunchAnimator = DEFAULT_LAUNCH_ANIMATOR,
/**
* Whether we should disable the WindowManager timeout. This should be set to true in tests
* only.
*/
// TODO(b/301385865): Remove this flag.
disableWmTimeout: Boolean = false,
) : RemoteAnimationDelegate<IRemoteAnimationFinishedCallback> { ) : RemoteAnimationDelegate<IRemoteAnimationFinishedCallback> {
private val launchContainer = controller.launchContainer private val launchContainer = controller.launchContainer
private val context = launchContainer.context private val context = launchContainer.context
private val transactionApplierView = private val transactionApplierView =
controller.openingWindowSyncView ?: controller.launchContainer controller.openingWindowSyncView ?: controller.launchContainer
private val transactionApplier = SyncRtSurfaceTransactionApplier(transactionApplierView) private val transactionApplier = SyncRtSurfaceTransactionApplier(transactionApplierView)
private val timeoutHandler =
if (!disableWmTimeout) {
Handler(Looper.getMainLooper())
} else {
null
}
private val matrix = Matrix() private val matrix = Matrix()
private val invertMatrix = Matrix() private val invertMatrix = Matrix()
...@@ -487,11 +509,11 @@ class ActivityLaunchAnimator( ...@@ -487,11 +509,11 @@ class ActivityLaunchAnimator(
@UiThread @UiThread
internal fun postTimeout() { internal fun postTimeout() {
launchContainer.postDelayed(onTimeout, LAUNCH_TIMEOUT) timeoutHandler?.postDelayed(onTimeout, LAUNCH_TIMEOUT)
} }
private fun removeTimeout() { private fun removeTimeout() {
launchContainer.removeCallbacks(onTimeout) timeoutHandler?.removeCallbacks(onTimeout)
} }
@UiThread @UiThread
......
...@@ -57,7 +57,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() { ...@@ -57,7 +57,8 @@ class ActivityLaunchAnimatorTest : SysuiTestCase() {
@Before @Before
fun setup() { fun setup() {
activityLaunchAnimator = ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator) activityLaunchAnimator =
ActivityLaunchAnimator(testLaunchAnimator, testLaunchAnimator, disableWmTimeout = true)
activityLaunchAnimator.callback = callback activityLaunchAnimator.callback = callback
activityLaunchAnimator.addListener(listener) activityLaunchAnimator.addListener(listener)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment