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.loggingrenderer; 17 18 import android.car.cluster.renderer.InstrumentClusterRenderingService; 19 import android.car.cluster.renderer.NavigationRenderer; 20 import android.car.navigation.CarNavigationInstrumentCluster; 21 import android.graphics.Bitmap; 22 import android.os.Bundle; 23 import android.util.Log; 24 import com.google.android.collect.Lists; 25 26 /** 27 * Dummy implementation of {@link LoggingClusterRenderingService} to log all interaction. 28 */ 29 public class LoggingClusterRenderingService extends InstrumentClusterRenderingService { 30 31 private static final String TAG = LoggingClusterRenderingService.class.getSimpleName(); 32 33 @Override getNavigationRenderer()34 protected NavigationRenderer getNavigationRenderer() { 35 NavigationRenderer navigationRenderer = new NavigationRenderer() { 36 @Override 37 public CarNavigationInstrumentCluster getNavigationProperties() { 38 Log.i(TAG, "getNavigationProperties"); 39 CarNavigationInstrumentCluster config = 40 CarNavigationInstrumentCluster.createCluster(1000); 41 config.getExtra().putIntegerArrayList("dummy", Lists.newArrayList(1, 2, 3, 4)); 42 Log.i(TAG, "getNavigationProperties, returns: " + config); 43 return config; 44 } 45 46 47 @Override 48 public void onStartNavigation() { 49 Log.i(TAG, "onStartNavigation"); 50 } 51 52 @Override 53 public void onStopNavigation() { 54 Log.i(TAG, "onStopNavigation"); 55 } 56 57 @Override 58 public void onNextTurnChanged(int event, CharSequence eventName, int turnAngle, 59 int turnNumber, Bitmap image, int turnSide) { 60 Log.i(TAG, "event: " + event + ", eventName: " + eventName + 61 ", turnAngle: " + turnAngle + ", turnNumber: " + turnNumber + 62 ", image: " + image + ", turnSide: " + turnSide); 63 } 64 65 @Override 66 public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds, 67 int displayDistanceMillis, int displayDistanceUnit) { 68 Log.i(TAG, "onNextTurnDistanceChanged, distanceMeters: " + distanceMeters 69 + ", timeSeconds: " + timeSeconds 70 + ", displayDistanceMillis: " + displayDistanceMillis 71 + ", displayDistanceUnit: " + displayDistanceUnit); 72 } 73 74 @Override 75 public void onEvent(int eventType, Bundle bundle) { 76 Log.i(TAG, "onEvent, eventType: " + eventType + ", bundle: " + bundle); 77 } 78 }; 79 80 Log.i(TAG, "createNavigationRenderer, returns: " + navigationRenderer); 81 return navigationRenderer; 82 } 83 } 84