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