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