1 /*
2  * Copyright (C) 2023 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 com.android.wm.shell.taskview;
18 
19 import android.app.ActivityManager;
20 import android.graphics.Rect;
21 import android.view.SurfaceControl;
22 
23 /**
24  * A stub for SurfaceView used by {@link TaskViewTaskController}
25  */
26 public interface TaskViewBase {
27     /**
28      * Returns the current bounds on screen for the task view.
29      * @return
30      */
31     // TODO(b/266242294): Remove getBoundsOnScreen() and instead send the bounds from the TaskView
32     //  to TaskViewTaskController.
getCurrentBoundsOnScreen()33     Rect getCurrentBoundsOnScreen();
34 
35     /**
36      * This method should set the resize background color on the SurfaceView that is exposed to
37      * clients.
38      * See {@link android.view.SurfaceView#setResizeBackgroundColor(SurfaceControl.Transaction,
39      * int)}
40      */
setResizeBgColor(SurfaceControl.Transaction transaction, int color)41     void setResizeBgColor(SurfaceControl.Transaction transaction, int color);
42 
43     /**
44      * Called when a task appears on the TaskView. See
45      * {@link TaskViewTaskController#onTaskAppeared(ActivityManager.RunningTaskInfo,
46      * SurfaceControl)} for details.
47      */
onTaskAppeared(ActivityManager.RunningTaskInfo taskInfo, SurfaceControl leash)48     default void onTaskAppeared(ActivityManager.RunningTaskInfo taskInfo, SurfaceControl leash) {
49     }
50 
51     /**
52      * Called when a task is vanished from the TaskView. See
53      * {@link TaskViewTaskController#onTaskVanished(ActivityManager.RunningTaskInfo)} for details.
54      */
onTaskVanished(ActivityManager.RunningTaskInfo taskInfo)55     default void onTaskVanished(ActivityManager.RunningTaskInfo taskInfo) {
56     }
57 
58     /**
59      * Called when the task in the TaskView is changed. See
60      * {@link TaskViewTaskController#onTaskInfoChanged(ActivityManager.RunningTaskInfo)} for details.
61      */
onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo)62     default void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
63     }
64 }
65