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.car.docklib
18 
19 import android.content.ComponentName
20 import com.android.car.docklib.data.DockItemId
21 import java.util.UUID
22 
23 interface DockInterface {
24     /** called when an app is pinned to the Dock */
appPinnednull25     fun appPinned(componentName: ComponentName)
26 
27     /** called when an app is pinned to the Dock at a particular position */
28     fun appPinned(componentName: ComponentName, index: Int)
29 
30     /** called when an app already in the dock is pinned */
31     fun appPinned(@DockItemId id: UUID)
32 
33     /** called when an app already in the dock is unpinned */
34     fun appUnpinned(componentName: ComponentName)
35 
36     /** called when an app already in the dock is unpinned */
37     fun appUnpinned(@DockItemId id: UUID)
38 
39     /** called when an app is launched */
40     fun appLaunched(componentName: ComponentName)
41 
42     /**
43      * called when an app is uninstalled/removed from the system or is inaccessible in the dock.
44      * @param packageName packageName of removed package
45      */
46     fun packageRemoved(packageName: String)
47 
48     /**
49      * called when an app is installed in the system or is enabled in the dock.
50      * @param packageName packageName of removed package
51      */
52     fun packageAdded(packageName: String)
53 
54     /** called to launch an app */
55     fun launchApp(componentName: ComponentName, isMediaApp: Boolean)
56 
57     /** @return the dominant color to be used with the icon corresponding to [componentName] */
58     fun getIconColorWithScrim(componentName: ComponentName): Int
59 
60     /** get the set of all media service components */
61     fun getMediaServiceComponents(): Set<ComponentName>
62 }
63