Merge "WindowInsetsAnimation: Synchronously dispatch window insets animation callbacks" into rvc-dev am: f5a0f80fe2 am: bbec0bba6d am: 685b92c8fc

Change-Id: Iaa6958246e6c34728a6b9235fe07faecfe9fa601
This commit is contained in:
Adrian Roos
2020-04-02 14:44:52 +00:00
committed by Automerger Merge Worker
6 changed files with 9 additions and 7 deletions

View File

@@ -40,8 +40,10 @@ public interface InsetsAnimationControlCallbacks {
/**
* Schedule the apply by posting the animation callback.
*
* @param runner The runner that requested applying insets
*/
void scheduleApplyChangeInsets();
void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner);
/**
* Finish the final steps after the animation.

View File

@@ -156,7 +156,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
mPendingFraction = sanitize(fraction);
mPendingInsets = sanitize(insets);
mPendingAlpha = sanitize(alpha);
mController.scheduleApplyChangeInsets();
mController.scheduleApplyChangeInsets(this);
}
@VisibleForTesting

View File

@@ -54,7 +54,7 @@ public class InsetsAnimationThreadControlRunner implements InsetsAnimationContro
}
@Override
public void scheduleApplyChangeInsets() {
public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) {
mControl.applyChangeInsets(mState);
}

View File

@@ -1076,8 +1076,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
@VisibleForTesting
@Override
public void scheduleApplyChangeInsets() {
if (mStartingAnimation) {
public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) {
if (mStartingAnimation || runner.getAnimationType() == ANIMATION_TYPE_USER) {
mAnimCallback.run();
mAnimCallbackScheduled = false;
return;

View File

@@ -229,7 +229,7 @@ public class InsetsAnimationControlImplTest {
doAnswer(invocation -> {
mController.applyChangeInsets(mInsetsState);
return null;
}).when(mMockController).scheduleApplyChangeInsets();
}).when(mMockController).scheduleApplyChangeInsets(any());
mController.finish(true /* shown */);
assertEquals(Insets.of(0, 100, 100, 0), mController.getCurrentInsets());
verify(mMockController).notifyFinished(eq(mController), eq(true /* shown */));

View File

@@ -398,7 +398,7 @@ class InsetsPolicy {
/** Called on SurfaceAnimationThread without global WM lock held. */
@Override
public void scheduleApplyChangeInsets() {
public void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner) {
InsetsState state = getState();
if (mAnimationControl.applyChangeInsets(state)) {
mAnimationControl.finish(mAnimatingShown);