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

Commit 17b6a393 authored by Evan Rosky's avatar Evan Rosky
Browse files

Hooks for interracting with stage split components using legacy recentsanimation

Recents is pretty complicated, so the best way to deal with this is to
have launcher notify/query shell when entering recents. This gives
shell a chance to prepare and then provide relevant leashes (for now
just the bar, but it may include others in the future like side-
outline).

Bug: 192292305
Test: Enable SPLIT_SELECT and go to recents from split.
Change-Id: Iff6b14a1b0b95f207bdaa341c62fc6582659e923
parent 5ca3820a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -90,4 +90,11 @@ interface ISplitScreen {
     oneway void startTasksWithLegacyTransition(int mainTaskId, in Bundle mainOptions,
                            int sideTaskId, in Bundle sideOptions, int sidePosition,
                            in RemoteAnimationAdapter adapter) = 11;

    /**
     * Blocking call that notifies and gets additional split-screen targets when entering
     * recents (for example: the dividerBar).
     * @param cancel is true if leaving recents back to split (eg. the gesture was cancelled).
     */
    RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) = 12;
}
+15 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Slog;
import android.view.RemoteAnimationAdapter;
import android.view.RemoteAnimationTarget;
import android.window.IRemoteTransition;

import androidx.annotation.BinderThread;
@@ -267,6 +268,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
        return options;
    }

    RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) {
        if (!isSplitScreenVisible()) return null;
        return new RemoteAnimationTarget[]{mStageCoordinator.getDividerBarLegacyTarget()};
    }

    public void dump(@NonNull PrintWriter pw, String prefix) {
        pw.println(prefix + TAG);
        if (mStageCoordinator != null) {
@@ -466,5 +472,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
                        controller.startIntent(intent, fillInIntent, stage, position, options);
                    });
        }

        @Override
        public RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel) {
            final RemoteAnimationTarget[][] out = new RemoteAnimationTarget[][]{null};
            executeRemoteCallWithTaskPermission(mController, "onGoingToRecentsLegacy",
                    (controller) -> out[0] = controller.onGoingToRecentsLegacy(cancel),
                    true /* blocking */);
            return out[0];
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -970,7 +970,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        }
    }

    private RemoteAnimationTarget getDividerBarLegacyTarget() {
    RemoteAnimationTarget getDividerBarLegacyTarget() {
        final Rect bounds = mSplitLayout.getDividerBounds();
        return new RemoteAnimationTarget(-1 /* taskId */, -1 /* mode */,
                mSplitLayout.getDividerLeash(), false /* isTranslucent */, null /* clipRect */,