Merge "Dispatch animation callbacks by default." into udc-dev

This commit is contained in:
Shan Huang
2023-03-28 23:21:09 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 18 deletions

View File

@@ -384,8 +384,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
}
private void onMove() {
if (!mBackGestureStarted || mBackNavigationInfo == null || !mEnableAnimations.get()
|| mActiveCallback == null) {
if (!mBackGestureStarted || mBackNavigationInfo == null || mActiveCallback == null) {
return;
}
@@ -424,9 +423,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
return;
}
try {
if (mEnableAnimations.get()) {
callback.onBackStarted(backEvent);
}
callback.onBackStarted(backEvent);
} catch (RemoteException e) {
Log.e(TAG, "dispatchOnBackStarted error: ", e);
}
@@ -448,9 +445,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
return;
}
try {
if (mEnableAnimations.get()) {
callback.onBackCancelled();
}
callback.onBackCancelled();
} catch (RemoteException e) {
Log.e(TAG, "dispatchOnBackCancelled error: ", e);
}
@@ -462,19 +457,12 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
return;
}
try {
if (mEnableAnimations.get()) {
callback.onBackProgressed(backEvent);
}
callback.onBackProgressed(backEvent);
} catch (RemoteException e) {
Log.e(TAG, "dispatchOnBackProgressed error: ", e);
}
}
private boolean shouldDispatchAnimation(IOnBackInvokedCallback callback) {
// TODO(b/258698745): Only dispatch to animation callbacks.
return mEnableAnimations.get();
}
/**
* Sets to true when the back gesture has passed the triggering threshold, false otherwise.
*/

View File

@@ -253,8 +253,6 @@ public class BackAnimationControllerTest extends ShellTestCase {
triggerBackGesture();
verify(mAppCallback, never()).onBackStarted(any());
verify(mAppCallback, never()).onBackProgressed(backEventCaptor.capture());
verify(mAppCallback, times(1)).onBackInvoked();
verify(mAnimatorCallback, never()).onBackStarted(any());