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.content.pm.ParceledListSlice;
21 import android.window.ITaskOrganizer;
22 import android.window.TaskAppearedInfo;
23 import android.window.WindowContainerToken;
24 import android.window.WindowContainerTransaction;
25 
26 /** @hide */
27 interface ITaskOrganizerController {
28 
29     /**
30      * Register a TaskOrganizer to manage all the tasks with supported windowing modes.
31      *
32      * @return a list of the tasks that should be managed by the organizer, not including tasks
33      *         created via {@link #createRootTask}.
34      */
registerTaskOrganizer(ITaskOrganizer organizer)35     ParceledListSlice<TaskAppearedInfo> registerTaskOrganizer(ITaskOrganizer organizer);
36 
37     /**
38      * Unregisters a previously registered task organizer.
39      */
unregisterTaskOrganizer(ITaskOrganizer organizer)40     void unregisterTaskOrganizer(ITaskOrganizer organizer);
41 
42     /** Creates a persistent root task in WM for a particular windowing-mode. */
createRootTask(int displayId, int windowingMode, IBinder launchCookie, boolean removeWithTaskOrganizer)43     void createRootTask(int displayId, int windowingMode, IBinder launchCookie,
44             boolean removeWithTaskOrganizer);
45 
46     /** Deletes a persistent root task in WM */
deleteRootTask(in WindowContainerToken task)47     boolean deleteRootTask(in WindowContainerToken task);
48 
49     /** Gets direct child tasks (ordered from top-to-bottom) */
getChildTasks(in WindowContainerToken parent, in int[] activityTypes)50     List<ActivityManager.RunningTaskInfo> getChildTasks(in WindowContainerToken parent,
51             in int[] activityTypes);
52 
53     /** Gets all root tasks on a display (ordered from top-to-bottom) */
getRootTasks(int displayId, in int[] activityTypes)54     List<ActivityManager.RunningTaskInfo> getRootTasks(int displayId, in int[] activityTypes);
55 
56     /** Get the {@link WindowContainerToken} of the task which contains the current ime target */
getImeTarget(int display)57     WindowContainerToken getImeTarget(int display);
58 
59     /**
60      * Requests that the given task organizer is notified when back is pressed on the root activity
61      * of one of its controlled tasks.
62      */
setInterceptBackPressedOnTaskRoot(in WindowContainerToken task, boolean interceptBackPressed)63     void setInterceptBackPressedOnTaskRoot(in WindowContainerToken task,
64             boolean interceptBackPressed);
65 
66     /**
67      * Restarts the top activity in the given task by killing its process if it is visible.
68      */
restartTaskTopActivityProcessIfVisible(in WindowContainerToken task)69     void restartTaskTopActivityProcessIfVisible(in WindowContainerToken task);
70 
71     /** Updates a state of camera compat control for stretched issues in the viewfinder. */
updateCameraCompatControlState(in WindowContainerToken task, int state)72     void updateCameraCompatControlState(in WindowContainerToken task, int state);
73 }
74