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.cluster;
18 
19 import android.car.cluster.ClusterState;
20 import android.car.cluster.IClusterStateListener;
21 import android.car.cluster.IClusterNavigationStateListener;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.view.SurfaceControl;
25 
26 /** @hide */
27 interface IClusterHomeService {
28     /**
29      * Reports the current UI state in cluster display.
30      */
reportState(int uiTypeMain, int uiTypeSub, in byte[] uiAvailability)31     void reportState(int uiTypeMain, int uiTypeSub, in byte[] uiAvailability) = 0;
32     /**
33      * Requests to turn the cluster display on to show some ClusterUI.
34      */
requestDisplay(int uiType)35     void requestDisplay(int uiType) = 1;
36     /**
37      * Start an activity as specified user. The activity is considered as in fixed mode for
38      * the cluster display and will be re-launched if the activity crashes, the package
39      * is updated or goes to background for whatever reason.
40      * Only one activity can exist in fixed mode for the display and calling this multiple
41      * times with different {@code Intent} will lead into making all previous activities into
42      * non-fixed normal state (= will not be re-launched.)
43      */
startFixedActivityModeAsUser(in Intent intent, in Bundle activityOptionsBundle, int userId)44     boolean startFixedActivityModeAsUser(in Intent intent,
45             in Bundle activityOptionsBundle, int userId) = 2;
46     /**
47      * The activity launched on the cluster display is no longer in fixed mode. Re-launching or
48      * finishing should not trigger re-launching any more. Note that Activity for non-current user
49      * will be auto-stopped and there is no need to call this for user switching. Note that this
50      * does not stop the activity but it will not be re-launched any more.
51      */
stopFixedActivityMode()52     void stopFixedActivityMode() = 3;
53     // 4 removed. Do not use - void registerCallback(in IClusterHomeCallback callback) = 4;
54     // 5 removed. Do not use - void unregisterCallback(in IClusterHomeCallback callback) = 5;
55     /** Returns the current {@code ClusterDisplayState}. */
getClusterState()56     ClusterState getClusterState() = 6;
57     /** Registers a listener to listen for cluster state changes. */
58     void registerClusterStateListener(in IClusterStateListener listener) = 7;
59     /** Unregisters a cluster state listener. */
60     void unregisterClusterStateListener(in IClusterStateListener listener) = 8;
61     /** Registers a listener to lsiten for clustser navigation state changes. */
62     void registerClusterNavigationStateListener(in IClusterNavigationStateListener listener) = 9;
63     /** Unregisters a cluster navigation state listener. */
64     void unregisterClusterNavigationStateListener(in IClusterNavigationStateListener listener) = 10;
65     /** Sends a heartbeat. */
sendHeartbeat(long epochTimeNs, in byte[] appMetadata)66     void sendHeartbeat(long epochTimeNs, in byte[] appMetadata) = 11;
67     /** Starts the visibility monitoring of the given Surface. */
68     void startVisibilityMonitoring(in SurfaceControl sc) = 12;
69     /** Stops the visibility monitoring. */
stopVisibilityMonitoring()70     void stopVisibilityMonitoring() = 13;
71 }
72