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