1 /* 2 * Copyright (C) 2021 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.car.app; 18 19 import android.app.ActivityManager.RunningTaskInfo; 20 import android.car.app.ICarSystemUIProxy; 21 import android.car.app.ICarSystemUIProxyCallback; 22 import android.content.ComponentName; 23 import android.graphics.Rect; 24 import android.view.SurfaceControl; 25 import java.util.List; 26 27 28 /** @hide */ 29 interface ICarActivityService { 30 /** 31 * Designates the given {@code activity} to be launched in {@code TaskDisplayArea} of 32 * {@code featureId} in the display of {@code displayId}. 33 */ setPersistentActivity(in ComponentName activity, int displayId, int featureId)34 int setPersistentActivity(in ComponentName activity, int displayId, int featureId); 35 36 /** 37 * Registers the caller as TaskMonitor, which can provide Task lifecycle events to CarService. 38 * The caller should provide a binder token, which is used to check if the given TaskMonitor is 39 * live and the reported events are from the legitimate TaskMonitor. 40 */ registerTaskMonitor(in IBinder token)41 void registerTaskMonitor(in IBinder token); 42 43 /** 44 * Reports that a Task is created. 45 */ onTaskAppeared(in IBinder token, in RunningTaskInfo taskInfo, in SurfaceControl leash)46 void onTaskAppeared(in IBinder token, in RunningTaskInfo taskInfo, in SurfaceControl leash); 47 48 /** 49 * Reports that a Task is vanished. 50 */ onTaskVanished(in IBinder token, in RunningTaskInfo taskInfo)51 void onTaskVanished(in IBinder token, in RunningTaskInfo taskInfo); 52 53 /** 54 * Reports that some Task's states are changed. 55 */ onTaskInfoChanged(in IBinder token, in RunningTaskInfo taskInfo)56 void onTaskInfoChanged(in IBinder token, in RunningTaskInfo taskInfo); 57 58 /** 59 * Unregisters the caller from TaskMonitor. 60 */ unregisterTaskMonitor(in IBinder token)61 void unregisterTaskMonitor(in IBinder token); 62 63 /** See {@link CarActivityManager#getVisibleTasks(int)} */ getVisibleTasks(int displayId)64 List<RunningTaskInfo> getVisibleTasks(int displayId); 65 66 /** See {@link CarActivityManager#startUserPickerOnDisplay(int)} */ startUserPickerOnDisplay(int displayId)67 void startUserPickerOnDisplay(int displayId); 68 69 /** See {@link CarActivityManager#createTaskMirroringToken(int)} */ createTaskMirroringToken(int taskId)70 IBinder createTaskMirroringToken(int taskId); 71 72 /** See {@link CarActivityManager#createDisplayMirroringToken(int)} */ createDisplayMirroringToken(int displayId)73 IBinder createDisplayMirroringToken(int displayId); 74 75 /** See {@link CarActivityManager#getMirroredSurface(IBinder, Rect)} */ getMirroredSurface(in IBinder mirroringToken, out Rect bounds)76 SurfaceControl getMirroredSurface(in IBinder mirroringToken, out Rect bounds); 77 78 /** 79 * Registers a System UI proxy which is meant to host all the system ui interaction that is 80 * required by other apps. 81 */ registerCarSystemUIProxy(in ICarSystemUIProxy carSystemUIProxy)82 void registerCarSystemUIProxy(in ICarSystemUIProxy carSystemUIProxy); 83 84 /** 85 * Adds a callback to monitor the lifecycle of System UI proxy. Calling this for an already 86 * registered callback will result in a no-op. 87 */ addCarSystemUIProxyCallback(in ICarSystemUIProxyCallback callback)88 void addCarSystemUIProxyCallback(in ICarSystemUIProxyCallback callback); 89 90 /** 91 * Removes the callback to monitor the lifecycle of System UI proxy. 92 * Calling this for an already unregistered callback will result in a no-op 93 */ removeCarSystemUIProxyCallback(in ICarSystemUIProxyCallback callback)94 void removeCarSystemUIProxyCallback(in ICarSystemUIProxyCallback callback); 95 96 /** See {@link CarActivityManager#moveRootTaskToDisplay(int, int)} */ moveRootTaskToDisplay(int taskId, int displayId)97 void moveRootTaskToDisplay(int taskId, int displayId); 98 99 /** 100 * Returns true if the {@link CarSystemUIProxy} is registered, false otherwise. 101 */ isCarSystemUIProxyRegistered()102 boolean isCarSystemUIProxyRegistered() ; 103 setPersistentActivitiesOnRootTask(in List<ComponentName> activities, in IBinder launchCookie)104 void setPersistentActivitiesOnRootTask(in List<ComponentName> activities, 105 in IBinder launchCookie); 106 107 /** 108 * Reports that a Root Task has vanished. 109 */ onRootTaskVanished(int taskId)110 void onRootTaskVanished(int taskId); 111 112 /** 113 * Reports that a Root Task is created. 114 */ onRootTaskAppeared(String name, in RunningTaskInfo taskInfo, IBinder rootTaskToken)115 void onRootTaskAppeared(String name, in RunningTaskInfo taskInfo, IBinder rootTaskToken); 116 } 117