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

Commit 00653f6e authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Clean up aconfig flag return_animation_framework_long_lived." into main

parents 99526f01 01408c7d
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.ProtoLog;
import com.android.internal.util.LatencyTracker;
import com.android.internal.view.AppearanceRegion;
import com.android.systemui.animation.TransitionAnimator;
import com.android.window.flags.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.common.ExternalInterfaceBinder;
@@ -1312,9 +1311,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            }

            if (handlePrepareTransition(transition, info, st, ft, finishCallback)) {
                if (checkTakeoverFlags()) {
                mTakeoverHandler = mTransitions.getHandlerForTakeover(transition, info);
                }
                kickStartAnimation();
                return true;
            }
@@ -1322,20 +1319,12 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        }

        private boolean canHandOffAnimation() {
            if (!checkTakeoverFlags()) {
                return false;
            }

            return mTakeoverHandler != null;
        }

        private void handOffAnimation(
                RemoteAnimationTarget[] targets, WindowAnimationState[] states) {
            if (!checkTakeoverFlags()) {
                ProtoLog.e(WM_SHELL_BACK_PREVIEW,
                        "Trying to hand off the animation, but the required flags are disabled.");
                return;
            } else if (mTakeoverHandler == null) {
            if (mTakeoverHandler == null) {
                ProtoLog.e(WM_SHELL_BACK_PREVIEW,
                        "Missing takeover handler when trying to hand off animation.");
                return;
@@ -1766,10 +1755,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            }
            return null;
        }

        private static boolean checkTakeoverFlags() {
            return TransitionAnimator.Companion.longLivedReturnAnimationsEnabled();
        }
    }

    private static boolean isNotGestureBackTransition(@NonNull TransitionInfo info) {
+0 −6
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.wm.shell.transition;

import static com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.IBinder;
@@ -259,10 +257,6 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler {
    @Override
    public Transitions.TransitionHandler getHandlerForTakeover(
            @NonNull IBinder transition, @NonNull TransitionInfo info) {
        if (!returnAnimationFrameworkLongLived()) {
            return null;
        }

        for (Pair<TransitionFilter, RemoteTransition> registered : mTakeoverFilters) {
            if (registered.first.matches(info)) {
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
+0 −8
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_NO_ANIMATION;
import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT;

import static com.android.systemui.shared.Flags.returnAnimationFrameworkLongLived;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TRANSITIONS;
import static com.android.wm.shell.shared.TransitionUtil.FLAG_IS_DESKTOP_WALLPAPER_ACTIVITY;
import static com.android.wm.shell.shared.TransitionUtil.isClosingType;
@@ -90,7 +89,6 @@ import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.desktopmode.DesktopModeTransitionTypes;
import com.android.wm.shell.desktopmode.DesktopWallpaperActivity;
import com.android.wm.shell.keyguard.KeyguardTransitionHandler;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.shared.FocusTransitionListener;
import com.android.wm.shell.shared.IFocusTransitionListener;
import com.android.wm.shell.shared.IHomeTransitionListener;
@@ -1312,12 +1310,6 @@ public class Transitions implements RemoteCallable<Transitions>,
    @Nullable
    public TransitionHandler getHandlerForTakeover(
            @NonNull IBinder transition, @NonNull TransitionInfo info) {
        if (!returnAnimationFrameworkLongLived()) {
            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                    "Trying to get a handler for takeover but the flag is disabled");
            return null;
        }

        for (TransitionHandler handler : mHandlers) {
            TransitionHandler candidate = handler.getHandlerForTakeover(transition, info);
            if (candidate != null) {
+0 −2
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteCallback;
import android.os.RemoteException;
import android.platform.test.annotations.EnableFlags;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.view.IRemoteAnimationRunner;
@@ -556,7 +555,6 @@ public class BackAnimationControllerTest extends ShellTestCase {
        verify(mAnimatorCallback, never()).onBackInvoked();
    }

    @EnableFlags({com.android.systemui.shared.Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LONG_LIVED})
    @Test
    public void appCallback_receivesTakeoverHandler_whenAvailable() throws RemoteException {
        registerAnimation(BackNavigationInfo.TYPE_CROSS_TASK);
+0 −75
Original line number Diff line number Diff line
@@ -75,8 +75,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.util.ArraySet;
import android.util.Pair;
import android.view.Surface;
@@ -101,7 +99,6 @@ import androidx.test.platform.app.InstrumentationRegistry;

import com.android.internal.R;
import com.android.internal.policy.TransitionAnimation;
import com.android.systemui.shared.Flags;
import com.android.wm.shell.RootTaskDisplayAreaOrganizer;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.ShellTestCase;
@@ -556,78 +553,6 @@ public class ShellTransitionTests extends ShellTestCase {
    }

    @Test
    @DisableFlags(Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LONG_LIVED)
    public void testRegisteredRemoteTransitionTakeover_flagDisabled() {
        Transitions transitions = createTestTransitions();
        transitions.replaceDefaultHandlerForTest(mDefaultHandler);

        IRemoteTransition testRemote = new RemoteTransitionStub() {
            @Override
            public void startAnimation(IBinder token, TransitionInfo info,
                    SurfaceControl.Transaction t,
                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
                final Transitions.TransitionHandler takeoverHandler =
                        transitions.getHandlerForTakeover(token, info);

                if (takeoverHandler == null) {
                    finishCallback.onTransitionFinished(null /* wct */, null /* sct */);
                    return;
                }

                takeoverHandler.takeOverAnimation(token, info, new SurfaceControl.Transaction(),
                        wct -> {
                            try {
                                finishCallback.onTransitionFinished(wct, null /* sct */);
                            } catch (RemoteException e) {
                                // Fail
                            }
                        }, new WindowAnimationState[info.getChanges().size()]);
            }
        };
        final boolean[] takeoverRemoteCalled = new boolean[]{false};
        IRemoteTransition testTakeoverRemote = new RemoteTransitionStub() {
            @Override
            public void startAnimation(IBinder token, TransitionInfo info,
                    SurfaceControl.Transaction t,
                    IRemoteTransitionFinishedCallback finishCallback) {}

            @Override
            public void takeOverAnimation(IBinder transition, TransitionInfo info,
                    SurfaceControl.Transaction startTransaction,
                    IRemoteTransitionFinishedCallback finishCallback, WindowAnimationState[] states)
                    throws RemoteException {
                takeoverRemoteCalled[0] = true;
                finishCallback.onTransitionFinished(null /* wct */, null /* sct */);
            }
        };

        TransitionFilter filter = new TransitionFilter();
        filter.mRequirements =
                new TransitionFilter.Requirement[]{new TransitionFilter.Requirement()};
        filter.mRequirements[0].mModes = new int[]{TRANSIT_OPEN, TRANSIT_TO_FRONT};

        transitions.registerRemote(filter, new RemoteTransition(testRemote, "Test"));
        transitions.registerRemoteForTakeover(
                filter, new RemoteTransition(testTakeoverRemote, "Test"));
        mMainExecutor.flushAll();

        // Takeover shouldn't happen when the flag is disabled.
        IBinder transitToken = new Binder();
        transitions.requestStartTransition(transitToken,
                new TransitionRequestInfo(TRANSIT_OPEN, null /* trigger */, null /* remote */));
        TransitionInfo info = new TransitionInfoBuilder(TRANSIT_OPEN)
                .addChange(TRANSIT_OPEN).addChange(TRANSIT_CLOSE).build();
        transitions.onTransitionReady(transitToken, info, new StubTransaction(),
                new StubTransaction());
        assertEquals(0, mDefaultHandler.activeCount());
        assertFalse(takeoverRemoteCalled[0]);
        mDefaultHandler.finishAll();
        mMainExecutor.flushAll();
        verify(mOrganizer, times(1)).finishTransition(eq(transitToken), any());
    }

    @Test
    @EnableFlags(Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LONG_LIVED)
    public void testRegisteredRemoteTransitionTakeover_flagEnabled() {
        Transitions transitions = createTestTransitions();
        transitions.replaceDefaultHandlerForTest(mDefaultHandler);
Loading