Dispatch animation callbacks by default.

Bug: 269781808
Test: atest OnBackInvokedCallbackGestureTest
Test: Make sure opted-in apps receive progress events even when dev
option is off

Change-Id: I4536af7a5606012639bcd6d70e0ccdd7c945fda1
This commit is contained in:
Shan Huang
2023-03-10 14:23:14 -08:00
parent 5093608689
commit 1c21fcf248
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());