blob: c51ee15e37d8864e16bceaecb525a936aa991777 [file] [log] [blame]
keunyounga3b28d82015-08-25 13:05:15 -07001/*
2 * Copyright (C) 2015 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 com.android.car;
17
Keun-young Parke54ac272016-02-16 19:02:18 -080018import android.car.CarInfoManager;
19import android.car.ICarInfo;
20import android.car.annotation.ValueTypeDef;
keunyounga3b28d82015-08-25 13:05:15 -070021import android.content.Context;
Keun-young Park064ddd82015-12-21 23:57:50 +000022import android.os.Bundle;
keunyounga3b28d82015-08-25 13:05:15 -070023import android.provider.Settings;
keunyounga3b28d82015-08-25 13:05:15 -070024
25import com.android.car.hal.InfoHalService;
26import com.android.car.hal.VehicleHal;
27
28import java.io.PrintWriter;
29import java.lang.reflect.Field;
30import java.util.HashMap;
31import java.util.Map;
32
33public class CarInfoService extends ICarInfo.Stub implements CarServiceBase {
34
keunyounga3b28d82015-08-25 13:05:15 -070035 private final InfoHalService mInfoHal;
keunyounga3b28d82015-08-25 13:05:15 -070036 private final Context mContext;
37
38 public CarInfoService(Context context) {
keunyoungfe30ba02015-09-17 17:56:35 -070039 mInfoHal = VehicleHal.getInstance().getInfoHal();
keunyounga3b28d82015-08-25 13:05:15 -070040 mContext = context;
41 }
42
43 @Override
Keun-young Park67456352016-10-03 13:45:19 -070044 public Bundle getBasicInfo() {
45 return mInfoHal.getBasicInfo();
Keun-young Park064ddd82015-12-21 23:57:50 +000046 }
47
48 @Override
keunyounga3b28d82015-08-25 13:05:15 -070049 public void init() {
Keun-young Park67456352016-10-03 13:45:19 -070050 Bundle info = mInfoHal.getBasicInfo();
51 // do not update ID immediately even if user clears it.
52 info.putString(CarInfoManager.BASIC_INFO_KEY_VEHICLE_ID,
53 Settings.Secure.getString(mContext.getContentResolver(),
54 Settings.Secure.ANDROID_ID));
keunyounga3b28d82015-08-25 13:05:15 -070055 }
56
57 @Override
58 public synchronized void release() {
Keun-young Park67456352016-10-03 13:45:19 -070059 //nothing to do
keunyounga3b28d82015-08-25 13:05:15 -070060 }
61
62 @Override
63 public void dump(PrintWriter writer) {
64 writer.println("*CarInfoService*");
Keun-young Park67456352016-10-03 13:45:19 -070065 writer.println("**Check HAL dump");
keunyounga3b28d82015-08-25 13:05:15 -070066 }
67}
Keun-young Park67456352016-10-03 13:45:19 -070068