1 /**
2  * Copyright (c) 2020, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.window;
18 
19 import android.app.ActivityManager;
20 import android.window.ITaskOrganizer;
21 import android.window.WindowContainerToken;
22 import android.window.WindowContainerTransaction;
23 
24 /** @hide */
25 interface ITaskOrganizerController {
26 
27     /**
28      * Register a TaskOrganizer to manage tasks as they enter the given windowing mode.
29      * If there was already a TaskOrganizer for this windowing mode it will be evicted
30      * and receive taskVanished callbacks in the process.
31      */
registerTaskOrganizer(ITaskOrganizer organizer, int windowingMode)32     void registerTaskOrganizer(ITaskOrganizer organizer, int windowingMode);
33 
34     /**
35      * Unregisters a previously registered task organizer.
36      */
unregisterTaskOrganizer(ITaskOrganizer organizer)37     void unregisterTaskOrganizer(ITaskOrganizer organizer);
38 
39     /** Creates a persistent root task in WM for a particular windowing-mode. */
createRootTask(int displayId, int windowingMode)40     ActivityManager.RunningTaskInfo createRootTask(int displayId, int windowingMode);
41 
42     /** Deletes a persistent root task in WM */
deleteRootTask(in WindowContainerToken task)43     boolean deleteRootTask(in WindowContainerToken task);
44 
45     /** Gets direct child tasks (ordered from top-to-bottom) */
getChildTasks(in WindowContainerToken parent, in int[] activityTypes)46     List<ActivityManager.RunningTaskInfo> getChildTasks(in WindowContainerToken parent,
47             in int[] activityTypes);
48 
49     /** Gets all root tasks on a display (ordered from top-to-bottom) */
getRootTasks(int displayId, in int[] activityTypes)50     List<ActivityManager.RunningTaskInfo> getRootTasks(int displayId, in int[] activityTypes);
51 
52     /** Get the root task which contains the current ime target */
getImeTarget(int display)53     WindowContainerToken getImeTarget(int display);
54 
55     /**
56      * Set's the root task to launch new tasks into on a display. {@code null} means no launch root
57      * and thus new tasks just end up directly on the display.
58      */
setLaunchRoot(int displayId, in WindowContainerToken root)59     void setLaunchRoot(int displayId, in WindowContainerToken root);
60 
61     /**
62      * Requests that the given task organizer is notified when back is pressed on the root activity
63      * of one of its controlled tasks.
64      */
setInterceptBackPressedOnTaskRoot(ITaskOrganizer organizer, boolean interceptBackPressed)65     void setInterceptBackPressedOnTaskRoot(ITaskOrganizer organizer, boolean interceptBackPressed);
66 }
67