1 /*
2  * Copyright (C) 2016 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 package android.car.cluster.renderer;
17 
18 import android.annotation.Nullable;
19 import android.annotation.SystemApi;
20 import android.annotation.UiThread;
21 import android.content.Context;
22 
23 import com.android.internal.annotations.GuardedBy;
24 
25 /**
26  * @deprecated This class is unused. Refer to {@link InstrumentClusterRenderingService} for
27  * documentation on how to build a instrument cluster renderer.
28  *
29  * @hide
30  */
31 @Deprecated
32 @SystemApi
33 public abstract class InstrumentClusterRenderer {
34 
35     private final Object mLock = new Object();
36 
37     @GuardedBy("mLock")
38     @Nullable private NavigationRenderer mNavigationRenderer;
39 
40     /**
41      * Called when instrument cluster renderer is created.
42      */
onCreate(Context context)43     public abstract void onCreate(Context context);
44 
45     /**
46      * Called when instrument cluster renderer is started.
47      */
onStart()48     public abstract void onStart();
49 
50     /**
51      * Called when instrument cluster renderer is stopped.
52      */
onStop()53     public abstract void onStop();
54 
createNavigationRenderer()55     protected abstract NavigationRenderer createNavigationRenderer();
56 
57     /** The method is thread-safe, callers should cache returned object. */
58     @Nullable
getNavigationRenderer()59     public NavigationRenderer getNavigationRenderer() {
60         synchronized (mLock) {
61             return mNavigationRenderer;
62         }
63     }
64 
65     /**
66      * This method is called by car service after onCreateView to initialize private members. The
67      * method should not be overridden by subclasses.
68      */
69     @UiThread
initialize()70     public final void initialize() {
71         synchronized (mLock) {
72             mNavigationRenderer = createNavigationRenderer();
73         }
74     }
75 }
76 
77