• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 android.car.app;
18 
19 import android.annotation.NonNull;
20 import android.app.PendingIntent;
21 import android.content.Intent;
22 import android.graphics.Rect;
23 import android.os.Bundle;
24 import android.view.SurfaceControl;
25 
26 /**
27  * An adapter that adapts {@link ICarTaskViewHost} to {@link CarTaskViewHost}.
28  */
29 final class CarTaskViewHostAidlToImplAdapter extends ICarTaskViewHost.Stub {
30     private final CarTaskViewHost mCarTaskViewHost;
31 
CarTaskViewHostAidlToImplAdapter(CarTaskViewHost carTaskViewHost)32     CarTaskViewHostAidlToImplAdapter(CarTaskViewHost carTaskViewHost) {
33         mCarTaskViewHost = carTaskViewHost;
34     }
35 
36     @Override
release()37     public void release() {
38         mCarTaskViewHost.release();
39     }
40 
41     @Override
startActivity( PendingIntent pendingIntent, Intent intent, Bundle options, Rect launchBounds)42     public void startActivity(
43             PendingIntent pendingIntent, Intent intent, Bundle options, Rect launchBounds) {
44         mCarTaskViewHost.startActivity(pendingIntent, intent, options, launchBounds);
45     }
46 
47     @Override
createRootTask(int displayId)48     public void createRootTask(int displayId) {
49         mCarTaskViewHost.createRootTask(displayId);
50     }
51 
52     @Override
createLaunchRootTask(int displayId, boolean embedHomeTask, boolean embedRecentsTask, boolean embedAssistantTask)53     public void createLaunchRootTask(int displayId, boolean embedHomeTask, boolean embedRecentsTask,
54             boolean embedAssistantTask) {
55         mCarTaskViewHost.createLaunchRootTask(displayId, embedHomeTask, embedRecentsTask,
56                 embedAssistantTask);
57     }
58 
59     @Override
notifySurfaceCreated(SurfaceControl control)60     public void notifySurfaceCreated(SurfaceControl control) {
61         mCarTaskViewHost.notifySurfaceCreated(control);
62     }
63 
64     @Override
setWindowBounds(Rect windowBoundsOnScreen)65     public void setWindowBounds(Rect windowBoundsOnScreen) {
66         mCarTaskViewHost.setWindowBounds(windowBoundsOnScreen);
67     }
68 
69     @Override
notifySurfaceDestroyed()70     public void notifySurfaceDestroyed() {
71         mCarTaskViewHost.notifySurfaceDestroyed();
72     }
73 
74     @Override
showEmbeddedTask()75     public void showEmbeddedTask() {
76         mCarTaskViewHost.showEmbeddedTask();
77     }
78 
79     @Override
setTaskVisibility(boolean visibility)80     public void setTaskVisibility(boolean visibility) {
81         mCarTaskViewHost.setTaskVisibility(visibility);
82     }
83 
84     @Override
reorderTask(boolean onTop)85     public void reorderTask(boolean onTop) {
86         mCarTaskViewHost.reorderTask(onTop);
87     }
88 
89     @Override
addInsets(int index, int type, @NonNull Rect frame)90     public void addInsets(int index, int type, @NonNull Rect frame) {
91         mCarTaskViewHost.addInsets(index, type, frame);
92     }
93 
94     @Override
removeInsets(int index, int type)95     public void removeInsets(int index, int type) {
96         mCarTaskViewHost.removeInsets(index, type);
97     }
98 }
99