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

Commit 017993c6 authored by Edwin Varghese's avatar Edwin Varghese Committed by Louis Chang
Browse files

Allow Reordering of Tasks on Specific Displays



Bug: 402629293

Create a new API method, functionally equivalent to existing method
moveRootTaskToDisplay, but incorporating a boolean parameter onTop.
When onTop is true, the task will be moved to the top of the display's
activity stack. When false, the task will be moved to the bottom. This
allows for precise control over task ordering on designated displays
and also user can potentially resume the app from where it was left off.

Flag: EXEMPT adding hidden api without usage
Signed-off-by: default avatarEdwin Varghese <EVARGHE1@ford.com>
(cherry picked from https://android-review.googlesource.com/q/commit:d7a3ec23b6bf80fa2fee1ca7736400ec7306eaa6)
Merged-In: Ib04ada36ed36eb9d9c48b25da9a176234280a81c
Change-Id: Ib04ada36ed36eb9d9c48b25da9a176234280a81c
parent 54ce4f30
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -403,4 +403,14 @@ interface IActivityTaskManager {
     * @hide
     */
    void unregisterScreenCaptureObserver(IBinder activityToken, IScreenCaptureObserver observer);

    /**
    * Move the task to the top/ bottom of the activity stack of specific display
    *
    * @param taskId Id of the task that has to be moved
    * @param displayId Id of the display to which it has to be moved
    * @param onTop defines the task has to be moved on top or bottom of the stack
    * @hide
    */
    void moveRootTaskToDisplayOnTopOrBottom(int taskId, int displayId, boolean onTop);
}
+16 −0
Original line number Diff line number Diff line
@@ -3175,6 +3175,22 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        }
    }

    @Override
    public void moveRootTaskToDisplayOnTopOrBottom(int taskId, int displayId, boolean onTop) {
        mAmInternal.enforceCallingPermission(INTERNAL_SYSTEM_WINDOW,
                "moveRootTaskToDisplayOnTopOrBottom()");
        synchronized (mGlobalLock) {
            final long ident = Binder.clearCallingIdentity();
            try {
                ProtoLog.d(WM_DEBUG_TASKS, "moveRootTaskToDisplayOnTopOrBottom: " +
                        "moving taskId=%d to displayId=%d, onTop=%b", taskId, displayId, onTop);
                mRootWindowContainer.moveRootTaskToDisplay(taskId, displayId, onTop);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    /** Sets the task stack listener that gets callbacks when a task stack changes. */
    @Override
    public void registerTaskStackListener(ITaskStackListener listener) {