android Native相关知识点
来源:互联网 发布:linux设置ftp访问目录 编辑:程序博客网 时间:2024/06/05 18:46
1)添加到loop循环中==》epoll_ctl
1.1)native code中的input(1.2中的)向java或jni层发消息,要求处理input相关事件。
code->messageQueue->getLooper()->addFd( code->mainWorkRead, 0, ALOOPER_EVENT_INPUT, mainWorkCallback, code);
1.2)input事件查询的2个fd
1.2.1)来自input dispatch
mLooper->addFd(mConsumer.getChannel()->getFd(), ident, ALOOPER_EVENT_INPUT, callback, data);
1.2.2)此处key事件是来自IME,需要发送到消息队列中。
mLooper->addFd(mDispatchKeyRead, ident, ALOOPER_EVENT_INPUT, callback, data);
1.2中的事件若需要jni或java层处理则通过mainWorkWrie/mainWorkRead管道发消息给mainWorkCallback处理。(为了input快速返回?)
2)mainWorkCallback在主线程,inputqueue在子线程,dev写的native code也在子线程。
主线程调用natiecode的也是通过pipe
ALooper_addFd(looper, android_app->msgread, LOOPER_ID_MAIN, ALOOPER_EVENT_INPUT, NULL, &android_app->cmdPollSource);
java/jni主线程-->dev_native
static void android_app_write_cmd(struct android_app* android_app, int8_t cmd) {
if (write(android_app->msgwrite, &cmd, sizeof(cmd)) != sizeof(cmd)) {
LOGE("Failure writing android_app cmd: %s\n", strerror(errno));
}
}
nt8_t android_app_read_cmd(struct android_app* android_app) {
int8_t cmd;
if (read(android_app->msgread, &cmd, sizeof(cmd)) == sizeof(cmd)) {xx}
}
3)public abstract void takeSurface(SurfaceHolder.Callback2 callback)
Take ownership of this window's surface. The window's view hierarchy will no longer draw into the surface, though it will otherwise continue to operate (such as for receiving input events). The given SurfaceHolder callback will be used to tell you about state changes to the surface.
public abstract void takeInputQueue(InputQueue.Callback callback)
Take ownership of this window's InputQueue. The window will no longer read and dispatch input events from the queue; it is your responsibility to do so.
- android Native相关知识点
- Android Native代码知识点学习
- android webView相关知识点
- Android坐标系相关知识点
- Android相关技术知识点
- Android相关知识点
- Android学习相关知识点
- Android View相关知识点
- React Native Android(二)Navigator知识点
- android优化以及相关知识点
- android View的相关知识点
- Android Edittext相关的知识点
- Android硬件加速相关知识点总结
- Android 相关面试知识点整理
- Android中冷启动相关知识点
- android TextView 相关的知识点 汇总
- android EditText相关的知识点汇总
- Android横竖屏切换相关知识点
- 交叉编译器arm-linux-gcc-4.4.3安装
- 求数组{2,4,6,2,7}全排列
- DevExpress中绑定信息列表时,列字段如何再绑定方法
- 浅谈Devpress之ASPxGridLookup使用方法
- PHP Ctype函数
- android Native相关知识点
- android内存管理机制
- eclipse 转myeclipse 项目
- 用rz,sz命令在windows和linux之间传输文件
- Oracle的pipelined函数提升数据输出性能
- 输出7和7的倍数,还有包含7的数字例如(17,27,37...70,71,72,73...)
- mysqldump备份还原和mysqldump导入导出语句大全详解
- web.xml详解
- SDRAM