blob: 858613daf762068e1b6047f5058218c1394689d3 [file] [log] [blame]
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -08001/*
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 */
16package android.car.cluster.renderer;
17
18import android.annotation.Nullable;
19import android.annotation.SystemApi;
20import android.annotation.UiThread;
21import android.car.navigation.CarNavigationInstrumentCluster;
22import android.content.Context;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080023
24/**
25 * Interface for instrument cluster rendering.
26 *
27 * TODO: implement instrument cluster feature list and extend API.
28 *
29 * @hide
30 */
31@SystemApi
32public abstract class InstrumentClusterRenderer {
33
34 @Nullable private NavigationRenderer mNavigationRenderer;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080035
36 /**
37 * Calls once when instrument cluster should be created.
38 */
39 abstract public void onCreate(Context context);
40
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080041 abstract public void onStart();
42
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080043 abstract public void onStop();
44
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080045 abstract protected NavigationRenderer createNavigationRenderer();
46
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080047 /** The method is thread-safe, callers should cache returned object. */
48 @Nullable
49 public synchronized NavigationRenderer getNavigationRenderer() {
50 return mNavigationRenderer;
51 }
52
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080053 /**
54 * This method is called by car service after onCreateView to initialize private members. The
55 * method should not be overridden by subclasses.
56 */
57 @UiThread
58 public synchronized final void initialize() {
59 mNavigationRenderer = createNavigationRenderer();
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080060 }
61}