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

Commit 2cdc359b authored by Iris Yang's avatar Iris Yang Committed by IRIS YANG
Browse files

Move/Launch task on the TaskView's display.

Add ActivityOptions#setLaunchDisplayId to the display that the TaskView
is currently on. So the task will be moved to the display as the user is
interactiving with.

Bug: 183461428
Test: Manually tested using Exo. Open appliction(e.g.Calculator) on
Exo virtual display, and tapping on the phone's recents to bring the
application back to phone.
The demo video  https://drive.google.com/file/d/1JMncvsI-VPosK4ql2xeVA8csVAF7Rb16/view?usp=sharing&resourcekey=0-PYRw1k3KdtY0-KZNo6OqjQ

Change-Id: Iaed5aed4d698b71b0d0fc2b78843f4aedd586ecb
parent 89d3f7d1
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -654,6 +654,7 @@ public class TaskView extends FrameLayout implements Reusable {
            TestLogging.recordEvent(
            TestLogging.recordEvent(
                    TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
                    TestProtocol.SEQUENCE_MAIN, "startActivityFromRecentsAsync", mTask);
            ActivityOptionsWrapper opts =  mActivity.getActivityLaunchOptions(this, null);
            ActivityOptionsWrapper opts =  mActivity.getActivityLaunchOptions(this, null);
            opts.options.setLaunchDisplayId(getRootViewDisplayId());
            if (ActivityManagerWrapper.getInstance()
            if (ActivityManagerWrapper.getInstance()
                    .startActivityFromRecents(mTask.key, opts.options)) {
                    .startActivityFromRecents(mTask.key, opts.options)) {
                RecentsView recentsView = getRecentsView();
                RecentsView recentsView = getRecentsView();
@@ -694,6 +695,7 @@ public class TaskView extends FrameLayout implements Reusable {
            // Indicate success once the system has indicated that the transition has started
            // Indicate success once the system has indicated that the transition has started
            ActivityOptions opts = ActivityOptionsCompat.makeCustomAnimation(
            ActivityOptions opts = ActivityOptionsCompat.makeCustomAnimation(
                    getContext(), 0, 0, () -> callback.accept(true), MAIN_EXECUTOR.getHandler());
                    getContext(), 0, 0, () -> callback.accept(true), MAIN_EXECUTOR.getHandler());
            opts.setLaunchDisplayId(getRootViewDisplayId());
            if (freezeTaskList) {
            if (freezeTaskList) {
                ActivityOptionsCompat.setFreezeRecentTasksList(opts);
                ActivityOptionsCompat.setFreezeRecentTasksList(opts);
            }
            }
@@ -1505,6 +1507,10 @@ public class TaskView extends FrameLayout implements Reusable {
        mDigitalWellBeingToast.setBannerColorTint(tintColor, amount);
        mDigitalWellBeingToast.setBannerColorTint(tintColor, amount);
    }
    }


    private int getRootViewDisplayId() {
        return getRootView().getDisplay().getDisplayId();
    }

    /**
    /**
     * We update and subsequently draw these in {@link #setFullscreenProgress(float)}.
     * We update and subsequently draw these in {@link #setFullscreenProgress(float)}.
     */
     */