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

怎样给网站登录界面做后台赣州人才网官网登录

怎样给网站登录界面做后台,赣州人才网官网登录,沙洋县住房和城乡建设局网站,百度seo优化系统文章目录 AIDL的原理构建AIDL的流程往冻结的AIDL中加接口 AIDL的原理 可以利用ALDL定义客户端与服务均认可的编程接口#xff0c;以便二者使用进程间通信 (IPC) 进行相互通信。在 Android 中#xff0c;一个进程通常无法访问另一个进程的内存。因此#xff0c;为进行通信以便二者使用进程间通信 (IPC) 进行相互通信。在 Android 中一个进程通常无法访问另一个进程的内存。因此为进行通信进程需将其对象分解成可供操作系统理解的原语并将其编组为可供您操作的对象。编写执行该编组操作的代码较为繁琐因此 Android 会使用 AIDL 为您处理此问题。 AIDL 可以理解成是一个范式 通过这个范式编写接口文件 然后利用Android的AIDL工具 会生成继承binder所需要能力的头文件。 构建AIDL的流程 以automotive的audiocontrol模块为例 编写AIDL接口文件编写Android.bp, 通过AIDL 生成头文件 其aidl的文件位于下面的目录 hardware/interfaces/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/编译会在下面的目录生成实现binder通信的接口文件。 接口文件有java cpp ndk三种类型。 使得能够被不同的客户端和服务端的代码引用到。 out/soong/.intermediates/hardware/interfaces/automotive/audiocontrol/aidl/android.hardware.automotive.audiocontrol-V2-cpp-source/gen/include/android/hardware/automotive/audiocontrol$ ls AudioFocusChange.h BnFocusListener.h BpDuckingInfo.h IAudioControl.h BnAudioControl.h BnMutingInfo.h BpFocusListener.h IFocusListener.h BnAudioFocusChange.h BpAudioControl.h BpMutingInfo.h MutingInfo.h BnDuckingInfo.h BpAudioFocusChange.h DuckingInfo.h实现service实现service对应的bin以及rc注册服务到servicemananger AudioContro 实现的demo bin位于hardware/interfaces/automotive/audiocontrol/aidl/default 目录下编译会生成 android.hardware.automotive.audiocontrol-service.example这样的bin 这个bin在 audiocontrol-default.rc 中启动。 当然服务端的是 就是把audiocontrol的服务注册到servicemanger中。 std::shared_ptrAudioControl audioControl ::ndk::SharedRefBase::makeAudioControl();const std::string instance std::string() AudioControl::descriptor /default;binder_status_t status AServiceManager_addService(audioControl-asBinder().get(), instance.c_str());CHECK_EQ(status, STATUS_OK); 服务的名字在audiocontrol-default.xml中定义为 android.hardware.automotive.audiocontrol.IAudioControl/default 实现client获取service调用service相关的接口。 clinet 端 主要是通过名字从serviceManager 中获取到audioControl的服务。然后通过服务调用其接口。 如下通过getService 获取服务然后通过名字获取IAudioControl对象。然后就可以调用其函数了 private static final String AUDIO_CONTROL_SERVICE android.hardware.automotive.audiocontrol.IAudioControl/default;private IBinder mBinder;private IAudioControl mAudioControl;private boolean mListenerRegistered false;private AudioControlDeathRecipient mDeathRecipient;static Nullable IBinder getService() {return Binder.allowBlocking(ServiceManager.waitForDeclaredService(AUDIO_CONTROL_SERVICE));}AudioControlWrapperAidl(IBinder binder) {mBinder Objects.requireNonNull(binder);mAudioControl IAudioControl.Stub.asInterface(binder);}IBinder binder AudioControlWrapperAidl.getService(); if (binder ! null) {return new AudioControlWrapperAidl(binder); }Overridepublic void onAudioFocusChange(AttributeUsage int usage, int zoneId, int focusChange) {if (Slogf.isLoggable(TAG, Log.DEBUG)) {Slogf.d(TAG, onAudioFocusChange: usage usageToString(usage) , zoneId zoneId , focusChange focusChange);}try {String usageName usageToXsdString(usage);mAudioControl.onAudioFocusChange(usageName, zoneId, focusChange);} catch (RemoteException e) {throw new IllegalStateException(Failed to query IAudioControl#onAudioFocusChange, e);}} 往冻结的AIDL中加接口 按照Android规则来说 发布之后的AIDL接口是不能修改的。 有相应的Freeze AIDL APIs处理。 从提交记录看 freeze 的操作是加hash值。 diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index 7a947d3ab..4acfd82d6 100644 --- a/automotive/audiocontrol/aidl/Android.bpb/automotive/audiocontrol/aidl/Android.bp-19,4 19,5 aidl_interface { sdk_version: module_current, }, },versions: [1], } diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1/.hash b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1/.hash new file mode 100644 index 000000000..c4bb36b47 --- /dev/nullb/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1/.hash-0,0 1 ba2a7caca61683385b3b100e4faab1b4139fc547看提交记录加接口的地方 /aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl/aidl/default/AudioControl.h/aidl/default/AudioControl.cpp diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl index 4b03af11a..3a0224557 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidlb/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidldiff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp index 748947cb2..b076d0128 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.cppb/automotive/audiocontrol/aidl/default/AudioControl.cppdiff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h index cf5694762..ab0b1b305 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.hb/automotive/audiocontrol/aidl/default/AudioControl.h出现AIDL修改报错 Above AIDL file(s) has changed and this is NEVER allowed on a release platform (i.e., PLATFORM_VERSION_CODENAME is REL). If a device is shipped with this change by ignoring this message, it has a high risk of breaking later when a module using the interface is updated, e.g., Maineline modules. 11:47:01 ninja failed with: exit status 1报错的原因解释 stability 此接口的稳定性承诺的可选标志。目前仅支持vintf 。如果未设置则对应于在此编译上下文中具有稳定性的接口因此此处加载的接口只能与一起编译的东西一起使用例如在 system.img 上。如果将其设置为vintf 则这对应于稳定性承诺接口必须在使用期间保持稳定。 解决 所有的AIDL有关地方的接口都要增加。 出现hash校验错误 hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocont FAILED: out/soong/.intermediates/hardware/interfaces/automotive/audiocontrol/aidl/android.hardware.automotive.audiocontrol-api/checkhash_1.timestamp if [ $(cd hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1 { find ./ -name *.aidl -print0 | LC_ALLC sort -z | xargs -0 sha1sum echo latest-version; } | sha1sum | cut -d -f 1) $(read -r hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1/.hash hash extra; printf %s $hash) ]; then touch out/soong/.intermediates/hardware/interfaces/automotive/audiocontrol/aidl/android.hardware.automotive.audiocontrol-api/checkhash_1.timestamp; else cat system/tools/aidl/build/message_check_integrity.txt exit 1; fi ############################################################################### # ERROR: Modification detected of stable AIDL API file # ############################################################################### Above AIDL file(s) has changed, resulting in a different hash. Hash values may be checked at runtime to verify interface stability. If a device is shipped with this change by ignoring this message, it has a high risk of breaking later when a module using the interface is updated, e.g., Mainline modules. 16:41:52 ninja failed with: exit status 1错误原因 构建过程未能验证 AIDL 文件的哈希值表明发生了修改。 哈希检查脚本bash if [ $(cd hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1 { find ./ -name *.aidl -print0 | LC_ALLC sort -z | xargs -0 sha1sum echo latest-version; } | sha1sum | cut -d -f 1) $(read -r hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1/.hash hash extra; printf %s $hash) ]; then touch out/soong/.intermediates/hardware/interfaces/automotive/audiocontrol/aidl/android.hardware.automotive.audiocontrol-api/checkhash_1.timestamp; else cat system/tools/aidl/build/message_check_integrity.txt exit 1; fi这是检查 AIDL 文件哈希值是否与预期哈希值匹配的脚本。如果哈希值匹配构建过程将继续进行否则将引发错误。错误消息makefile ERROR: Modification detected of stable AIDL API file 修改hash值。 根据报错的提交脚本。使用下面的脚本在对应的目录下生成hash 值 将这个hash值替换到.hash文件即可 目录hardware/interfaces/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/1 { find ./ -name *.aidl -print0 | LC_ALLC sort -z | xargs -0 sha1sum echo latest-version; } | sha1sum | cut -d -f 1出现这个错误 Android will be dropped but finished with status UNKNOWN_TRANSACTION 需要push 所有system/lib底下有关的audiocontrol的so、 使用版本化接口接口方法在运行时当尝试在旧服务器上调用新方法时新客户端会收到错误或异常具体取决于后端。 cpp后端获取::android::UNKNOWN_TRANSACTION 。 ndk后端获取STATUS_UNKNOWN_TRANSACTION 。 java后端获取android.os.RemoteException并显示一条消息说明 API 未实现。 总结 在冻结的AIDL接口上面加新的接口 需要做的步骤。 但是强烈不建议这么做可以自己单独实现一个AIDL接口、AIDL的服务、以及上层的实现 修改AIDL文件 添加接口计算Hash修改hash 值编译push 生成的so在应用上层获取服务就可以调用到新的接口了。
http://www.pierceye.com/news/106266/

相关文章:

  • 英文网站建设推广joomla drupal wordpress
  • 什么网站做简历免费下载怎么申请专线访问国际网络
  • 南三环做网站的公司网站开发开题报告计划进度安排
  • 我想建一个网站怎么建微信 网站提成方案点做
  • 苏中建设集团官方网站网络推广文章的方法
  • 月嫂云商城网站建设切换国外ip的软件
  • 沧州网站建设 凯航怎么样建立一个网站
  • 百度网站地图模板在猪八戒上做网站要注意什么
  • 做美工需要哪些网站重庆交通建设集团网站
  • 网站手机端排名怎么做用笔记本做网站
  • 食药监局网站建设方案南京企业自助建站
  • 竹山县住房和城乡建设局网站红豆网桂林论坛
  • 浙江省建设网站专题网站建设的请示
  • php网站好吗红旗渠建设集团网站
  • 网站建设如何不被忽悠做营销怎样才能吸引客户
  • 代写文章兼职济南公交优化
  • 商城开发网站建立公司网站步骤
  • 查询域名注册网站泰国做网站
  • 网站图片描述怎么写社区类网站有哪些
  • 网站竞争对手的选定一般参考什么标准的网站的推广方案的内容有哪些
  • 把别人的图片拿来做网站wordpress 覆盖原始图片对比效果
  • 江门市建设工程备案网站乌兰浩特网站开发
  • 个人介绍微电影网站模板免费下载一个网站的建设成本
  • 搬瓦工怎么做网站百度小程序开发教程
  • 织梦网站被攻击小型门户网站建设方案
  • 长沙网站托管公司排名静态网站结构如何更新
  • 网站建设 宜宾湖州网站建设培训教程
  • 网站建设脚本什么叫营销型网站
  • 沧州网站建设专业的公司4000-262-seo优化与品牌官网定制
  • 网页游戏推广网站怎么做如何创建平台类网站