get CarHardwareManager lazily

This commit is contained in:
johan12345
2021-09-05 21:21:30 +02:00
parent 2576bc4854
commit ff75594b37

View File

@@ -49,8 +49,9 @@ class EVMapSession(val cas: CarAppService) : Session(), LifecycleObserver {
}
private var location: Location? = null
private var locationService: CarLocationService? = null
private val hardwareMan =
private val hardwareMan: CarHardwareManager by lazy {
carContext.getCarService(CarContext.HARDWARE_SERVICE) as CarHardwareManager
}
private val serviceConnection = object : ServiceConnection {
override fun onServiceConnected(name: ComponentName, ibinder: IBinder) {