• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.settings;
18 
19 import android.car.CarManagerBase;
20 import android.car.CarNotConnectedException;
21 import android.os.IBinder;
22 import android.os.RemoteException;
23 import android.util.Log;
24 
25 /**
26  * Manager that exposes car configuration values that are stored on the system.
27  */
28 public class CarConfigurationManager implements CarManagerBase {
29     private static final String TAG = "CarConfigurationManager";
30 
31     private final ICarConfigurationManager mConfigurationService;
32 
33     /** @hide */
CarConfigurationManager(IBinder service)34     public CarConfigurationManager(IBinder service) {
35         mConfigurationService = ICarConfigurationManager.Stub.asInterface(service);
36     }
37 
38     /**
39      * Returns a configuration for Speed Bump that will determine when it kicks in.
40      *
41      * @return A {@link SpeedBumpConfiguration} that contains the configuration values.
42      * @throws CarNotConnectedException If the configuration cannot be retrieved.
43      */
getSpeedBumpConfiguration()44     public SpeedBumpConfiguration getSpeedBumpConfiguration() throws CarNotConnectedException {
45         try {
46             return mConfigurationService.getSpeedBumpConfiguration();
47         } catch (RemoteException e) {
48             Log.e(TAG, "Could not retrieve SpeedBumpConfiguration", e);
49             throw new CarNotConnectedException(e);
50         }
51     }
52 
53     /** @hide */
54     @Override
onCarDisconnected()55     public void onCarDisconnected() {
56         // Nothing to release.
57     }
58 }
59