Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c21fcf2 authored by Shan Huang's avatar Shan Huang
Browse files

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
parent 50936086
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -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);
            }
        } 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();
            }
        } 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);
            }
        } 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.
     */
+0 −2
Original line number Diff line number Diff line
@@ -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());