1 /*
2  * Copyright (C) 2019 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.view.SurfaceControl;
20 import android.app.ActivityManager;
21 import android.window.WindowContainerToken;
22 
23 /**
24  * Interface for ActivityTaskManager/WindowManager to delegate control of tasks.
25  * {@hide}
26  */
27 oneway interface ITaskOrganizer {
28     /**
29      * A callback when the Task is available for the registered organizer. The client is responsible
30      * for releasing the SurfaceControl in the callback. For non-root tasks, the leash may initially
31      * be hidden so it is up to the organizer to show this task.
32      *
33      * @param taskInfo The information about the Task that's available
34      * @param leash A persistent leash for this Task.
35      */
onTaskAppeared(in ActivityManager.RunningTaskInfo taskInfo, in SurfaceControl leash)36     void onTaskAppeared(in ActivityManager.RunningTaskInfo taskInfo, in SurfaceControl leash);
onTaskVanished(in ActivityManager.RunningTaskInfo taskInfo)37     void onTaskVanished(in ActivityManager.RunningTaskInfo taskInfo);
38 
39     /**
40      * Will fire when core attributes of a Task's info change. Relevant properties include the
41      * {@link WindowConfiguration.ActivityType} and whether it is resizable.
42      *
43      * This is used, for example, during split-screen. The flow for starting is: Something sends an
44      * Intent with windowingmode. Then WM finds a matching root task and launches the new task into
45      * it. This causes the root task's info to change because now it has a task when it didn't
46      * before. The default Divider implementation interprets this as a request to enter
47      * split-screen mode and will move all other Tasks into the secondary root task. When WM
48      * applies this change, it triggers an info change in the secondary root task because it now
49      * has children. The Divider impl looks at the info and can see that the secondary root task
50      * has adopted an ActivityType of HOME and proceeds to show the minimized dock UX.
51      */
onTaskInfoChanged(in ActivityManager.RunningTaskInfo taskInfo)52     void onTaskInfoChanged(in ActivityManager.RunningTaskInfo taskInfo);
53 
54     /**
55      * Called when the task organizer has requested
56      * {@link ITaskOrganizerController.setInterceptBackPressedOnTaskRoot} to get notified when the
57      * user has pressed back on the root activity of a task controlled by the task organizer.
58      */
onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo)59     void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);
60 }
61