• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.util.Log;
23 
24 /**
25  * Dummy implementation of {@link LoggingClusterRenderingService} to log all interaction.
26  */
27 public class LoggingClusterRenderingService extends InstrumentClusterRenderingService {
28 
29     private static final String TAG = LoggingClusterRenderingService.class.getSimpleName();
30 
31     @Override
getNavigationRenderer()32     protected NavigationRenderer getNavigationRenderer() {
33         NavigationRenderer navigationRenderer = new NavigationRenderer() {
34             @Override
35             public CarNavigationInstrumentCluster getNavigationProperties() {
36                 Log.i(TAG, "getNavigationProperties");
37                 CarNavigationInstrumentCluster config =
38                         CarNavigationInstrumentCluster.createCluster(1000);
39                 Log.i(TAG, "getNavigationProperties, returns: " + config);
40                 return config;
41             }
42 
43 
44             @Override
45             public void onStartNavigation() {
46                 Log.i(TAG, "onStartNavigation");
47             }
48 
49             @Override
50             public void onStopNavigation() {
51                 Log.i(TAG, "onStopNavigation");
52             }
53 
54             @Override
55             public void onNextTurnChanged(int event, CharSequence eventName, int turnAngle,
56                     int turnNumber, Bitmap image, int turnSide) {
57                 Log.i(TAG, "event: " + event + ", eventName: " + eventName +
58                         ", turnAngle: " + turnAngle + ", turnNumber: " + turnNumber +
59                         ", image: " + image + ", turnSide: " + turnSide);
60             }
61 
62             @Override
63             public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds,
64                     int displayDistanceMillis, int displayDistanceUnit) {
65                 Log.i(TAG, "onNextTurnDistanceChanged, distanceMeters: " + distanceMeters
66                         + ", timeSeconds: " + timeSeconds
67                         + ", displayDistanceMillis: " + displayDistanceMillis
68                         + ", displayDistanceUnit: " + displayDistanceUnit);
69             }
70         };
71 
72         Log.i(TAG, "createNavigationRenderer, returns: " + navigationRenderer);
73         return navigationRenderer;
74     }
75 }
76