1d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev/* 2d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Copyright (C) 2016 The Android Open Source Project 3d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 4d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Licensed under the Apache License, Version 2.0 (the "License"); 5d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * you may not use this file except in compliance with the License. 6d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * You may obtain a copy of the License at 7d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 8d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * http://www.apache.org/licenses/LICENSE-2.0 9d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 10d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Unless required by applicable law or agreed to in writing, software 11d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * distributed under the License is distributed on an "AS IS" BASIS, 12d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * See the License for the specific language governing permissions and 14d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * limitations under the License. 15d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 161ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevpackage android.car.cluster.renderer; 17d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 181ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevimport android.annotation.Nullable; 19d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.annotation.SystemApi; 201ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevimport android.annotation.UiThread; 21d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.car.navigation.CarNavigationInstrumentCluster; 22d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.content.Context; 23d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 24d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev/** 25d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Interface for instrument cluster rendering. 26d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 27f9215209e0f425d2fc570bef37dad959c82d2e9eKeun-young Park * TODO: implement instrument cluster feature list and extend API. bug: 32060603 28d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 29d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * @hide 30d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 31d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev@SystemApi 32d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevpublic abstract class InstrumentClusterRenderer { 33d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 341ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @Nullable private NavigationRenderer mNavigationRenderer; 35d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 36d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev /** 37d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Calls once when instrument cluster should be created. 38d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 391ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev abstract public void onCreate(Context context); 40d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 41d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract public void onStart(); 42d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 43d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract public void onStop(); 44d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 45d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract protected NavigationRenderer createNavigationRenderer(); 46d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 471ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev /** The method is thread-safe, callers should cache returned object. */ 481ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @Nullable 491ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev public synchronized NavigationRenderer getNavigationRenderer() { 50d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev return mNavigationRenderer; 51d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev } 521ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev 531ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev /** 541ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev * This method is called by car service after onCreateView to initialize private members. The 551ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev * method should not be overridden by subclasses. 561ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev */ 571ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 581ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev public synchronized final void initialize() { 591ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev mNavigationRenderer = createNavigationRenderer(); 601ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev } 61d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev} 62