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)43 void createRootTask(int displayId, int windowingMode, IBinder launchCookie); 44 45 /** Deletes a persistent root task in WM */ deleteRootTask(in WindowContainerToken task)46 boolean deleteRootTask(in WindowContainerToken task); 47 48 /** Gets direct child tasks (ordered from top-to-bottom) */ getChildTasks(in WindowContainerToken parent, in int[] activityTypes)49 List<ActivityManager.RunningTaskInfo> getChildTasks(in WindowContainerToken parent, 50 in int[] activityTypes); 51 52 /** Gets all root tasks on a display (ordered from top-to-bottom) */ getRootTasks(int displayId, in int[] activityTypes)53 List<ActivityManager.RunningTaskInfo> getRootTasks(int displayId, in int[] activityTypes); 54 55 /** Get the root task which contains the current ime target */ getImeTarget(int display)56 WindowContainerToken getImeTarget(int display); 57 58 /** 59 * Requests that the given task organizer is notified when back is pressed on the root activity 60 * of one of its controlled tasks. 61 */ setInterceptBackPressedOnTaskRoot(in WindowContainerToken task, boolean interceptBackPressed)62 void setInterceptBackPressedOnTaskRoot(in WindowContainerToken task, 63 boolean interceptBackPressed); 64 65 /** 66 * Restarts the top activity in the given task by killing its process if it is visible. 67 */ restartTaskTopActivityProcessIfVisible(in WindowContainerToken task)68 void restartTaskTopActivityProcessIfVisible(in WindowContainerToken task); 69 } 70