1 /*
2  * Copyright (C) 2017 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.annotation.SystemApi;
20 import android.car.Car;
21 import android.car.CarManagerBase;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.os.IBinder;
25 
26 /**
27  * API to work with instrument cluster.
28  *
29  * @deprecated use {@link android.car.CarAppFocusManager} with focus type
30  * {@link android.car.CarAppFocusManager#APP_FOCUS_TYPE_NAVIGATION} instead.
31  * InstrumentClusterService will automatically launch a "android.car.cluster.NAVIGATION" activity
32  * from the package holding navigation focus.
33  *
34  * @hide
35  */
36 @Deprecated
37 @SystemApi
38 public class CarInstrumentClusterManager extends CarManagerBase {
39     /**
40      * @deprecated use {@link android.car.Car#CATEGORY_NAVIGATION} instead
41      *
42      * @hide
43      */
44     @SystemApi
45     public static final String CATEGORY_NAVIGATION = "android.car.cluster.NAVIGATION";
46 
47     /**
48      * When activity in the cluster is launched it will receive {@link ClusterActivityState} in the
49      * intent's extra thus activity will know information about unobscured area, etc. upon activity
50      * creation.
51      *
52      * @deprecated use {@link android.car.Car#CATEGORY_NAVIGATION} instead
53      *
54      * @hide
55      */
56     @SystemApi
57     public static final String KEY_EXTRA_ACTIVITY_STATE =
58             "android.car.cluster.ClusterActivityState";
59 
60     /**
61      * Starts activity in the instrument cluster.
62      *
63      * @deprecated see {@link CarInstrumentClusterManager} deprecation message
64      *
65      * @hide
66      */
67     @SystemApi
startActivity(Intent intent)68     public void startActivity(Intent intent) {
69         // No-op
70     }
71 
72     /**
73      * Caller of this method will receive immediate callback with the most recent state if state
74      * exists for given category.
75      *
76      * @param category category of the activity in the cluster,
77      *                         see {@link #CATEGORY_NAVIGATION}
78      * @param callback instance of {@link Callback} class to receive events.
79      *
80      * @deprecated see {@link CarInstrumentClusterManager} deprecation message
81      *
82      * @hide
83      */
84     @SystemApi
registerCallback(String category, Callback callback)85     public void registerCallback(String category, Callback callback) {
86         // No-op
87     }
88 
89     /**
90      * Unregisters given callback for all activity categories.
91      *
92      * @param callback previously registered callback
93      *
94      * @deprecated see {@link CarInstrumentClusterManager} deprecation message
95      *
96      * @hide
97      */
98     @SystemApi
unregisterCallback(Callback callback)99     public void unregisterCallback(Callback callback) {
100         // No-op
101     }
102 
103     /** @hide */
CarInstrumentClusterManager(Car car, IBinder service)104     public CarInstrumentClusterManager(Car car, IBinder service) {
105         super(car);
106         // No-op
107     }
108 
109     /**
110      * @deprecated activity state is not longer being reported. See
111      * {@link CarInstrumentClusterManager} deprecation message for more details.
112      *
113      * @hide
114      */
115     @Deprecated
116     @SystemApi
117     public interface Callback {
118         /**
119          * Notify client that activity state was changed.
120          *
121          * @param category cluster activity category, see {@link #CATEGORY_NAVIGATION}
122          * @param clusterActivityState see {@link ClusterActivityState} how to read this bundle.
123          */
onClusterActivityStateChanged(String category, Bundle clusterActivityState)124         void onClusterActivityStateChanged(String category, Bundle clusterActivityState);
125     }
126 
127     /** @hide */
128     @Override
onCarDisconnected()129     public void onCarDisconnected() {
130     }
131 }
132