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.graphics.Rect;
22 import android.window.StartingWindowInfo;
23 import android.window.StartingWindowRemovalInfo;
24 import android.window.WindowContainerToken;
25 
26 /**
27  * Interface for ActivityTaskManager/WindowManager to delegate control of tasks.
28  * {@hide}
29  */
30 oneway interface ITaskOrganizer {
31     /**
32      * Called when a Task is starting and the system would like to show a UI to indicate that an
33      * application is starting. The client is responsible to add/remove the starting window if it
34      * has create a starting window for the Task.
35      *
36      * @param info The information about the Task that's available
37      */
addStartingWindow(in StartingWindowInfo info)38     void addStartingWindow(in StartingWindowInfo info);
39 
40     /**
41      * Called when the Task want to remove the starting window.
42      * @param removalInfo The information used to remove the starting window.
43      */
removeStartingWindow(in StartingWindowRemovalInfo removalInfo)44     void removeStartingWindow(in StartingWindowRemovalInfo removalInfo);
45 
46     /**
47      * Called when the Task want to copy the splash screen.
48      */
copySplashScreenView(int taskId)49     void copySplashScreenView(int taskId);
50 
51     /**
52      * Called when the Task removed the splash screen.
53      */
onAppSplashScreenViewRemoved(int taskId)54     void onAppSplashScreenViewRemoved(int taskId);
55 
56     /**
57      * A callback when the Task is available for the registered organizer. The client is responsible
58      * for releasing the SurfaceControl in the callback. For non-root tasks, the leash may initially
59      * be hidden so it is up to the organizer to show this task.
60      *
61      * @param taskInfo The information about the Task that's available
62      * @param leash A persistent leash for this Task.
63      */
onTaskAppeared(in ActivityManager.RunningTaskInfo taskInfo, in SurfaceControl leash)64     void onTaskAppeared(in ActivityManager.RunningTaskInfo taskInfo, in SurfaceControl leash);
onTaskVanished(in ActivityManager.RunningTaskInfo taskInfo)65     void onTaskVanished(in ActivityManager.RunningTaskInfo taskInfo);
66 
67     /**
68      * Will fire when core attributes of a Task's info change. Relevant properties include the
69      * {@link WindowConfiguration.ActivityType} and whether it is resizable.
70      *
71      * This is used, for example, during split-screen. The flow for starting is: Something sends an
72      * Intent with windowingmode. Then WM finds a matching root task and launches the new task into
73      * it. This causes the root task's info to change because now it has a task when it didn't
74      * before. The default Divider implementation interprets this as a request to enter
75      * split-screen mode and will move all other Tasks into the secondary root task. When WM
76      * applies this change, it triggers an info change in the secondary root task because it now
77      * has children. The Divider impl looks at the info and can see that the secondary root task
78      * has adopted an ActivityType of HOME and proceeds to show the minimized dock UX.
79      */
onTaskInfoChanged(in ActivityManager.RunningTaskInfo taskInfo)80     void onTaskInfoChanged(in ActivityManager.RunningTaskInfo taskInfo);
81 
82     /**
83      * Called when the task organizer has requested
84      * {@link ITaskOrganizerController.setInterceptBackPressedOnTaskRoot} to get notified when the
85      * user has pressed back on the root activity of a task controlled by the task organizer.
86      */
onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo)87     void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo);
88 
89     /**
90      * Called when the IME has drawn on the organized task.
91      */
onImeDrawnOnTask(int taskId)92     void onImeDrawnOnTask(int taskId);
93 }
94