Android开发_aidl工具

Focus on technology, enjoy life!—— 杨焕州 QQ:804212028
原文链接:http://blog.youkuaiyun.com/y18334702058/article/details/44624305
本文可能存在参考或借助部分外界资源,如有任何侵权行为,请与我联系!


  • 主题:aidl工具

    -由于每个应用程序都运行在自己的进程空间,并且可以从应用程序UI运行另一个服务进程,而且经常会在不同的进程间传递对象。在Android平台,一个进程通常不能访问另一个进程的内存空间,所以要想对话,需要将对象分解成操作系统可以理解的基本单元,并且有序的通过进程边界。

    -通过代码来实现这个数据传输过程是冗长乏味的,Android提供了AIDL工具来处理这项工作。
    AIDL (Android Interface Definition Language)是一种IDL 语言,用于生成可以在Android设备上两个进程之间进行进程间通信(IPC)的代码。如果在一个进程中(例如Activity)要调用另一个进程中(例如Service)对象的操作,就可以使用AIDL生成可序列化的参数。
    序列化 (将对象转换为0101二进制数据)
    这里写图片描述

Focus on technology, enjoy life!—— 杨焕州 QQ:804212028
原文链接:http://blog.youkuaiyun.com/y18334702058/article/details/44624305

::ndk::ScopedAStatus BpCameraService::addListener(const std::shared_ptr<::aidl::android::frameworks::cameraservice::service::ICameraServiceListener>& in_listener, std::vector<::aidl::android::frameworks::cameraservice::service::CameraStatusAndId>* _aidl_return) { binder_status_t _aidl_ret_status = STATUS_OK; ::ndk::ScopedAStatus _aidl_status; ::ndk::ScopedAParcel _aidl_in; ::ndk::ScopedAParcel _aidl_out; _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR()); if (_aidl_ret_status != STATUS_OK) goto _aidl_error; _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_listener); if (_aidl_ret_status != STATUS_OK) goto _aidl_error; _aidl_ret_status = AIBinder_transact( asBinder().get(), (FIRST_CALL_TRANSACTION + 0 /*addListener*/), _aidl_in.getR(), _aidl_out.getR(), 0 #ifdef BINDER_STABILITY_SUPPORT | FLAG_PRIVATE_LOCAL #endif // BINDER_STABILITY_SUPPORT ); if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && ICameraService::getDefaultImpl()) { _aidl_status = ICameraService::getDefaultImpl()->addListener(in_listener, _aidl_return); goto _aidl_status_return; } if (_aidl_ret_status != STATUS_OK) goto _aidl_error; _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR()); if (_aidl_ret_status != STATUS_OK) goto _aidl_error; if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return; _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return); if (_aidl_ret_status != STATUS_OK) goto _aidl_error; _aidl_error: _aidl_status.set(AStatus_fromStatus(_aidl_ret_status)); _aidl_status_return: return _aidl_status; }
最新发布
08-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值