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 */
16package android.car.cluster.loggingrenderer;
17
18import android.car.cluster.renderer.InstrumentClusterRenderingService;
19import android.car.cluster.renderer.NavigationRenderer;
20import android.car.navigation.CarNavigationInstrumentCluster;
21import android.graphics.Bitmap;
22import android.os.Bundle;
23import android.util.Log;
24import com.google.android.collect.Lists;
25
26/**
27 * Dummy implementation of {@link LoggingClusterRenderingService} to log all interaction.
28 */
29public class LoggingClusterRenderingService extends InstrumentClusterRenderingService {
30
31    private static final String TAG = LoggingClusterRenderingService.class.getSimpleName();
32
33    @Override
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            @Override
47            public void onEvent(int eventType, Bundle bundle) {
48                Log.i(TAG, "onEvent, eventType: " + eventType + ", bundle: " + bundle);
49            }
50        };
51
52        Log.i(TAG, "createNavigationRenderer, returns: " + navigationRenderer);
53        return navigationRenderer;
54    }
55}
56