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

Commit 6995c933 authored by Chris Li's avatar Chris Li
Browse files

Revert "Cleanup TaskFragment remote animation"

This reverts commit db7f8334.

Reason for revert: Bringing back legacy transitions test for automotive 24Q4. Remove them after 24Q4.

Bug: 362992157
Bug: 339562797
Flag: EXEMPT
Test: atest CtsWindowManagerJetpackTestCases

Change-Id: I859d3ebe79464623f06ceec386d6aef21b99dfa5
parent 1973746c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -46,6 +46,19 @@ interface ITaskFragmentOrganizerController {
     */
    void unregisterOrganizer(in ITaskFragmentOrganizer organizer);

    /**
     * Registers remote animations per transition type for the organizer. It will override the
     * animations if the transition only contains windows that belong to the organized
     * TaskFragments in the given Task.
     */
    void registerRemoteAnimations(in ITaskFragmentOrganizer organizer,
        in RemoteAnimationDefinition definition);

    /**
     * Unregisters remote animations per transition type for the organizer.
     */
    void unregisterRemoteAnimations(in ITaskFragmentOrganizer organizer);

    /**
     * Saves the state in the system, where the state can be restored if the process of
     * the TaskFragmentOrganizer is restarted.
+29 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.app.Activity;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.RemoteAnimationDefinition;
import android.view.WindowManager;

import com.android.window.flags.Flags;
@@ -224,6 +225,34 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
        }
    }

    /**
     * Registers remote animations per transition type for the organizer. It will override the
     * animations if the transition only contains windows that belong to the organized
     * TaskFragments, and at least one of the transition window is embedded (not filling the Task).
     * @hide
     */
    @CallSuper
    public void registerRemoteAnimations(@NonNull RemoteAnimationDefinition definition) {
        try {
            getController().registerRemoteAnimations(mInterface, definition);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Unregisters remote animations per transition type for the organizer.
     * @hide
     */
    @CallSuper
    public void unregisterRemoteAnimations() {
        try {
            getController().unregisterRemoteAnimations(mInterface);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Saves the state in the system, where the state can be restored if the process of
     * the TaskFragmentOrganizer is restarted.
+23 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
    @NonNull
    private final TaskFragmentCallback mCallback;

    @VisibleForTesting
    @Nullable
    TaskFragmentAnimationController mAnimationController;

    /**
     * Callback that notifies the controller about changes to task fragments.
     */
@@ -87,6 +91,25 @@ class JetpackTaskFragmentOrganizer extends TaskFragmentOrganizer {
        mCallback = callback;
    }

    @Override
    public void unregisterOrganizer() {
        if (mAnimationController != null) {
            mAnimationController.unregisterRemoteAnimations();
            mAnimationController = null;
        }
        super.unregisterOrganizer();
    }

    /**
     * Overrides the animation for transitions of embedded activities organized by this organizer.
     */
    void overrideSplitAnimation() {
        if (mAnimationController == null) {
            mAnimationController = new TaskFragmentAnimationController(this);
        }
        mAnimationController.registerRemoteAnimations();
    }

    /**
     * Starts a new Activity and puts it into split with an existing Activity side-by-side.
     * @param launchingFragmentToken    token for the launching TaskFragment. If it exists, it will
+1 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ import java.util.function.BiConsumer;
public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmentCallback,
        ActivityEmbeddingComponent, DividerPresenter.DragEventCallback {
    static final String TAG = "SplitController";
    static final boolean ENABLE_SHELL_TRANSITIONS = true;

    // TODO(b/243518738): Move to WM Extensions if we have requirement of overlay without
    //  association. It's not set in WM Extensions nor Wm Jetpack library currently.
+5 −0
Original line number Diff line number Diff line
@@ -175,6 +175,11 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer {
            registerOrganizer();
        }
        mBackupHelper = new BackupHelper(controller, outSavedState);
        if (!SplitController.ENABLE_SHELL_TRANSITIONS) {
            // TODO(b/207070762): cleanup with legacy app transition
            // Animation will be handled by WM Shell when Shell transition is enabled.
            overrideSplitAnimation();
        }
    }

    void scheduleBackup() {
Loading