blob: ad9b6826823987277aaf1fe509d75d5dcffb955b [file] [log] [blame]
keunyoungca515072015-07-10 12:21:47 -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 */
16
17package com.android.car;
18
Pavel Maltsevabd47232017-10-10 16:54:57 -070019import android.annotation.MainThread;
Yao Chene33f07e2016-07-26 12:02:51 -070020import android.app.UiModeManager;
Keun-young Parke54ac272016-02-16 19:02:18 -080021import android.car.Car;
22import android.car.ICar;
Pavel Maltsev0477e292016-05-27 12:22:36 -070023import android.car.cluster.renderer.IInstrumentClusterNavigation;
Ying Zheng9fc99402018-09-19 14:23:59 -070024import android.car.userlib.CarUserManagerHelper;
keunyoungca515072015-07-10 12:21:47 -070025import android.content.Context;
keunyoung1ab8e182015-09-24 09:25:22 -070026import android.content.pm.PackageManager;
Pavel Maltsevcfe93102017-02-02 12:38:08 -080027import android.hardware.automotive.vehicle.V2_0.IVehicle;
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -080028import android.hardware.automotive.vehicle.V2_0.VehicleArea;
Keun-young Parkaab47cd2017-06-05 11:04:50 -070029import android.os.Binder;
Enrico Granatae8056ca2018-04-03 13:19:52 -070030import android.os.Build;
keunyoungca515072015-07-10 12:21:47 -070031import android.os.IBinder;
Keun-young Parkaab47cd2017-06-05 11:04:50 -070032import android.os.Process;
Steve Paikc302c7c2017-08-04 14:01:58 -070033import android.os.Trace;
keunyoungca515072015-07-10 12:21:47 -070034import android.util.Log;
Steve Paikc302c7c2017-08-04 14:01:58 -070035import android.util.Slog;
Keun-young Park4a79a382017-08-10 18:19:14 -070036import android.util.TimingsTraceLog;
Gregory Clark26fa6012018-03-14 18:38:56 -070037
Hongwei Wang38549092018-08-22 12:32:42 -070038import com.android.car.audio.CarAudioService;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080039import com.android.car.cluster.InstrumentClusterService;
Serik Beketayev06a66682018-06-12 16:54:29 -070040import com.android.car.garagemode.GarageModeService;
keunyoungcc449f72015-08-12 10:46:27 -070041import com.android.car.hal.VehicleHal;
Antonio Cortesc52d5f92017-02-06 08:47:38 -080042import com.android.car.internal.FeatureConfiguration;
Keun-young Park4aeb4bf2015-12-08 18:31:33 -080043import com.android.car.pm.CarPackageManagerService;
Enrico Granatab19bc322017-10-12 12:25:06 -070044import com.android.car.systeminterface.SystemInterface;
Ram Periathiruvadide0ca082019-03-20 11:16:44 -070045import com.android.car.trust.CarTrustedDeviceService;
Ying Zheng86d1c3e2018-05-11 11:42:48 -070046import com.android.car.user.CarUserService;
Mark Tabry76cfaaa2019-02-01 14:28:30 -080047import com.android.car.vms.VmsBrokerService;
Mark Tabrya8fce562019-01-16 16:24:01 -080048import com.android.car.vms.VmsClientManager;
keunyoungca515072015-07-10 12:21:47 -070049import com.android.internal.annotations.GuardedBy;
Steve Paik1d8bea22018-02-03 01:54:06 +000050import com.android.internal.car.ICarServiceHelper;
Gregory Clark26fa6012018-03-14 18:38:56 -070051
Enrico Granatae8056ca2018-04-03 13:19:52 -070052import java.io.FileDescriptor;
keunyounga3b28d82015-08-25 13:05:15 -070053import java.io.PrintWriter;
Ying Zheng86d1c3e2018-05-11 11:42:48 -070054import java.util.ArrayList;
Antonio Cortese4619c72017-02-02 07:53:27 -080055import java.util.Arrays;
Ying Zheng86d1c3e2018-05-11 11:42:48 -070056import java.util.List;
keunyounga3b28d82015-08-25 13:05:15 -070057
keunyoungca515072015-07-10 12:21:47 -070058public class ICarImpl extends ICar.Stub {
keunyoungca515072015-07-10 12:21:47 -070059
Ram Periathiruvadi49d5a5a2017-02-17 18:50:09 -080060 public static final String INTERNAL_INPUT_SERVICE = "internal_input";
Keun-young Park4727da32016-05-31 10:00:51 -070061 public static final String INTERNAL_SYSTEM_ACTIVITY_MONITORING_SERVICE =
62 "system_activity_monitoring";
Keun-young Parka28d7b22016-02-29 16:54:29 -080063
keunyoungca515072015-07-10 12:21:47 -070064 private final Context mContext;
Pavel Maltsevec83b632017-01-05 15:10:55 -080065 private final VehicleHal mHal;
keunyoungca515072015-07-10 12:21:47 -070066
Anthony Chen12aec302018-04-25 16:41:48 -070067 private final SystemInterface mSystemInterface;
68
Keun-young Park4727da32016-05-31 10:00:51 -070069 private final SystemActivityMonitoringService mSystemActivityMonitoringService;
keunyoung4b0212c2015-10-29 17:11:57 -070070 private final CarPowerManagementService mCarPowerManagementService;
Keun-young Parka28d7b22016-02-29 16:54:29 -080071 private final CarPackageManagerService mCarPackageManagerService;
72 private final CarInputService mCarInputService;
Ram Periathiruvadi25c16f12017-11-17 16:48:37 -080073 private final CarDrivingStateService mCarDrivingStateService;
Ram Periathiruvadi4526a432018-01-24 13:00:54 -080074 private final CarUxRestrictionsManagerService mCarUXRestrictionsService;
keunyoungd32f4e62015-09-21 11:33:06 -070075 private final CarAudioService mCarAudioService;
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -080076 private final CarProjectionService mCarProjectionService;
Steve Paik9ec53d72018-04-27 13:28:31 -070077 private final CarPropertyService mCarPropertyService;
Joseph Pirozzo317343d2016-01-25 10:22:37 -080078 private final CarNightService mCarNightService;
Vitalii Tomkiv46371472016-05-23 16:55:22 -070079 private final AppFocusService mAppFocusService;
Yao Chen3a7976d2016-01-20 17:27:08 -080080 private final GarageModeService mGarageModeService;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080081 private final InstrumentClusterService mInstrumentClusterService;
Gregory Clarkd8136062017-12-11 14:27:53 -080082 private final CarLocationService mCarLocationService;
Keun-young Parkd73afae2016-04-08 20:03:32 -070083 private final SystemStateControllerService mSystemStateControllerService;
Ram Periathiruvadi7ed84182017-01-20 15:18:08 -080084 private final CarBluetoothService mCarBluetoothService;
Ram Periathiruvadiacb60242017-04-13 16:19:09 -070085 private final PerUserCarServiceHelper mPerUserCarServiceHelper;
Enrico Granata9a916d72017-09-19 14:33:08 -070086 private final CarDiagnosticService mCarDiagnosticService;
87 private final CarStorageMonitoringService mCarStorageMonitoringService;
Anthony Chen12aec302018-04-25 16:41:48 -070088 private final CarConfigurationService mCarConfigurationService;
Ram Periathiruvadide0ca082019-03-20 11:16:44 -070089 private final CarTrustedDeviceService mCarTrustedDeviceService;
Simon Dai527eb552019-02-12 13:06:15 -080090 private final CarMediaService mCarMediaService;
Ying Zheng86d1c3e2018-05-11 11:42:48 -070091 private final CarUserManagerHelper mUserManagerHelper;
Keun-young Parkd462a912019-02-11 08:53:42 -080092 private final CarUserService mCarUserService;
Mark Tabrya8fce562019-01-16 16:24:01 -080093 private final VmsClientManager mVmsClientManager;
Mark Tabry76cfaaa2019-02-01 14:28:30 -080094 private final VmsBrokerService mVmsBrokerService;
Mark Tabrya8fce562019-01-16 16:24:01 -080095 private final VmsSubscriberService mVmsSubscriberService;
96 private final VmsPublisherService mVmsPublisherService;
keunyounga74b9ca2015-10-21 13:33:58 -070097
Pavel Maltsev0d07c762016-11-03 16:40:15 -070098 private final CarServiceBase[] mAllServices;
99
Steve Paikc302c7c2017-08-04 14:01:58 -0700100 private static final String TAG = "ICarImpl";
101 private static final String VHAL_TIMING_TAG = "VehicleHalTiming";
Serik Beketayev74debf22018-10-04 12:18:09 -0700102
103 private TimingsTraceLog mBootTiming;
Steve Paikc302c7c2017-08-04 14:01:58 -0700104
keunyoung1ab8e182015-09-24 09:25:22 -0700105 /** Test only service. Populate it only when necessary. */
106 @GuardedBy("this")
107 private CarTestService mCarTestService;
keunyoungca515072015-07-10 12:21:47 -0700108
Keun-young Parkaab47cd2017-06-05 11:04:50 -0700109 @GuardedBy("this")
110 private ICarServiceHelper mICarServiceHelper;
111
Enrico Granatae8056ca2018-04-03 13:19:52 -0700112 private final String mVehicleInterfaceName;
113
Pavel Maltsevec83b632017-01-05 15:10:55 -0800114 public ICarImpl(Context serviceContext, IVehicle vehicle, SystemInterface systemInterface,
Enrico Granatae8056ca2018-04-03 13:19:52 -0700115 CanBusErrorNotifier errorNotifier, String vehicleInterfaceName) {
keunyoungca515072015-07-10 12:21:47 -0700116 mContext = serviceContext;
Steve Paik0f9fc002018-02-09 17:42:00 -0800117 mSystemInterface = systemInterface;
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700118 mHal = new VehicleHal(vehicle);
Enrico Granatae8056ca2018-04-03 13:19:52 -0700119 mVehicleInterfaceName = vehicleInterfaceName;
Yao, Yuxing0811d5a2018-11-29 16:18:53 -0800120 mUserManagerHelper = new CarUserManagerHelper(serviceContext);
Keun-young Parkd462a912019-02-11 08:53:42 -0800121 mCarUserService = new CarUserService(serviceContext, mUserManagerHelper);
Keun-young Park4727da32016-05-31 10:00:51 -0700122 mSystemActivityMonitoringService = new SystemActivityMonitoringService(serviceContext);
Steve Paik388d7772018-02-12 10:54:51 -0800123 mCarPowerManagementService = new CarPowerManagementService(mContext, mHal.getPowerHal(),
Keun young Park9b3f2662019-03-19 10:30:25 -0700124 systemInterface, mUserManagerHelper);
Steve Paik9ec53d72018-04-27 13:28:31 -0700125 mCarPropertyService = new CarPropertyService(serviceContext, mHal.getPropertyHal());
126 mCarDrivingStateService = new CarDrivingStateService(serviceContext, mCarPropertyService);
Ram Periathiruvadi4526a432018-01-24 13:00:54 -0800127 mCarUXRestrictionsService = new CarUxRestrictionsManagerService(serviceContext,
Yao, Yuxing9bfb7492019-02-15 11:53:34 -0800128 mCarDrivingStateService, mCarPropertyService);
Ram Periathiruvadi2da6d0e2018-01-26 18:02:10 -0800129 mCarPackageManagerService = new CarPackageManagerService(serviceContext,
130 mCarUXRestrictionsService,
Keun-young Park4727da32016-05-31 10:00:51 -0700131 mSystemActivityMonitoringService);
Justin Paupore44985ba2019-01-30 18:53:41 -0800132 mPerUserCarServiceHelper = new PerUserCarServiceHelper(serviceContext);
133 mCarBluetoothService = new CarBluetoothService(serviceContext, mCarPropertyService,
134 mPerUserCarServiceHelper, mCarUXRestrictionsService);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700135 mCarInputService = new CarInputService(serviceContext, mHal.getInputHal());
Justin Paupore44985ba2019-01-30 18:53:41 -0800136 mCarProjectionService = new CarProjectionService(
Pavel Maltsev079873b2019-02-25 12:15:09 -0800137 serviceContext, null /* handler */, mCarInputService, mCarBluetoothService);
Serik Beketayevc6ab8be2018-08-28 21:20:53 -0700138 mGarageModeService = new GarageModeService(mContext);
Vitalii Tomkiv8c7f2972016-07-11 15:42:04 -0700139 mAppFocusService = new AppFocusService(serviceContext, mSystemActivityMonitoringService);
Hongwei Wang30557232018-01-02 10:25:08 -0800140 mCarAudioService = new CarAudioService(serviceContext);
Steve Paik9ec53d72018-04-27 13:28:31 -0700141 mCarNightService = new CarNightService(serviceContext, mCarPropertyService);
Pavel Maltsev0477e292016-05-27 12:22:36 -0700142 mInstrumentClusterService = new InstrumentClusterService(serviceContext,
Pavel Maltsev03cf60c2016-06-27 15:11:51 -0700143 mAppFocusService, mCarInputService);
Serik Beketayevf9f2ef02018-09-06 12:37:02 -0700144 mSystemStateControllerService = new SystemStateControllerService(
145 serviceContext, mCarAudioService, this);
Mark Tabry76cfaaa2019-02-01 14:28:30 -0800146 mVmsBrokerService = new VmsBrokerService();
Mark Tabry1534c062019-03-29 01:30:49 -0700147 mVmsClientManager = new VmsClientManager(
148 serviceContext, mUserManagerHelper, mHal.getVmsHal());
Mark Tabry76cfaaa2019-02-01 14:28:30 -0800149 mVmsSubscriberService = new VmsSubscriberService(
150 serviceContext, mVmsBrokerService, mHal.getVmsHal());
151 mVmsPublisherService = new VmsPublisherService(
Mark Tabry1534c062019-03-29 01:30:49 -0700152 serviceContext, mVmsBrokerService, mVmsClientManager);
Enrico Granatab3634e22017-05-05 18:02:31 -0700153 mCarDiagnosticService = new CarDiagnosticService(serviceContext, mHal.getDiagnosticHal());
Enrico Granata517a1e02017-09-20 16:15:50 -0700154 mCarStorageMonitoringService = new CarStorageMonitoringService(serviceContext,
155 systemInterface);
Anthony Chen12aec302018-04-25 16:41:48 -0700156 mCarConfigurationService =
157 new CarConfigurationService(serviceContext, new JsonReaderImpl());
Gregory Clarka440e812019-02-14 16:05:51 -0800158 mCarLocationService = new CarLocationService(mContext, mCarPropertyService,
159 mUserManagerHelper);
Ram Periathiruvadide0ca082019-03-20 11:16:44 -0700160 mCarTrustedDeviceService = new CarTrustedDeviceService(serviceContext);
Simon Dai527eb552019-02-12 13:06:15 -0800161 mCarMediaService = new CarMediaService(serviceContext);
keunyounga74b9ca2015-10-21 13:33:58 -0700162
Keun-young Parkd462a912019-02-11 08:53:42 -0800163 CarLocalServices.addService(CarUserService.class, mCarUserService);
Ram Periathiruvadide0ca082019-03-20 11:16:44 -0700164 Log.d(TAG, "Adding CarTrustedDeviceService");
165 CarLocalServices.addService(CarTrustedDeviceService.class,
166 mCarTrustedDeviceService);
Gregory Clarka440e812019-02-14 16:05:51 -0800167 CarLocalServices.addService(SystemInterface.class, mSystemInterface);
Keun-young Parkd462a912019-02-11 08:53:42 -0800168
keunyounga3b28d82015-08-25 13:05:15 -0700169 // Be careful with order. Service depending on other service should be inited later.
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700170 List<CarServiceBase> allServices = new ArrayList<>();
Keun-young Parkd462a912019-02-11 08:53:42 -0800171 allServices.add(mCarUserService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700172 allServices.add(mSystemActivityMonitoringService);
173 allServices.add(mCarPowerManagementService);
174 allServices.add(mCarPropertyService);
175 allServices.add(mCarDrivingStateService);
176 allServices.add(mCarUXRestrictionsService);
177 allServices.add(mCarPackageManagerService);
178 allServices.add(mCarInputService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700179 allServices.add(mGarageModeService);
180 allServices.add(mAppFocusService);
181 allServices.add(mCarAudioService);
182 allServices.add(mCarNightService);
183 allServices.add(mInstrumentClusterService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700184 allServices.add(mSystemStateControllerService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700185 allServices.add(mPerUserCarServiceHelper);
Justin Paupore44985ba2019-01-30 18:53:41 -0800186 allServices.add(mCarBluetoothService);
187 allServices.add(mCarProjectionService);
188 allServices.add(mCarDiagnosticService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700189 allServices.add(mCarStorageMonitoringService);
190 allServices.add(mCarConfigurationService);
Mark Tabrya8fce562019-01-16 16:24:01 -0800191 allServices.add(mVmsClientManager);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700192 allServices.add(mVmsSubscriberService);
193 allServices.add(mVmsPublisherService);
Ram Periathiruvadide0ca082019-03-20 11:16:44 -0700194 allServices.add(mCarTrustedDeviceService);
Simon Dai527eb552019-02-12 13:06:15 -0800195 allServices.add(mCarMediaService);
Gregory Clarka63ba022018-06-07 16:42:12 -0700196 allServices.add(mCarLocationService);
Ying Zheng86d1c3e2018-05-11 11:42:48 -0700197 mAllServices = allServices.toArray(new CarServiceBase[allServices.size()]);
keunyoungca515072015-07-10 12:21:47 -0700198 }
199
Pavel Maltsevabd47232017-10-10 16:54:57 -0700200 @MainThread
Pavel Maltsev8edd2552017-09-18 14:52:16 -0700201 void init() {
Serik Beketayev74debf22018-10-04 12:18:09 -0700202 mBootTiming = new TimingsTraceLog(VHAL_TIMING_TAG, Trace.TRACE_TAG_HAL);
Steve Paikc302c7c2017-08-04 14:01:58 -0700203 traceBegin("VehicleHal.init");
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700204 mHal.init();
Steve Paikc302c7c2017-08-04 14:01:58 -0700205 traceEnd();
206 traceBegin("CarService.initAllServices");
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800207 for (CarServiceBase service : mAllServices) {
keunyounga3b28d82015-08-25 13:05:15 -0700208 service.init();
209 }
Steve Paikc302c7c2017-08-04 14:01:58 -0700210 traceEnd();
keunyoungca515072015-07-10 12:21:47 -0700211 }
212
Pavel Maltsev8edd2552017-09-18 14:52:16 -0700213 void release() {
keunyounga3b28d82015-08-25 13:05:15 -0700214 // release done in opposite order from init
215 for (int i = mAllServices.length - 1; i >= 0; i--) {
216 mAllServices[i].release();
217 }
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700218 mHal.release();
Keun-young Parkd462a912019-02-11 08:53:42 -0800219 CarLocalServices.removeAllServices();
keunyoung1ab8e182015-09-24 09:25:22 -0700220 }
221
Pavel Maltsev8edd2552017-09-18 14:52:16 -0700222 void vehicleHalReconnected(IVehicle vehicle) {
Pavel Maltsevec83b632017-01-05 15:10:55 -0800223 mHal.vehicleHalReconnected(vehicle);
224 for (CarServiceBase service : mAllServices) {
225 service.vehicleHalReconnected();
226 }
227 }
228
keunyoungca515072015-07-10 12:21:47 -0700229 @Override
Keun-young Parkaab47cd2017-06-05 11:04:50 -0700230 public void setCarServiceHelper(IBinder helper) {
Pavel Maltsev17e81832019-04-04 14:38:41 -0700231 assertCallingFromSystemProcess();
Keun-young Parkaab47cd2017-06-05 11:04:50 -0700232 synchronized (this) {
233 mICarServiceHelper = ICarServiceHelper.Stub.asInterface(helper);
Steve Paik0f9fc002018-02-09 17:42:00 -0800234 mSystemInterface.setCarServiceHelper(mICarServiceHelper);
Keun-young Parkaab47cd2017-06-05 11:04:50 -0700235 }
236 }
237
238 @Override
Keun-young Parkd462a912019-02-11 08:53:42 -0800239 public void setUserLockStatus(int userHandle, int unlocked) {
Pavel Maltsev17e81832019-04-04 14:38:41 -0700240 assertCallingFromSystemProcess();
241 mCarUserService.setUserLockStatus(userHandle, unlocked == 1);
242 }
243
244 @Override
245 public void onSwitchUser(int userHandle) {
246 assertCallingFromSystemProcess();
247
248 Log.i(TAG, "Foreground user switched to " + userHandle);
249 mCarUserService.onSwitchUser(userHandle);
250 }
251
252 private static void assertCallingFromSystemProcess() {
Keun-young Parkd462a912019-02-11 08:53:42 -0800253 int uid = Binder.getCallingUid();
254 if (uid != Process.SYSTEM_UID) {
255 throw new SecurityException("Only allowed from system");
256 }
Keun-young Parkd462a912019-02-11 08:53:42 -0800257 }
258
259 @Override
keunyoungca515072015-07-10 12:21:47 -0700260 public IBinder getCarService(String serviceName) {
261 switch (serviceName) {
Keun-young Park5672e852016-02-09 19:53:48 -0800262 case Car.AUDIO_SERVICE:
263 return mCarAudioService;
Vitalii Tomkiv46371472016-05-23 16:55:22 -0700264 case Car.APP_FOCUS_SERVICE:
265 return mAppFocusService;
Keun-young Park45fdcba2015-12-08 11:38:58 -0800266 case Car.PACKAGE_SERVICE:
267 return mCarPackageManagerService;
Enrico Granata5c56d2a2017-02-07 15:38:12 -0800268 case Car.DIAGNOSTIC_SERVICE:
Enrico Granatab3634e22017-05-05 18:02:31 -0700269 assertAnyDiagnosticPermission(mContext);
270 return mCarDiagnosticService;
Steve Paik388d7772018-02-12 10:54:51 -0800271 case Car.POWER_SERVICE:
272 assertPowerPermission(mContext);
273 return mCarPowerManagementService;
Steve Paik9ec53d72018-04-27 13:28:31 -0700274 case Car.CABIN_SERVICE:
275 case Car.HVAC_SERVICE:
276 case Car.INFO_SERVICE:
277 case Car.PROPERTY_SERVICE:
278 case Car.SENSOR_SERVICE:
279 case Car.VENDOR_EXTENSION_SERVICE:
280 return mCarPropertyService;
Pavel Maltsev7a948e52016-02-02 23:30:14 -0800281 case Car.CAR_NAVIGATION_SERVICE:
Keun-young Parke31a8b22016-03-16 17:34:08 -0700282 assertNavigationManagerPermission(mContext);
Pavel Maltsev0477e292016-05-27 12:22:36 -0700283 IInstrumentClusterNavigation navService =
284 mInstrumentClusterService.getNavigationService();
285 return navService == null ? null : navService.asBinder();
Pavel Maltsev905968c2017-07-16 19:48:57 -0700286 case Car.CAR_INSTRUMENT_CLUSTER_SERVICE:
287 assertClusterManagerPermission(mContext);
288 return mInstrumentClusterService.getManagerService();
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800289 case Car.PROJECTION_SERVICE:
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800290 return mCarProjectionService;
Antonio Cortese4619c72017-02-02 07:53:27 -0800291 case Car.VMS_SUBSCRIBER_SERVICE:
Asaf Rosenfeld39e4f032017-09-16 11:33:50 -0700292 assertVmsSubscriberPermission(mContext);
293 return mVmsSubscriberService;
Keun-young Parke54ac272016-02-16 19:02:18 -0800294 case Car.TEST_SERVICE: {
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700295 assertPermission(mContext, Car.PERMISSION_CAR_TEST_SERVICE);
keunyoung1ab8e182015-09-24 09:25:22 -0700296 synchronized (this) {
297 if (mCarTestService == null) {
298 mCarTestService = new CarTestService(mContext, this);
299 }
300 return mCarTestService;
301 }
302 }
Ram Periathiruvadi76a84892017-07-27 18:10:35 -0700303 case Car.BLUETOOTH_SERVICE:
304 return mCarBluetoothService;
Enrico Granata9a916d72017-09-19 14:33:08 -0700305 case Car.STORAGE_MONITORING_SERVICE:
Enrico Granata1172f882017-09-21 14:51:30 -0700306 assertPermission(mContext, Car.PERMISSION_STORAGE_MONITORING);
Enrico Granata9a916d72017-09-19 14:33:08 -0700307 return mCarStorageMonitoringService;
Ram Periathiruvadi25c16f12017-11-17 16:48:37 -0800308 case Car.CAR_DRIVING_STATE_SERVICE:
309 assertDrivingStatePermission(mContext);
310 return mCarDrivingStateService;
311 case Car.CAR_UX_RESTRICTION_SERVICE:
312 return mCarUXRestrictionsService;
Anthony Chend4203d82018-05-16 16:21:52 -0700313 case Car.CAR_CONFIGURATION_SERVICE:
314 return mCarConfigurationService;
Ram Periathiruvadi194ce1b2019-01-14 09:42:12 -0800315 case Car.CAR_TRUST_AGENT_ENROLLMENT_SERVICE:
316 assertTrustAgentEnrollmentPermission(mContext);
Ram Periathiruvadide0ca082019-03-20 11:16:44 -0700317 return mCarTrustedDeviceService.getCarTrustAgentEnrollmentService();
Simon Dai527eb552019-02-12 13:06:15 -0800318 case Car.CAR_MEDIA_SERVICE:
319 return mCarMediaService;
keunyoungca515072015-07-10 12:21:47 -0700320 default:
321 Log.w(CarLog.TAG_SERVICE, "getCarService for unknown service:" + serviceName);
322 return null;
323 }
324 }
325
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800326 @Override
327 public int getCarConnectionType() {
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700328 return Car.CONNECTION_TYPE_EMBEDDED;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800329 }
330
Keun-young Parka28d7b22016-02-29 16:54:29 -0800331 public CarServiceBase getCarInternalService(String serviceName) {
332 switch (serviceName) {
333 case INTERNAL_INPUT_SERVICE:
334 return mCarInputService;
Keun-young Park4727da32016-05-31 10:00:51 -0700335 case INTERNAL_SYSTEM_ACTIVITY_MONITORING_SERVICE:
336 return mSystemActivityMonitoringService;
Keun-young Parka28d7b22016-02-29 16:54:29 -0800337 default:
338 Log.w(CarLog.TAG_SERVICE, "getCarInternalService for unknown service:" +
339 serviceName);
340 return null;
341 }
342 }
343
keunyoung1ab8e182015-09-24 09:25:22 -0700344 public static void assertVehicleHalMockPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700345 assertPermission(context, Car.PERMISSION_MOCK_VEHICLE_HAL);
keunyoung1ab8e182015-09-24 09:25:22 -0700346 }
347
Keun-young Parke31a8b22016-03-16 17:34:08 -0700348 public static void assertNavigationManagerPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700349 assertPermission(context, Car.PERMISSION_CAR_NAVIGATION_MANAGER);
Pavel Maltsevce4ffd92016-03-09 10:56:23 -0800350 }
351
Pavel Maltsev905968c2017-07-16 19:48:57 -0700352 public static void assertClusterManagerPermission(Context context) {
353 assertPermission(context, Car.PERMISSION_CAR_INSTRUMENT_CLUSTER_CONTROL);
354 }
355
Steve Paik388d7772018-02-12 10:54:51 -0800356 public static void assertPowerPermission(Context context) {
357 assertPermission(context, Car.PERMISSION_CAR_POWER);
358 }
359
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800360 public static void assertProjectionPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700361 assertPermission(context, Car.PERMISSION_CAR_PROJECTION);
362 }
363
Pavel Maltsev079873b2019-02-25 12:15:09 -0800364 /** Verify the calling context has the {@link Car#PERMISSION_CAR_PROJECTION_STATUS} */
365 public static void assertProjectionStatusPermission(Context context) {
366 assertPermission(context, Car.PERMISSION_CAR_PROJECTION_STATUS);
367 }
368
Enrico Granata3c7a6662017-02-23 18:07:59 -0800369 public static void assertAnyDiagnosticPermission(Context context) {
370 assertAnyPermission(context,
Enrico Granataae25b922017-07-07 11:28:15 -0700371 Car.PERMISSION_CAR_DIAGNOSTIC_READ_ALL,
Enrico Granata3c7a6662017-02-23 18:07:59 -0800372 Car.PERMISSION_CAR_DIAGNOSTIC_CLEAR);
373 }
374
Ram Periathiruvadi25c16f12017-11-17 16:48:37 -0800375 public static void assertDrivingStatePermission(Context context) {
376 assertPermission(context, Car.PERMISSION_CAR_DRIVING_STATE);
377 }
378
Antonio Cortes6b3544c2017-02-06 16:54:58 -0800379 public static void assertVmsPublisherPermission(Context context) {
380 assertPermission(context, Car.PERMISSION_VMS_PUBLISHER);
381 }
382
Antonio Cortese4619c72017-02-02 07:53:27 -0800383 public static void assertVmsSubscriberPermission(Context context) {
384 assertPermission(context, Car.PERMISSION_VMS_SUBSCRIBER);
385 }
386
Ram Periathiruvadi194ce1b2019-01-14 09:42:12 -0800387 /**
388 * Ensures the caller has the permission to enroll a Trust Agent.
389 * @param context
390 */
391 public static void assertTrustAgentEnrollmentPermission(Context context) {
392 assertPermission(context, Car.PERMISSION_CAR_ENROLL_TRUST);
393 }
394
Steve Paik461ecc62016-06-08 15:28:32 -0700395 public static void assertPermission(Context context, String permission) {
396 if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
397 throw new SecurityException("requires " + permission);
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800398 }
399 }
400
Steve Paik9ec53d72018-04-27 13:28:31 -0700401 /**
402 * Checks to see if the caller has a permission.
403 * @param context
404 * @param permission
405 *
406 * @return boolean TRUE if caller has the permission.
407 */
408 public static boolean hasPermission(Context context, String permission) {
409 return context.checkCallingOrSelfPermission(permission)
410 == PackageManager.PERMISSION_GRANTED;
411 }
412
Enrico Granata3c7a6662017-02-23 18:07:59 -0800413 public static void assertAnyPermission(Context context, String... permissions) {
414 for (String permission : permissions) {
415 if (context.checkCallingOrSelfPermission(permission) ==
416 PackageManager.PERMISSION_GRANTED) {
417 return;
418 }
419 }
420 throw new SecurityException("requires any of " + Arrays.toString(permissions));
421 }
422
Enrico Granatae8056ca2018-04-03 13:19:52 -0700423 @Override
424 protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
425 if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
Anthony Chen12aec302018-04-25 16:41:48 -0700426 != PackageManager.PERMISSION_GRANTED) {
Enrico Granatae8056ca2018-04-03 13:19:52 -0700427 writer.println("Permission Denial: can't dump CarService from from pid="
Anthony Chen12aec302018-04-25 16:41:48 -0700428 + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()
429 + " without permission " + android.Manifest.permission.DUMP);
Enrico Granatae8056ca2018-04-03 13:19:52 -0700430 return;
keunyounga3b28d82015-08-25 13:05:15 -0700431 }
Enrico Granatae8056ca2018-04-03 13:19:52 -0700432 if (args == null || args.length == 0) {
433 writer.println("*dump car service*");
434
435 writer.println("*FutureConfig, DEFAULT:" + FeatureConfiguration.DEFAULT);
436 writer.println("*Dump all services*");
437 for (CarServiceBase service : mAllServices) {
438 dumpService(service, writer);
439 }
440 if (mCarTestService != null) {
441 dumpService(mCarTestService, writer);
442 }
443 writer.println("*Dump Vehicle HAL*");
444 writer.println("Vehicle HAL Interface: " + mVehicleInterfaceName);
445 try {
446 // TODO dump all feature flags by creating a dumpable interface
447 mHal.dump(writer);
448 } catch (Exception e) {
449 writer.println("Failed dumping: " + mHal.getClass().getName());
450 e.printStackTrace(writer);
451 }
452 } else if (Build.IS_USERDEBUG || Build.IS_ENG) {
453 execShellCmd(args, writer);
454 } else {
455 writer.println("Commands not supported in " + Build.TYPE);
Brad Stenninged3d59b2017-11-09 16:15:17 -0800456 }
457 }
458
459 private void dumpService(CarServiceBase service, PrintWriter writer) {
460 try {
461 service.dump(writer);
462 } catch (Exception e) {
463 writer.println("Failed dumping: " + service.getClass().getName());
464 e.printStackTrace(writer);
465 }
keunyoungcc449f72015-08-12 10:46:27 -0700466 }
Yao Chene33f07e2016-07-26 12:02:51 -0700467
468 void execShellCmd(String[] args, PrintWriter writer) {
469 new CarShellCommand().exec(args, writer);
470 }
471
Pavel Maltsevabd47232017-10-10 16:54:57 -0700472 @MainThread
Serik Beketayev74debf22018-10-04 12:18:09 -0700473 private void traceBegin(String name) {
Steve Paikc302c7c2017-08-04 14:01:58 -0700474 Slog.i(TAG, name);
475 mBootTiming.traceBegin(name);
476 }
477
Pavel Maltsevabd47232017-10-10 16:54:57 -0700478 @MainThread
Serik Beketayev74debf22018-10-04 12:18:09 -0700479 private void traceEnd() {
Steve Paikc302c7c2017-08-04 14:01:58 -0700480 mBootTiming.traceEnd();
481 }
482
Yao Chene33f07e2016-07-26 12:02:51 -0700483 private class CarShellCommand {
484 private static final String COMMAND_HELP = "-h";
485 private static final String COMMAND_DAY_NIGHT_MODE = "day-night-mode";
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800486 private static final String COMMAND_INJECT_VHAL_EVENT = "inject-vhal-event";
Ram Periathiruvadibf0eab72018-02-06 12:32:43 -0800487 private static final String COMMAND_ENABLE_UXR = "enable-uxr";
Bryan Eylera32a7c12018-02-27 15:40:00 -0800488 private static final String COMMAND_GARAGE_MODE = "garage-mode";
Ram Periathiruvadi38388302018-02-22 16:42:49 -0800489 private static final String COMMAND_GET_DO_ACTIVITIES = "get-do-activities";
Kaidd4ef5a2019-03-04 14:07:26 -0800490 private static final String COMMAND_GET_CARPROPERTYCONFIG = "get-carpropertyconfig";
Pavel Maltsev48a31942019-03-03 22:08:28 -0800491 private static final String COMMAND_PROJECTION_UI_MODE = "projection-ui-mode";
Jim Kayed76c2742019-04-02 11:33:27 -0700492 private static final String COMMAND_RESUME = "resume";
493 private static final String COMMAND_SUSPEND = "suspend";
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800494
Yao Chene33f07e2016-07-26 12:02:51 -0700495 private static final String PARAM_DAY_MODE = "day";
496 private static final String PARAM_NIGHT_MODE = "night";
497 private static final String PARAM_SENSOR_MODE = "sensor";
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800498 private static final String PARAM_VEHICLE_PROPERTY_AREA_GLOBAL = "0";
Bryan Eylera32a7c12018-02-27 15:40:00 -0800499 private static final String PARAM_ON_MODE = "on";
500 private static final String PARAM_OFF_MODE = "off";
501 private static final String PARAM_QUERY_MODE = "query";
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800502
Yao Chene33f07e2016-07-26 12:02:51 -0700503
504 private void dumpHelp(PrintWriter pw) {
505 pw.println("Car service commands:");
506 pw.println("\t-h");
507 pw.println("\t Print this help text.");
508 pw.println("\tday-night-mode [day|night|sensor]");
509 pw.println("\t Force into day/night mode or restore to auto.");
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800510 pw.println("\tinject-vhal-event property [zone] data(can be comma separated list)");
Jim Kayef10b7d82019-02-26 12:53:22 -0800511 pw.println("\t Inject a vehicle property for testing.");
Ram Periathiruvadibf0eab72018-02-06 12:32:43 -0800512 pw.println("\tdisable-uxr true|false");
513 pw.println("\t Disable UX restrictions and App blocking.");
Bryan Eylera32a7c12018-02-27 15:40:00 -0800514 pw.println("\tgarage-mode [on|off|query]");
515 pw.println("\t Force into garage mode or check status.");
Ram Periathiruvadi38388302018-02-22 16:42:49 -0800516 pw.println("\tget-do-activities pkgname");
Jim Kayef10b7d82019-02-26 12:53:22 -0800517 pw.println("\t Get Distraction Optimized activities in given package.");
Kaidd4ef5a2019-03-04 14:07:26 -0800518 pw.println("\tget-carpropertyconfig [propertyId]");
519 pw.println("\t Get a CarPropertyConfig by Id in Hex or list all CarPropertyConfigs");
Jim Kayed76c2742019-04-02 11:33:27 -0700520 pw.println("\tsuspend");
521 pw.println("\t Suspend the system to Deep Sleep.");
522 pw.println("\tresume");
523 pw.println("\t Wake the system up after a 'suspend.'");
Yao Chene33f07e2016-07-26 12:02:51 -0700524 }
525
526 public void exec(String[] args, PrintWriter writer) {
527 String arg = args[0];
528 switch (arg) {
529 case COMMAND_HELP:
530 dumpHelp(writer);
531 break;
Bryan Eylera32a7c12018-02-27 15:40:00 -0800532 case COMMAND_DAY_NIGHT_MODE: {
Jim Kayef10b7d82019-02-26 12:53:22 -0800533 String value = args.length < 2 ? "" : args[1];
Yao Chene33f07e2016-07-26 12:02:51 -0700534 forceDayNightMode(value, writer);
535 break;
Bryan Eylera32a7c12018-02-27 15:40:00 -0800536 }
537 case COMMAND_GARAGE_MODE: {
Jim Kayef10b7d82019-02-26 12:53:22 -0800538 String value = args.length < 2 ? "" : args[1];
Bryan Eylera32a7c12018-02-27 15:40:00 -0800539 forceGarageMode(value, writer);
540 break;
541 }
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800542 case COMMAND_INJECT_VHAL_EVENT:
543 String zone = PARAM_VEHICLE_PROPERTY_AREA_GLOBAL;
544 String data;
Jim Kayef10b7d82019-02-26 12:53:22 -0800545 if (args.length != 3 && args.length != 4) {
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800546 writer.println("Incorrect number of arguments.");
547 dumpHelp(writer);
548 break;
Jim Kayef10b7d82019-02-26 12:53:22 -0800549 } else if (args.length == 4) {
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800550 // Zoned
551 zone = args[2];
552 data = args[3];
553 } else {
554 // Global
555 data = args[2];
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800556 }
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800557 injectVhalEvent(args[1], zone, data, writer);
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800558 break;
Ram Periathiruvadibf0eab72018-02-06 12:32:43 -0800559 case COMMAND_ENABLE_UXR:
Jim Kayef10b7d82019-02-26 12:53:22 -0800560 if (args.length != 2) {
Ram Periathiruvadibf0eab72018-02-06 12:32:43 -0800561 writer.println("Incorrect number of arguments");
562 dumpHelp(writer);
563 break;
564 }
565 boolean enableBlocking = Boolean.valueOf(args[1]);
566 if (mCarPackageManagerService != null) {
567 mCarPackageManagerService.setEnableActivityBlocking(enableBlocking);
568 }
569 break;
Ram Periathiruvadi38388302018-02-22 16:42:49 -0800570 case COMMAND_GET_DO_ACTIVITIES:
Jim Kayef10b7d82019-02-26 12:53:22 -0800571 if (args.length != 2) {
Ram Periathiruvadi38388302018-02-22 16:42:49 -0800572 writer.println("Incorrect number of arguments");
573 dumpHelp(writer);
574 break;
575 }
576 String pkgName = args[1].toLowerCase();
577 if (mCarPackageManagerService != null) {
578 String[] doActivities =
579 mCarPackageManagerService.getDistractionOptimizedActivities(
580 pkgName);
581 if (doActivities != null) {
582 writer.println("DO Activities for " + pkgName);
583 for (String a : doActivities) {
584 writer.println(a);
585 }
586 } else {
587 writer.println("No DO Activities for " + pkgName);
588 }
589 }
590 break;
Kaidd4ef5a2019-03-04 14:07:26 -0800591 case COMMAND_GET_CARPROPERTYCONFIG:
592 String propertyId = args.length < 2 ? "" : args[1];
593 mHal.dumpPropertyConfigs(writer, propertyId);
594 break;
Pavel Maltsev48a31942019-03-03 22:08:28 -0800595 case COMMAND_PROJECTION_UI_MODE:
596 if (args.length != 2) {
597 writer.println("Incorrect number of arguments");
598 dumpHelp(writer);
599 break;
600 }
601 mCarProjectionService.setUiMode(Integer.valueOf(args[1]));
Pavel Maltsevd6961f62019-03-26 10:22:31 -0700602 break;
Jim Kayed76c2742019-04-02 11:33:27 -0700603 case COMMAND_RESUME:
604 mCarPowerManagementService.forceSimulatedResume();
605 writer.println("Resume: Simulating resuming from Deep Sleep");
606 break;
607 case COMMAND_SUSPEND:
608 mCarPowerManagementService.forceSimulatedSuspend();
609 writer.println("Resume: Simulating powering down to Deep Sleep");
610 break;
Yao Chene33f07e2016-07-26 12:02:51 -0700611 default:
Jim Kayef10b7d82019-02-26 12:53:22 -0800612 writer.println("Unknown command: \"" + arg + "\"");
Yao Chene33f07e2016-07-26 12:02:51 -0700613 dumpHelp(writer);
614 }
615 }
616
617 private void forceDayNightMode(String arg, PrintWriter writer) {
618 int mode;
619 switch (arg) {
620 case PARAM_DAY_MODE:
621 mode = CarNightService.FORCED_DAY_MODE;
622 break;
623 case PARAM_NIGHT_MODE:
624 mode = CarNightService.FORCED_NIGHT_MODE;
625 break;
626 case PARAM_SENSOR_MODE:
627 mode = CarNightService.FORCED_SENSOR_MODE;
628 break;
629 default:
630 writer.println("Unknown value. Valid argument: " + PARAM_DAY_MODE + "|"
631 + PARAM_NIGHT_MODE + "|" + PARAM_SENSOR_MODE);
632 return;
633 }
634 int current = mCarNightService.forceDayNightMode(mode);
635 String currentMode = null;
636 switch (current) {
637 case UiModeManager.MODE_NIGHT_AUTO:
638 currentMode = PARAM_SENSOR_MODE;
639 break;
640 case UiModeManager.MODE_NIGHT_YES:
641 currentMode = PARAM_NIGHT_MODE;
642 break;
643 case UiModeManager.MODE_NIGHT_NO:
644 currentMode = PARAM_DAY_MODE;
645 break;
646 }
647 writer.println("DayNightMode changed to: " + currentMode);
648 }
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800649
Bryan Eylera32a7c12018-02-27 15:40:00 -0800650 private void forceGarageMode(String arg, PrintWriter writer) {
651 switch (arg) {
652 case PARAM_ON_MODE:
Serik Beketayeve0e7ff22018-07-31 21:04:12 -0700653 mGarageModeService.forceStartGarageMode();
Bryan Eylera32a7c12018-02-27 15:40:00 -0800654 break;
655 case PARAM_OFF_MODE:
Serik Beketayeve0e7ff22018-07-31 21:04:12 -0700656 mGarageModeService.stopAndResetGarageMode();
Bryan Eylera32a7c12018-02-27 15:40:00 -0800657 break;
658 case PARAM_QUERY_MODE:
659 // Nothing to do. Always query at the end anyway.
660 break;
661 default:
662 writer.println("Unknown value. Valid argument: " + PARAM_ON_MODE + "|"
663 + PARAM_OFF_MODE + "|" + PARAM_QUERY_MODE);
664 return;
665 }
Serik Beketayeve0e7ff22018-07-31 21:04:12 -0700666 writer.println("Garage mode: " + mGarageModeService.isGarageModeActive());
Bryan Eylera32a7c12018-02-27 15:40:00 -0800667 }
668
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800669 /**
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800670 * Inject a fake VHAL event
Ram Periathiruvadi49d5a5a2017-02-17 18:50:09 -0800671 *
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800672 * @param property the Vehicle property Id as defined in the HAL
673 * @param zone Zone that this event services
674 * @param value Data value of the event
675 * @param writer PrintWriter
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800676 */
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800677 private void injectVhalEvent(String property, String zone, String value,
Ram Periathiruvadi49d5a5a2017-02-17 18:50:09 -0800678 PrintWriter writer) {
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800679 if (zone != null && (zone.equalsIgnoreCase(PARAM_VEHICLE_PROPERTY_AREA_GLOBAL))) {
680 if (!isPropertyAreaTypeGlobal(property)) {
681 writer.println("Property area type inconsistent with given zone");
682 return;
683 }
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800684 }
685 try {
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800686 mHal.injectVhalEvent(property, zone, value);
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800687 } catch (NumberFormatException e) {
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800688 writer.println("Invalid property Id zone Id or value" + e);
689 dumpHelp(writer);
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800690 }
Ram Periathiruvadiee28c002017-02-07 21:35:01 -0800691 }
692
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800693 // Check if the given property is global
694 private boolean isPropertyAreaTypeGlobal(String property) {
695 if (property == null) {
696 return false;
Ram Periathiruvadi49d5a5a2017-02-17 18:50:09 -0800697 }
Ram Periathiruvadi5cd00cb2018-02-12 13:49:50 -0800698 return (Integer.decode(property) & VehicleArea.MASK) == VehicleArea.GLOBAL;
Ram Periathiruvadi49d5a5a2017-02-17 18:50:09 -0800699 }
Yao Chene33f07e2016-07-26 12:02:51 -0700700 }
kevinjm55822c42018-08-15 11:26:00 -0700701}