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

Commit 2524e165 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Let the framework position a window when switching to freeform"

parents cf94988e 1f6b709c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.recents;

import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.view.View.MeasureSpec;

import android.app.ActivityManager;
@@ -443,7 +444,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        }

        // Launch the task
        ssp.startActivityFromRecents(mContext, toTask.key, toTask.title, launchOpts);
        ssp.startActivityFromRecents(
                mContext, toTask.key, toTask.title, launchOpts, INVALID_STACK_ID);
    }

    /**
@@ -515,7 +517,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        MetricsLogger.count(mContext, "overview_affiliated_task_launch", 1);

        // Launch the task
        ssp.startActivityFromRecents(mContext, toTask.key, toTask.title, launchOpts);
        ssp.startActivityFromRecents(
                mContext, toTask.key, toTask.title, launchOpts, INVALID_STACK_ID);
    }

    public void showNextAffiliatedTask() {
+7 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;

@@ -940,7 +941,7 @@ public class SystemServicesProxy {

    /** Starts an activity from recents. */
    public boolean startActivityFromRecents(Context context, Task.TaskKey taskKey, String taskName,
            ActivityOptions options) {
            ActivityOptions options, int stackId) {
        if (mIam != null) {
            try {
                if (taskKey.stackId == DOCKED_STACK_ID) {
@@ -950,6 +951,11 @@ public class SystemServicesProxy {
                        options = ActivityOptions.makeBasic();
                    }
                    options.setLaunchStackId(FULLSCREEN_WORKSPACE_STACK_ID);
                } else if (stackId != INVALID_STACK_ID){
                    if (options == null) {
                        options = ActivityOptions.makeBasic();
                    }
                    options.setLaunchStackId(stackId);
                }
                mIam.startActivityFromRecents(
                        taskKey.id, options == null ? null : options.toBundle());
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;

import static android.app.ActivityManager.StackId.INVALID_STACK_ID;


public class RecentsTvTransitionHelper {
    private static final String TAG = "RecentsTvTransitionHelper";
@@ -90,7 +92,7 @@ public class RecentsTvTransitionHelper {
    private void startTaskActivity(TaskStack stack, Task task, @Nullable TaskCardView taskView,
            ActivityOptions opts,final ActivityOptions.OnAnimationStartedListener animStartedListener) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startActivityFromRecents(mContext, task.key, task.title, opts)) {
        if (ssp.startActivityFromRecents(mContext, task.key, task.title, opts, INVALID_STACK_ID)) {
            // Keep track of the index of the task launch
            int taskIndexFromFront = 0;
            int taskIndex = stack.indexOfStackTask(task);
+4 −2
Original line number Diff line number Diff line
@@ -140,7 +140,8 @@ public class RecentsTvView extends FrameLayout {
    private void launchTaskFomRecents(final Task task, boolean animate) {
        if (!animate) {
            SystemServicesProxy ssp = Recents.getSystemServices();
            ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
            ssp.startActivityFromRecents(getContext(), task.key, task.title, null,
                    INVALID_STACK_ID);
            return;
        }
        mTaskStackHorizontalView.requestFocus();
@@ -164,7 +165,8 @@ public class RecentsTvView extends FrameLayout {
                            // task with no animation.
                            Log.e(TAG, "Card view for task : " + task + ", returned null.");
                            SystemServicesProxy ssp = Recents.getSystemServices();
                            ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
                            ssp.startActivityFromRecents(getContext(), task.key, task.title, null,
                                    INVALID_STACK_ID);
                        }
                        mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
                    }
+7 −5
Original line number Diff line number Diff line
@@ -149,7 +149,8 @@ public class RecentsTransitionHelper {
        if (taskView == null) {
            // If there is no task view, then we do not need to worry about animating out occluding
            // task views, and we can launch immediately
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener);
            startTaskActivity(stack, task, taskView, opts, transitionFuture, animStartedListener,
                    destinationStack);
        } else {
            LaunchTaskStartedEvent launchStartedEvent = new LaunchTaskStartedEvent(taskView,
                    screenPinningRequested);
@@ -158,14 +159,14 @@ public class RecentsTransitionHelper {
                    @Override
                    public void run() {
                        startTaskActivity(stack, task, taskView, opts, transitionFuture,
                                animStartedListener);
                                animStartedListener, destinationStack);
                    }
                });
                EventBus.getDefault().send(launchStartedEvent);
            } else {
                EventBus.getDefault().send(launchStartedEvent);
                startTaskActivity(stack, task, taskView, opts, transitionFuture,
                        animStartedListener);
                        animStartedListener, destinationStack);
            }
        }
        Recents.getSystemServices().sendCloseSystemWindows(
@@ -194,12 +195,13 @@ public class RecentsTransitionHelper {
     *
     * @param taskView this is the {@link TaskView} that we are launching from. This can be null if
     *                 we are toggling recents and the launch-to task is now offscreen.
     * @param destinationStack id of the stack to put the task into.
     */
    private void startTaskActivity(TaskStack stack, Task task, @Nullable TaskView taskView,
            ActivityOptions opts, IAppTransitionAnimationSpecsFuture transitionFuture,
            final ActivityOptions.OnAnimationStartedListener animStartedListener) {
            final OnAnimationStartedListener animStartedListener, int destinationStack) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.startActivityFromRecents(mContext, task.key, task.title, opts)) {
        if (ssp.startActivityFromRecents(mContext, task.key, task.title, opts, destinationStack)) {
            // Keep track of the index of the task launch
            int taskIndexFromFront = 0;
            int taskIndex = stack.indexOfStackTask(task);
Loading