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

Commit ab58191c authored by Vadim Caen's avatar Vadim Caen
Browse files

DO NOT MERGE Only rely on developer option for back animation

BackNavigationController was still relying on a debug setting. Now the
animation request is handled via a boolean parameter passed by sysui,
which has access to the developer option.

Test: Existing test modified
Bug: 231502692
Change-Id: Icda4692e05396407d961610de0ce709492adadc1
Merged-In: Icda4692e05396407d961610de0ce709492adadc1
parent a3f6dae9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ interface IActivityTaskManager {
    /**
     * Prepare the back navigation in the server. This setups the leashed for sysui to animate
     * the back gesture and returns the data needed for the animation.
     * @param requestAnimation true if the caller wishes to animate the back navigation
     */
    android.window.BackNavigationInfo startBackNavigation();
    android.window.BackNavigationInfo startBackNavigation(in boolean requestAnimation);
}
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ public class BackNavigationTest {
    private void assertCallbackIsCalled(CountDownLatch latch) {
        try {
            mInstrumentation.getUiAutomation().waitForIdle(500, 1000);
            BackNavigationInfo info = ActivityTaskManager.getService().startBackNavigation();
            BackNavigationInfo info = ActivityTaskManager.getService().startBackNavigation(true);
            assertNotNull("BackNavigationInfo is null", info);
            assertNotNull("OnBackInvokedCallback is null", info.getOnBackInvokedCallback());
            info.getOnBackInvokedCallback().onBackInvoked();
+2 −1
Original line number Diff line number Diff line
@@ -272,7 +272,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        mBackGestureStarted = true;

        try {
            mBackNavigationInfo = mActivityTaskManager.startBackNavigation();
            boolean requestAnimation = mEnableAnimations.get();
            mBackNavigationInfo = mActivityTaskManager.startBackNavigation(requestAnimation);
            onBackNavigationInfoReceived(mBackNavigationInfo);
        } catch (RemoteException remoteException) {
            Log.e(TAG, "Failed to initAnimation", remoteException);
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.window.BackNavigationInfo.KEY_TRIGGER_BACK;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.atLeastOnce;
@@ -126,7 +127,7 @@ public class BackAnimationControllerTest {
                new RemoteCallback((bundle) -> {}),
                onBackInvokedCallback);
        try {
            doReturn(navigationInfo).when(mActivityTaskManager).startBackNavigation();
            doReturn(navigationInfo).when(mActivityTaskManager).startBackNavigation(anyBoolean());
        } catch (RemoteException ex) {
            ex.rethrowFromSystemServer();
        }
@@ -134,7 +135,7 @@ public class BackAnimationControllerTest {

    private void createNavigationInfo(BackNavigationInfo.Builder builder) {
        try {
            doReturn(builder.build()).when(mActivityTaskManager).startBackNavigation();
            doReturn(builder.build()).when(mActivityTaskManager).startBackNavigation(anyBoolean());
        } catch (RemoteException ex) {
            ex.rethrowFromSystemServer();
        }
+2 −2
Original line number Diff line number Diff line
@@ -1789,13 +1789,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    }

    @Override
    public BackNavigationInfo startBackNavigation() {
    public BackNavigationInfo startBackNavigation(boolean requestAnimation) {
        mAmInternal.enforceCallingPermission(START_TASKS_FROM_RECENTS,
                "startBackNavigation()");
        if (mBackNavigationController == null) {
            return null;
        }
        return mBackNavigationController.startBackNavigation(mWindowManager);
        return mBackNavigationController.startBackNavigation(mWindowManager, requestAnimation);
    }

    /**
Loading