• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 
17 package android.car.testapi;
18 
19 import android.car.cluster.renderer.IInstrumentClusterNavigation;
20 import android.car.navigation.CarNavigationInstrumentCluster;
21 import android.os.Bundle;
22 
23 /**
24  * Fake implementation of {@link IInstrumentClusterNavigation} used by FakeCar.
25  *
26  * @hide
27  */
28 public class FakeInstrumentClusterNavigation extends IInstrumentClusterNavigation.Stub
29         implements CarNavigationStatusController {
30     private static final int DEFAULT_MIN_UPDATE_INTERVAL_MILLIS = 1000;
31 
32     private Bundle mCurrentNavigationState;
33     private CarNavigationInstrumentCluster mCarNavigationInstrumentCluster =
34             CarNavigationInstrumentCluster.createCluster(DEFAULT_MIN_UPDATE_INTERVAL_MILLIS);
35 
36     @Override
onNavigationStateChanged(Bundle bundle)37     public void onNavigationStateChanged(Bundle bundle) {
38         mCurrentNavigationState = bundle;
39     }
40 
41     @Override
getInstrumentClusterInfo()42     public CarNavigationInstrumentCluster getInstrumentClusterInfo() {
43         return mCarNavigationInstrumentCluster;
44     }
45 
46 
47     //********************** CarNavigationStatusController implementation *************************/
48     @Override
getCurrentNavState()49     public Bundle getCurrentNavState() {
50         return mCurrentNavigationState;
51     }
52 
53     @Override
setImageCodeClusterInfo(int minIntervalMillis)54     public void setImageCodeClusterInfo(int minIntervalMillis) {
55         mCarNavigationInstrumentCluster =
56                 CarNavigationInstrumentCluster.createCluster(minIntervalMillis);
57     }
58 
59     @Override
setCustomImageClusterInfo( int minIntervalMillis, int imageWidth, int imageHeight, int imageColorDepthBits)60     public void setCustomImageClusterInfo(
61             int minIntervalMillis,
62             int imageWidth,
63             int imageHeight,
64             int imageColorDepthBits) {
65         mCarNavigationInstrumentCluster =
66                 CarNavigationInstrumentCluster
67                         .createCustomImageCluster(
68                                 minIntervalMillis, imageWidth, imageHeight, imageColorDepthBits);
69     }
70 }
71