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

Commit 484149d2 authored by Toshiki Kikuchi's avatar Toshiki Kikuchi Committed by Android (Google) Code Review
Browse files

Merge "Trigger transition in ATMS#resizeTask"

parents 5730aa8e a936bec5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -198,9 +198,8 @@ interface IActivityTaskManager {
     * @param taskId The id of the task to set the bounds for.
     * @param bounds The new bounds.
     * @param resizeMode Resize mode defined as {@code ActivityTaskManager#RESIZE_MODE_*} constants.
     * @return Return true on success. Otherwise false.
     */
    boolean resizeTask(int taskId, in Rect bounds, int resizeMode);
    void resizeTask(int taskId, in Rect bounds, int resizeMode);
    void moveRootTaskToDisplay(int taskId, int displayId);

    void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop);
+36 −6
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ import static android.provider.Settings.Global.HIDE_ERROR_DIALOGS;
import static android.provider.Settings.System.FONT_SCALE;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_PIP;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT;

@@ -2843,7 +2844,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    }

    @Override
    public boolean resizeTask(int taskId, Rect bounds, int resizeMode) {
    public void resizeTask(int taskId, Rect bounds, int resizeMode) {
        enforceTaskPermission("resizeTask()");
        final long ident = Binder.clearCallingIdentity();
        try {
@@ -2852,19 +2853,48 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                        MATCH_ATTACHED_TASK_ONLY);
                if (task == null) {
                    Slog.w(TAG, "resizeTask: taskId=" + taskId + " not found");
                    return false;
                    return;
                }
                if (!task.getWindowConfiguration().canResizeTask()) {
                    Slog.w(TAG, "resizeTask not allowed on task=" + task);
                    return false;
                    return;
                }

                // Reparent the task to the right root task if necessary
                boolean preserveWindow = (resizeMode & RESIZE_MODE_PRESERVE_WINDOW) != 0;

                if (!getTransitionController().isShellTransitionsEnabled()) {
                    // After reparenting (which only resizes the task to the root task bounds),
                    // resize the task to the actual bounds provided
                return task.resize(bounds, resizeMode, preserveWindow);
                    task.resize(bounds, resizeMode, preserveWindow);
                    return;
                }

                final Transition transition = new Transition(TRANSIT_CHANGE, 0 /* flags */,
                        getTransitionController(), mWindowManager.mSyncEngine);
                if (mWindowManager.mSyncEngine.hasActiveSync()) {
                    mWindowManager.mSyncEngine.queueSyncSet(
                            () -> getTransitionController().moveToCollecting(transition),
                            () -> {
                                if (!task.getWindowConfiguration().canResizeTask()) {
                                    Slog.w(TAG, "resizeTask not allowed on task=" + task);
                                    transition.abort();
                                    return;
                                }
                                getTransitionController().requestStartTransition(transition, task,
                                        null /* remoteTransition */, null /* displayChange */);
                                getTransitionController().collect(task);
                                task.resize(bounds, resizeMode, preserveWindow);
                                transition.setReady(task, true);
                            });
                } else {
                    getTransitionController().moveToCollecting(transition);
                    getTransitionController().requestStartTransition(transition, task,
                            null /* remoteTransition */, null /* displayChange */);
                    getTransitionController().collect(task);
                    task.resize(bounds, resizeMode, preserveWindow);
                    transition.setReady(task, true);
                }
            }
        } finally {
            Binder.restoreCallingIdentity(ident);