blob: 034c4e35dc27a4793901c5a8d992910562e241f0 [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
Yao Chene33f07e2016-07-26 12:02:51 -070019import android.app.UiModeManager;
Keun-young Parke54ac272016-02-16 19:02:18 -080020import android.car.Car;
21import android.car.ICar;
Antonio Cortese4619c72017-02-02 07:53:27 -080022import android.car.annotation.FutureFeature;
Pavel Maltsev0477e292016-05-27 12:22:36 -070023import android.car.cluster.renderer.IInstrumentClusterNavigation;
Antonio Cortese4619c72017-02-02 07:53:27 -080024import android.car.internal.FeatureUtil;
keunyoungca515072015-07-10 12:21:47 -070025import android.content.Context;
keunyoung1ab8e182015-09-24 09:25:22 -070026import android.content.pm.PackageManager;
Pavel Maltsev0d07c762016-11-03 16:40:15 -070027import android.hardware.vehicle.V2_0.IVehicle;
keunyoungca515072015-07-10 12:21:47 -070028import android.os.IBinder;
keunyoungca515072015-07-10 12:21:47 -070029import android.util.Log;
30
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080031import com.android.car.cluster.InstrumentClusterService;
keunyoungcc449f72015-08-12 10:46:27 -070032import com.android.car.hal.VehicleHal;
Keun-young Park4aeb4bf2015-12-08 18:31:33 -080033import com.android.car.pm.CarPackageManagerService;
keunyoungca515072015-07-10 12:21:47 -070034import com.android.internal.annotations.GuardedBy;
35
keunyounga3b28d82015-08-25 13:05:15 -070036import java.io.PrintWriter;
Antonio Cortese4619c72017-02-02 07:53:27 -080037import java.util.ArrayList;
38import java.util.Arrays;
39import java.util.List;
keunyounga3b28d82015-08-25 13:05:15 -070040
keunyoungca515072015-07-10 12:21:47 -070041public class ICarImpl extends ICar.Stub {
keunyoungca515072015-07-10 12:21:47 -070042
Keun-young Parka28d7b22016-02-29 16:54:29 -080043 public static final String INTERNAL_INPUT_SERVICE = "internal_input";
Keun-young Park4727da32016-05-31 10:00:51 -070044 public static final String INTERNAL_SYSTEM_ACTIVITY_MONITORING_SERVICE =
45 "system_activity_monitoring";
Keun-young Parka28d7b22016-02-29 16:54:29 -080046
47 // load jni for all services here
48 static {
Pavel Maltsev0d07c762016-11-03 16:40:15 -070049 try {
50 System.loadLibrary("jni_car_service");
51 } catch (UnsatisfiedLinkError ex) {
52 // Unable to load native library when loaded from the testing framework.
53 Log.e(CarLog.TAG_SERVICE, "Failed to load jni_car_service library: " + ex.getMessage());
54 }
Keun-young Parka28d7b22016-02-29 16:54:29 -080055 }
56
keunyoungca515072015-07-10 12:21:47 -070057 private final Context mContext;
Pavel Maltsevec83b632017-01-05 15:10:55 -080058 private final VehicleHal mHal;
keunyoungca515072015-07-10 12:21:47 -070059
Keun-young Park4727da32016-05-31 10:00:51 -070060 private final SystemActivityMonitoringService mSystemActivityMonitoringService;
keunyoung4b0212c2015-10-29 17:11:57 -070061 private final CarPowerManagementService mCarPowerManagementService;
Keun-young Parka28d7b22016-02-29 16:54:29 -080062 private final CarPackageManagerService mCarPackageManagerService;
63 private final CarInputService mCarInputService;
keunyoungca515072015-07-10 12:21:47 -070064 private final CarSensorService mCarSensorService;
keunyounga3b28d82015-08-25 13:05:15 -070065 private final CarInfoService mCarInfoService;
keunyoungd32f4e62015-09-21 11:33:06 -070066 private final CarAudioService mCarAudioService;
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -080067 private final CarProjectionService mCarProjectionService;
Steve Paik43c04a72016-07-08 19:12:09 -070068 private final CarCabinService mCarCabinService;
Steve Paik875616c2016-02-05 10:55:59 -080069 private final CarCameraService mCarCameraService;
Steve Paik66481982015-10-27 15:22:38 -070070 private final CarHvacService mCarHvacService;
Sanket Agarwal3cf096a2015-10-13 14:46:31 -070071 private final CarRadioService mCarRadioService;
Joseph Pirozzo317343d2016-01-25 10:22:37 -080072 private final CarNightService mCarNightService;
Vitalii Tomkiv46371472016-05-23 16:55:22 -070073 private final AppFocusService mAppFocusService;
Yao Chen3a7976d2016-01-20 17:27:08 -080074 private final GarageModeService mGarageModeService;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -080075 private final InstrumentClusterService mInstrumentClusterService;
Keun-young Parkd73afae2016-04-08 20:03:32 -070076 private final SystemStateControllerService mSystemStateControllerService;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070077 private final CarVendorExtensionService mCarVendorExtensionService;
Ram Periathiruvadi7ed84182017-01-20 15:18:08 -080078 private final CarBluetoothService mCarBluetoothService;
Antonio Cortese4619c72017-02-02 07:53:27 -080079 @FutureFeature
80 private VmsSubscriberService mVmsSubscriberService;
keunyounga74b9ca2015-10-21 13:33:58 -070081
Pavel Maltsev0d07c762016-11-03 16:40:15 -070082 private final CarServiceBase[] mAllServices;
83
keunyoung1ab8e182015-09-24 09:25:22 -070084 /** Test only service. Populate it only when necessary. */
85 @GuardedBy("this")
86 private CarTestService mCarTestService;
keunyoungca515072015-07-10 12:21:47 -070087
Pavel Maltsevec83b632017-01-05 15:10:55 -080088 public ICarImpl(Context serviceContext, IVehicle vehicle, SystemInterface systemInterface,
89 CanBusErrorNotifier errorNotifier) {
keunyoungca515072015-07-10 12:21:47 -070090 mContext = serviceContext;
Pavel Maltsev0d07c762016-11-03 16:40:15 -070091 mHal = new VehicleHal(vehicle);
Keun-young Park4727da32016-05-31 10:00:51 -070092 mSystemActivityMonitoringService = new SystemActivityMonitoringService(serviceContext);
Pavel Maltsev0d07c762016-11-03 16:40:15 -070093 mCarPowerManagementService = new CarPowerManagementService(
94 mHal.getPowerHal(), systemInterface);
95 mCarSensorService = new CarSensorService(serviceContext, mHal.getSensorHal());
Keun-young Park4727da32016-05-31 10:00:51 -070096 mCarPackageManagerService = new CarPackageManagerService(serviceContext, mCarSensorService,
97 mSystemActivityMonitoringService);
Pavel Maltsev0d07c762016-11-03 16:40:15 -070098 mCarInputService = new CarInputService(serviceContext, mHal.getInputHal());
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -080099 mCarProjectionService = new CarProjectionService(serviceContext, mCarInputService);
Yao Chen3a7976d2016-01-20 17:27:08 -0800100 mGarageModeService = new GarageModeService(mContext, mCarPowerManagementService);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700101 mCarInfoService = new CarInfoService(serviceContext, mHal.getInfoHal());
Vitalii Tomkiv8c7f2972016-07-11 15:42:04 -0700102 mAppFocusService = new AppFocusService(serviceContext, mSystemActivityMonitoringService);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700103 mCarAudioService = new CarAudioService(serviceContext, mHal.getAudioHal(),
Pavel Maltsevec83b632017-01-05 15:10:55 -0800104 mCarInputService, errorNotifier);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700105 mCarCabinService = new CarCabinService(serviceContext, mHal.getCabinHal());
106 mCarHvacService = new CarHvacService(serviceContext, mHal.getHvacHal());
107 mCarRadioService = new CarRadioService(serviceContext, mHal.getRadioHal());
Steve Paik875616c2016-02-05 10:55:59 -0800108 mCarCameraService = new CarCameraService(serviceContext);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700109 mCarNightService = new CarNightService(serviceContext, mCarSensorService);
Pavel Maltsev0477e292016-05-27 12:22:36 -0700110 mInstrumentClusterService = new InstrumentClusterService(serviceContext,
Pavel Maltsev03cf60c2016-06-27 15:11:51 -0700111 mAppFocusService, mCarInputService);
Keun-young Parkd73afae2016-04-08 20:03:32 -0700112 mSystemStateControllerService = new SystemStateControllerService(serviceContext,
Keun-young Park3cb89102016-05-05 13:16:03 -0700113 mCarPowerManagementService, mCarAudioService, this);
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700114 mCarVendorExtensionService = new CarVendorExtensionService(serviceContext,
115 mHal.getVendorExtensionHal());
Ram Periathiruvadi7ed84182017-01-20 15:18:08 -0800116 mCarBluetoothService = new CarBluetoothService(serviceContext, mCarCabinService);
Antonio Cortese4619c72017-02-02 07:53:27 -0800117 if (FeatureConfiguration.ENABLE_VEHICLE_MAP_SERVICE) {
118 mVmsSubscriberService = new VmsSubscriberService(serviceContext, mHal.getVmsHal());
119 }
keunyounga74b9ca2015-10-21 13:33:58 -0700120
keunyounga3b28d82015-08-25 13:05:15 -0700121 // Be careful with order. Service depending on other service should be inited later.
Antonio Cortese4619c72017-02-02 07:53:27 -0800122 List<CarServiceBase> allServices = new ArrayList<>(Arrays.asList(
Keun-young Park4727da32016-05-31 10:00:51 -0700123 mSystemActivityMonitoringService,
keunyoung4b0212c2015-10-29 17:11:57 -0700124 mCarPowerManagementService,
Keun-young Park4727da32016-05-31 10:00:51 -0700125 mCarSensorService,
Keun-young Park45fdcba2015-12-08 11:38:58 -0800126 mCarPackageManagerService,
Keun-young Parka28d7b22016-02-29 16:54:29 -0800127 mCarInputService,
128 mGarageModeService,
keunyounga3b28d82015-08-25 13:05:15 -0700129 mCarInfoService,
Vitalii Tomkiv46371472016-05-23 16:55:22 -0700130 mAppFocusService,
Sanket Agarwal3cf096a2015-10-13 14:46:31 -0700131 mCarAudioService,
Steve Paik43c04a72016-07-08 19:12:09 -0700132 mCarCabinService,
Steve Paik66481982015-10-27 15:22:38 -0700133 mCarHvacService,
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800134 mCarRadioService,
135 mCarCameraService,
Joseph Pirozzo317343d2016-01-25 10:22:37 -0800136 mCarNightService,
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800137 mInstrumentClusterService,
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800138 mCarProjectionService,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700139 mSystemStateControllerService,
Ram Periathiruvadi7ed84182017-01-20 15:18:08 -0800140 mCarVendorExtensionService,
141 mCarBluetoothService
Antonio Cortese4619c72017-02-02 07:53:27 -0800142 ));
143 if (FeatureConfiguration.ENABLE_VEHICLE_MAP_SERVICE) {
144 allServices.add(mVmsSubscriberService);
145 }
146 mAllServices = allServices.toArray(new CarServiceBase[0]);
keunyoungca515072015-07-10 12:21:47 -0700147 }
148
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700149 public void init() {
150 mHal.init();
keunyounga3b28d82015-08-25 13:05:15 -0700151 for (CarServiceBase service: mAllServices) {
152 service.init();
153 }
keunyoungca515072015-07-10 12:21:47 -0700154 }
155
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700156 public void release() {
keunyounga3b28d82015-08-25 13:05:15 -0700157 // release done in opposite order from init
158 for (int i = mAllServices.length - 1; i >= 0; i--) {
159 mAllServices[i].release();
160 }
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700161 mHal.release();
keunyoung1ab8e182015-09-24 09:25:22 -0700162 }
163
Pavel Maltsevec83b632017-01-05 15:10:55 -0800164 public void vehicleHalReconnected(IVehicle vehicle) {
165 mHal.vehicleHalReconnected(vehicle);
166 for (CarServiceBase service : mAllServices) {
167 service.vehicleHalReconnected();
168 }
169 }
170
keunyoungca515072015-07-10 12:21:47 -0700171 @Override
keunyoungca515072015-07-10 12:21:47 -0700172 public IBinder getCarService(String serviceName) {
173 switch (serviceName) {
Keun-young Park5672e852016-02-09 19:53:48 -0800174 case Car.AUDIO_SERVICE:
175 return mCarAudioService;
keunyoungca515072015-07-10 12:21:47 -0700176 case Car.SENSOR_SERVICE:
177 return mCarSensorService;
keunyounga3b28d82015-08-25 13:05:15 -0700178 case Car.INFO_SERVICE:
179 return mCarInfoService;
Vitalii Tomkiv46371472016-05-23 16:55:22 -0700180 case Car.APP_FOCUS_SERVICE:
181 return mAppFocusService;
Keun-young Park45fdcba2015-12-08 11:38:58 -0800182 case Car.PACKAGE_SERVICE:
183 return mCarPackageManagerService;
Steve Paik43c04a72016-07-08 19:12:09 -0700184 case Car.CABIN_SERVICE:
185 assertCabinPermission(mContext);
186 return mCarCabinService;
Steve Paik875616c2016-02-05 10:55:59 -0800187 case Car.CAMERA_SERVICE:
188 assertCameraPermission(mContext);
189 return mCarCameraService;
Keun-young Parke54ac272016-02-16 19:02:18 -0800190 case Car.HVAC_SERVICE:
Steve Paik66481982015-10-27 15:22:38 -0700191 assertHvacPermission(mContext);
192 return mCarHvacService;
Keun-young Parke54ac272016-02-16 19:02:18 -0800193 case Car.RADIO_SERVICE:
keunyoung6b197692015-11-16 13:54:38 -0800194 assertRadioPermission(mContext);
Sanket Agarwal3cf096a2015-10-13 14:46:31 -0700195 return mCarRadioService;
Pavel Maltsev7a948e52016-02-02 23:30:14 -0800196 case Car.CAR_NAVIGATION_SERVICE:
Keun-young Parke31a8b22016-03-16 17:34:08 -0700197 assertNavigationManagerPermission(mContext);
Pavel Maltsev0477e292016-05-27 12:22:36 -0700198 IInstrumentClusterNavigation navService =
199 mInstrumentClusterService.getNavigationService();
200 return navService == null ? null : navService.asBinder();
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800201 case Car.PROJECTION_SERVICE:
202 assertProjectionPermission(mContext);
203 return mCarProjectionService;
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700204 case Car.VENDOR_EXTENSION_SERVICE:
205 assertVendorExtensionPermission(mContext);
206 return mCarVendorExtensionService;
Antonio Cortese4619c72017-02-02 07:53:27 -0800207 case Car.VMS_SUBSCRIBER_SERVICE:
208 FeatureUtil.assertFeature(FeatureConfiguration.ENABLE_VEHICLE_MAP_SERVICE);
209 if (FeatureConfiguration.ENABLE_VEHICLE_MAP_SERVICE) {
210 assertVmsSubscriberPermission(mContext);
211 return mVmsSubscriberService;
212 }
Keun-young Parke54ac272016-02-16 19:02:18 -0800213 case Car.TEST_SERVICE: {
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700214 assertPermission(mContext, Car.PERMISSION_CAR_TEST_SERVICE);
keunyoung1ab8e182015-09-24 09:25:22 -0700215 synchronized (this) {
216 if (mCarTestService == null) {
217 mCarTestService = new CarTestService(mContext, this);
218 }
219 return mCarTestService;
220 }
221 }
keunyoungca515072015-07-10 12:21:47 -0700222 default:
223 Log.w(CarLog.TAG_SERVICE, "getCarService for unknown service:" + serviceName);
224 return null;
225 }
226 }
227
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800228 @Override
229 public int getCarConnectionType() {
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700230 return Car.CONNECTION_TYPE_EMBEDDED;
Pavel Maltsev1ecdd6c2016-03-02 16:33:44 -0800231 }
232
Keun-young Parka28d7b22016-02-29 16:54:29 -0800233 public CarServiceBase getCarInternalService(String serviceName) {
234 switch (serviceName) {
235 case INTERNAL_INPUT_SERVICE:
236 return mCarInputService;
Keun-young Park4727da32016-05-31 10:00:51 -0700237 case INTERNAL_SYSTEM_ACTIVITY_MONITORING_SERVICE:
238 return mSystemActivityMonitoringService;
Keun-young Parka28d7b22016-02-29 16:54:29 -0800239 default:
240 Log.w(CarLog.TAG_SERVICE, "getCarInternalService for unknown service:" +
241 serviceName);
242 return null;
243 }
244 }
245
keunyoung1ab8e182015-09-24 09:25:22 -0700246 public static void assertVehicleHalMockPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700247 assertPermission(context, Car.PERMISSION_MOCK_VEHICLE_HAL);
keunyoung1ab8e182015-09-24 09:25:22 -0700248 }
249
Steve Paik43c04a72016-07-08 19:12:09 -0700250 public static void assertCabinPermission(Context context) {
251 assertPermission(context, Car.PERMISSION_CAR_CABIN);
252 }
253
Steve Paik875616c2016-02-05 10:55:59 -0800254 public static void assertCameraPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700255 assertPermission(context, Car.PERMISSION_CAR_CAMERA);
Steve Paik875616c2016-02-05 10:55:59 -0800256 }
257
Keun-young Parke31a8b22016-03-16 17:34:08 -0700258 public static void assertNavigationManagerPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700259 assertPermission(context, Car.PERMISSION_CAR_NAVIGATION_MANAGER);
Pavel Maltsevce4ffd92016-03-09 10:56:23 -0800260 }
261
Steve Paik66481982015-10-27 15:22:38 -0700262 public static void assertHvacPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700263 assertPermission(context, Car.PERMISSION_CAR_HVAC);
Steve Paik66481982015-10-27 15:22:38 -0700264 }
265
keunyoung6b197692015-11-16 13:54:38 -0800266 private static void assertRadioPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700267 assertPermission(context, Car.PERMISSION_CAR_RADIO);
Sanket Agarwal3cf096a2015-10-13 14:46:31 -0700268 }
269
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800270 public static void assertProjectionPermission(Context context) {
Steve Paik461ecc62016-06-08 15:28:32 -0700271 assertPermission(context, Car.PERMISSION_CAR_PROJECTION);
272 }
273
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700274 public static void assertVendorExtensionPermission(Context context) {
275 assertPermission(context, Car.PERMISSION_VENDOR_EXTENSION);
276 }
277
Antonio Cortese4619c72017-02-02 07:53:27 -0800278 @FutureFeature
279 public static void assertVmsSubscriberPermission(Context context) {
280 assertPermission(context, Car.PERMISSION_VMS_SUBSCRIBER);
281 }
282
Steve Paik461ecc62016-06-08 15:28:32 -0700283 public static void assertPermission(Context context, String permission) {
284 if (context.checkCallingOrSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
285 throw new SecurityException("requires " + permission);
Vitalii Tomkiv6e5ee612016-03-09 14:57:32 -0800286 }
287 }
288
keunyoungcc449f72015-08-12 10:46:27 -0700289 void dump(PrintWriter writer) {
Keun-young Parkbae6e252017-01-25 12:30:15 -0800290 writer.println("*FutureConfig, DEFAULT:" + FeatureConfiguration.DEFAULT);
291 //TODO dump all feature flags by reflection
keunyounga3b28d82015-08-25 13:05:15 -0700292 writer.println("*Dump all services*");
293 for (CarServiceBase service: mAllServices) {
294 service.dump(writer);
295 }
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700296 if (mCarTestService != null) {
297 mCarTestService.dump(writer);
keunyoung1ab8e182015-09-24 09:25:22 -0700298 }
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700299 writer.println("*Dump Vehicle HAL*");
300 mHal.dump(writer);
keunyoungcc449f72015-08-12 10:46:27 -0700301 }
Yao Chene33f07e2016-07-26 12:02:51 -0700302
303 void execShellCmd(String[] args, PrintWriter writer) {
304 new CarShellCommand().exec(args, writer);
305 }
306
307 private class CarShellCommand {
308 private static final String COMMAND_HELP = "-h";
309 private static final String COMMAND_DAY_NIGHT_MODE = "day-night-mode";
310 private static final String PARAM_DAY_MODE = "day";
311 private static final String PARAM_NIGHT_MODE = "night";
312 private static final String PARAM_SENSOR_MODE = "sensor";
313
314 private void dumpHelp(PrintWriter pw) {
315 pw.println("Car service commands:");
316 pw.println("\t-h");
317 pw.println("\t Print this help text.");
318 pw.println("\tday-night-mode [day|night|sensor]");
319 pw.println("\t Force into day/night mode or restore to auto.");
320 }
321
322 public void exec(String[] args, PrintWriter writer) {
323 String arg = args[0];
324 switch (arg) {
325 case COMMAND_HELP:
326 dumpHelp(writer);
327 break;
328 case COMMAND_DAY_NIGHT_MODE:
329 String value = args.length < 1 ? "" : args[1];
330 forceDayNightMode(value, writer);
331 break;
332 default:
333 writer.println("Unknown command.");
334 dumpHelp(writer);
335 }
336 }
337
338 private void forceDayNightMode(String arg, PrintWriter writer) {
339 int mode;
340 switch (arg) {
341 case PARAM_DAY_MODE:
342 mode = CarNightService.FORCED_DAY_MODE;
343 break;
344 case PARAM_NIGHT_MODE:
345 mode = CarNightService.FORCED_NIGHT_MODE;
346 break;
347 case PARAM_SENSOR_MODE:
348 mode = CarNightService.FORCED_SENSOR_MODE;
349 break;
350 default:
351 writer.println("Unknown value. Valid argument: " + PARAM_DAY_MODE + "|"
352 + PARAM_NIGHT_MODE + "|" + PARAM_SENSOR_MODE);
353 return;
354 }
355 int current = mCarNightService.forceDayNightMode(mode);
356 String currentMode = null;
357 switch (current) {
358 case UiModeManager.MODE_NIGHT_AUTO:
359 currentMode = PARAM_SENSOR_MODE;
360 break;
361 case UiModeManager.MODE_NIGHT_YES:
362 currentMode = PARAM_NIGHT_MODE;
363 break;
364 case UiModeManager.MODE_NIGHT_NO:
365 currentMode = PARAM_DAY_MODE;
366 break;
367 }
368 writer.println("DayNightMode changed to: " + currentMode);
369 }
370 }
Antonio Cortese4619c72017-02-02 07:53:27 -0800371}