当前位置: 首页 > news >正文

珠海企业网站建设公司seo网络营销外包

珠海企业网站建设公司,seo网络营销外包,深圳市8号公告最新消息,新疆做网站多少钱Android Automotive平台 Android Automotive是通过Android的通用框架,语言和API来实现的一个全栈,开源,高度可定制的平台。 Android Automotive与整个Android生态系统的关系 Android Automotive是Android的一部分。 Android Automotive不是…

Android Automotive平台

Android Automotive是通过Android的通用框架,语言和API来实现的一个全栈,开源,高度可定制的平台。

Android Automotive与整个Android生态系统的关系

  • Android Automotive是Android的一部分。 Android Automotive不是Android的分支或并行开发,它与手机,平板电脑等安卓设备上的Android具有相同的代码库,并且位于相同的存储库中。它基于经过10多年开发的强大平台和功能集,可利用现有的安全模型,兼容性程序,开发人员工具和基础架构,同时继续具有高度可定制性和可移植性,完全免费和开源的特点。
  • Android Automotive扩展了Android 。在将Android打造为功能齐全的信息娱乐平台的过程中,我们添加了对汽车特定要求,功能和技术的支持。就像今天用于移动设备的Android一样,Android Automotive将是一个完整的汽车信息娱乐平台。

Android Automotive架构

Automotive

Android Automative是在原先Android的系统架构上增加了一些与车相关的(图中虚线框中绿色背景的)模块。

  • Car App :包括OEM和第三方开发的App
  • Car API :提供给汽车App特有的接口
  • Car Service :系统中与车相关的服务,主要是基于CarProperty实现Vechile相关的一些策略
  • Vehicle Network Service :汽车的网络服务
  • Vehicle HAL :汽车的硬件抽象层描述,定义 OEM 可以实现的车辆属性的接口

Android CarAPI

CarAPI

· annotation:包含了两个注解。 · app · menu:车辆应用菜单相关API。 · cluster:仪表盘相关API。 · render:渲染相关API。 · content · pm:应用包相关API。 · diagnostic:包含与汽车诊断相关的API。 · hardware:车辆硬件相关API。 · cabin:座舱相关API。 · hvac:通风空调相关API。 · property:属性相关API(实现定制的property)。 · radio:收音机相关API。 · input:输入相关API。 · media:多媒体相关API。 · navigation:导航相关API。 · settings:设置相关API。 · vms:汽车监测相关API

这些api集合中,我们可以通过CarpropertyManager去实现定制的property功能,简要类图:

CarpropertyManager内部方法

  • 通过registerListener注册自定义的propertyId以及property变更通知的callback

  • 解注册CarpropertyEventListener

  • 获取所有property, 返回一个元素类型是CarpropertyConfig的list

  • 获取property状态

  • 获取property value

  • 设置property value

CarpropertyManager与service层交互的AIDL接口

需要注意的是ICarProperty是同步接口,ICarPropertyEventListener是异步接口。

onEvent传上来的是参数是CarPropertyEvent的list,CarPropertyEvent中包含event type与CarPropertyValue; eventType包含PROPERTY_EVENT_PROPERTY_CHANGE与PROPERTY_EVENT_ERROR,分别对应listener中的onPropertyChanged和PROPERTY_EVENT_ERROR, CarPropertyValue则包含具体的propId、propValue等具体属性信息。

Android CarService

代码目录: packages/services/Car/service
  • CarService并非一个服务,而是一系列的服务。这些服务都在ICarImpl.java构造函数中列了出来

CarService启动流程

启动CarServiceHelperService

SystemServer启动过程中,在ActivityManagerService systemReady时,启动CarServiceHelperService。 代码:

android/frameworks/base/services/java/com/android/server/SystemServer.java
​
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {t.traceBegin("StartCarServiceHelperService");final SystemService cshs = mSystemServiceManager.startService(CAR_SERVICE_HELPER_SERVICE_CLASS);if (cshs instanceof Dumpable) {mDumper.addDumpable((Dumpable) cshs);}if (cshs instanceof DevicePolicySafetyChecker) {dpms.setDevicePolicySafetyChecker((DevicePolicySafetyChecker) cshs);}t.traceEnd();
}
​
private static final String CAR_SERVICE_HELPER_SERVICE_CLASS ="com.android.internal.car.CarServiceHelperService";

启动CarService

CarServiceHelperService在onStart时拉起CarServcie,加载Native库car-framework-service-jni。

代码:

android/frameworks/opt/car/services/src/com/android/internal/car/CarServiceHelperService.java
​
public void onStart() {EventLog.writeEvent(EventLogTags.CAR_HELPER_START);
​IntentFilter filter = new IntentFilter(Intent.ACTION_REBOOT);filter.addAction(Intent.ACTION_SHUTDOWN);mContext.registerReceiverForAllUsers(mShutdownEventReceiver, filter, null, null);mCarWatchdogDaemonHelper.addOnConnectionChangeListener(mConnectionListener);mCarWatchdogDaemonHelper.connect();Intent intent = new Intent();intent.setPackage("com.android.car");intent.setAction(CAR_SERVICE_INTERFACE);if (!mContext.bindServiceAsUser(intent, mCarServiceConnection, Context.BIND_AUTO_CREATE,mHandler, UserHandle.SYSTEM)) {Slogf.wtf(TAG, "cannot start car service");}loadNativeLibrary();
}
​
void loadNativeLibrary() {System.loadLibrary("car-framework-service-jni");
}
​

代码:

android/packages/services/Car/car-lib/src/com/android/car/internal/common/CommonConstants.java
​
public static final String CAR_SERVICE_INTERFACE = "android.car.ICar";

代码:

android/packages/services/Car/service/AndroidManifest.xml
​
<manifest xmlns:android="http://schemas.android.com/apk/res/android"xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"package="com.android.car"coreApp="true"android:sharedUserId="android.uid.system">
​<application android:label="@string/app_title"android:directBootAware="true"android:allowBackup="false"android:persistent="true"><service android:name=".CarService"android:singleUser="true"android:exported="true"><intent-filter><action android:name="android.car.ICar"/></intent-filter></service>

初始化ICarImpl

CarService在onCreate时先判断Vehicle HAL起来了,然后再初始化ICarImpl。 代码:

android/packages/services/Car/service/src/com/android/car/CarService.java
​
public void onCreate() {LimitedTimingsTraceLog initTiming = new LimitedTimingsTraceLog(CAR_SERVICE_INIT_TIMING_TAG,Trace.TRACE_TAG_SYSTEM_SERVER, CAR_SERVICE_INIT_TIMING_MIN_DURATION_MS);initTiming.traceBegin("CarService.onCreate");
​initTiming.traceBegin("getVehicle");mVehicle = getVehicle();initTiming.traceEnd();EventLog.writeEvent(EventLogTags.CAR_SERVICE_CREATE, mVehicle == null ? 0 : 1);if (mVehicle == null) {throw new IllegalStateException("Vehicle HAL service is not available.");}try {mVehicleInterfaceName = mVehicle.interfaceDescriptor();} catch (RemoteException e) {throw new IllegalStateException("Unable to get Vehicle HAL interface descriptor", e);}Slog.i(CarLog.TAG_SERVICE, "Connected to " + mVehicleInterfaceName);EventLog.writeEvent(EventLogTags.CAR_SERVICE_CONNECTED, mVehicleInterfaceName);mICarImpl = new ICarImpl(this,mVehicle,SystemInterface.Builder.defaultSystemInterface(this).build(),mVehicleInterfaceName);mICarImpl.init();linkToDeath(mVehicle, mVehicleDeathRecipient);ServiceManager.addService("car_service", mICarImpl);SystemProperties.set("boot.car_service_created", "1");super.onCreate();initTiming.traceEnd(); // "CarService.onCreate"
}
​
private static IVehicle getVehicle() {final String instanceName = SystemProperties.get("ro.vehicle.hal", "default");
​try {return android.hardware.automotive.vehicle.V2_0.IVehicle.getService(instanceName);} catch (RemoteException e) {Slog.e(CarLog.TAG_SERVICE, "Failed to get IVehicle/" + instanceName + " service", e);} catch (NoSuchElementException e) {Slog.e(CarLog.TAG_SERVICE, "IVehicle/" + instanceName + " service not registered yet");}return null;
}
​

代码:

android/packages/services/Car/car-lib/src/android/car/ICar.aidl
android/packages/services/Car/service/src/com/android/car/ICarImpl.java

初始化各个Car Services组件

ICarImpl构造函数中,构造了下面几个实现了CarServiceBase接口的Car Services组件,以及VehicleHal和CarStatsService;然后通过init函数进行初始化。

CarFeatureController
CarPropertyService
CarDrivingStateService
CarUxRestrictionsManagerService
CarUserService
CarOccupantZoneService
SystemActivityMonitoringService
CarPowerManagementService
CarUserNoticeService
CarPackageManagerService
PerUserCarServiceHelper
CarBluetoothService
CarInputService
CarProjectionService
GarageModeService
AppFocusService
CarAudioService
CarNightService
FixedActivityService
ClusterNavigationService
InstrumentClusterService
VmsBrokerService
CarDiagnosticService
CarStorageMonitoringService
CarLocationService
CarMediaService
CarBugreportManagerService
CarExperimentalFeatureServiceController
CarWatchdogService
CarDevicePolicyService
ClusterHomeService
CarEvsService
CarTelemetryService
CarActivityService

初始化各个Hal Services组件

VehicleHal构造函数中,构造了下面几个继承自HalServiceBase基类的Hal Services组件以及HalClient;然后通过init函数进行初始化。

PowerHalService
PropertyHalService
InputHalService
VmsHalService
UserHalService
DiagnosticHalService
ClusterHalService
EvsHalService
TimeHalService

代码:

android/packages/services/Car/service/src/com/android/car/hal/VehicleHal.java

VehicleHAL目录结构

下面是vehicle 2.0参考实现的目录结构。

android/hardware/interfaces/automotive/vehicle/2.0/
|-- default // 默认实现|-- common|-- include|-- vhal_v2_0 // .h|-- src // .cpp|-- impl|-- vhal_v2_0 // impl代码|-- proto // proto协议|-- tests|-- tests|-- Android.bp // 编译文件|-- VehicleService.cpp // main函数|-- android.hardware.automotive.vehicle@2.0-service.rc // init rc|-- android.hardware.automotive.vehicle@2.0-service.xml // matrix xml
|-- utils
|-- vts
|-- Android.bp // 编译文件
|-- IVehicle.hal // interface
|-- IVehicleCallback.hal // callback
|-- types.hal // types

Hidl代码有个明显的namespace规则,如下。

namespace android {
namespace hardware {
namespace automotive {
namespace vehicle {
namespace V2_0 {
// ...
}  // namespace V2_0
}  // namespace vehicle
}  // namespace automotive
}  // namespace hardware
}  // namespace android

VehicleHAL启动流程

rc

VehicleHAL由init rc启动。 代码:

android/hardware/interfaces/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc
​
service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-serviceclass early_haluser vehicle_networkgroup system inet

main

下面是VehicleHAL的main函数。 代码:

android/hardware/interfaces/automotive/vehicle/2.0/default/VehicleService.cpp
​
int main(int /* argc */, char* /* argv */ []) {auto store = std::make_unique<VehiclePropertyStore>();auto connector = std::make_unique<impl::EmulatedVehicleConnector>();auto userHal = connector->getEmulatedUserHal();auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get(), userHal);auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get());auto service = std::make_unique<VehicleHalManager>(hal.get());connector->setValuePool(hal->getValuePool());
​configureRpcThreadpool(4, true /* callerWillJoin */);ALOGI("Registering as service...");status_t status = service->registerAsService();if (status != OK) {ALOGE("Unable to register vehicle service (%d)", status);return 1;}ALOGI("Ready");joinRpcThreadpool();return 1;
}
  • VehiclePropertyStore:存储、访问和修改vehicle相关的配置及属性,VehiclePropertyValues存储在有序map中。使用了同步锁,线程安全。
  • EmulatedVehicleConnector:VehicleHalClient与VehicleHalServer通信的连接器。
  • EmulatedUserHal:User Hal。
  • EmulatedVehicleHal:Vehicle Hal。
  • VehicleEmulator:Vehicle Emulator。
  • VehicleHalManager:This class is a thick proxy between IVehicle HIDL interface and vendor’s implementation.

以上为车机开发技术中的CarFrameWork学习;启动流程及原理介绍,更多的车载技术可以前往《车机开发技术手册》查看更多车载技术。

交互

CarService向上与App通过CarLib(aidl)交互,向下与VehicleHAL通过hidl交互,其中包括了一个很重要的概念:Property。 Property可以是静态的,也可以是变化后向上通报的,还可以是以一定的频率实时上报的。 下面以HVAC为例,说明HVAC的控制过程。

  • 【App】调用CarLib中【CarHvacManager】的setBooleanProperty设置Property。
  • 【CarHvacManager】调用CarLib中【CarPropertyManager】的setBooleanProperty。
  • 【CarPropertyManager】将Property封装成CarPropertyValue后调用CarServcie中【ICarProperty-CarPropertyService】的setProperty。(aidl) 【CarPropertyService】调用CarServcie中【PropertyHalService】的setProperty。
  • 【PropertyHalService】将CarPropertyValue封装成VehiclePropValue后调用CarServcie中【VehicleHal】的set。
  • 【VehicleHal】调用CarServcie中【HalClient】的setValue。
  • 【HalClient】调用VehicleHAL中【IVehicle-VehicleHalManager】的set。(hidl)
  • 【VehicleHalManager】,首先,通过订阅这个Property的【Native HalClient】的callback即【IVehicleCallback-HalClient$VehicleCallback】的onPropertySet通知Property变更。(hidl callback)
  • 【VehicleHalManager】,然后,调用【EmulatedVehicleHal】的set。
  • 【EmulatedVehicleHal】检查Property后调用【VehicleHalClient】的setProperty。
  • 【VehicleHalClient】与EmulatedVehicleConnector有关,调用【EmulatedVehicleConnector】的onSetProperty。
  • 【EmulatedVehicleConnector】与VehicleHalServer有关,调用【VehicleHalServer】的onSetProperty。

最终,将Property或转换后的信号发到【Car ECU】。vehicle 2.0模拟实现是将Property存储到VehiclePropertyStore

http://www.yidumall.com/news/21951.html

相关文章:

  • wordpress4.2下载廊坊百度关键词优化
  • 网页设计案例教程杨松答案北京seo相关
  • 云服务器怎么做网站武汉搜索引擎营销
  • 360网站托管广告联盟论坛
  • cad图做网站链接百度关键词怎么设置
  • 信阳做网站 汉狮网络如何做网络销售平台
  • 做网站java步骤外贸网站推广方法之一
  • 网站换行代码网络推广的方法和技巧
  • h5自响应式网站模版如何搭建一个网站平台
  • 有没有高质量的网站都懂的seo推广方法集合
  • 图跃网站建设网站服务器信息查询
  • 广州网站设计提供商郑州疫情最新情况
  • 电子商务网站建设花费百度网盘电脑版登录入口
  • 网站建设个人工作室seo博客写作
  • 期货网站做模拟衡阳seo优化推荐
  • 重庆娱乐公司seo工资待遇怎么样
  • 做的网站怎么提交到百度上去百度广告销售
  • 平面设计素材网站排名自媒体营销模式有哪些
  • 制作公司网站结构图网站查询入口
  • 专业网站制作技术厦门seo优化推广
  • 网上书店网站建设方案策划小视频网站哪个可以推广
  • 曲靖网站建设公司网址怎么制作
  • 那个网站做国外售货微信运营工具
  • 庄浪县人民政府网站新平台推广赚钱
  • 佛山新网站制作代理商什么是淘宝seo
  • 南宁 网站建设 制作企业网站排名优化价格
  • 淘宝的网站建设方案外贸建站优化
  • 产品的seo是什么意思长沙网站seo公司
  • 承德网站建设报价中国搜索引擎排名2021
  • 长沙做网站工作室海口做网站的公司