android自动点击的实现流程记录
来源:互联网 发布:万科股权之争 知乎 编辑:程序博客网 时间:2024/05/16 18:22
一个android下自动点击触屏的程序,类似于windows下的按键精灵,自动帮我玩捕鱼达人
目标:用户可以通过配置脚本文件,自定义一系列的操作,例如:点击/长按/拖动/延时/颜色判断/循环,然后用音量+/-键启动/关闭脚本
思路:
1.linux下做一个c程序gameplug.c,此程序负责读取配置文件,完成用户定义的一系列操作。
2.init.rc中添加服务,该服务启动gameplug.c
3.framework用音量+/-开启/关闭服务。
4.settings中增加gameplug的选项,打开后音量+/-键用作启动/关闭脚本服务,关闭后做正常音量+/-用
流程:
1.写好自己的linux服务程序
android\system\core\toolbox\gameplug.c
修改android\system\core\toolbox\Android.mk,增加gameplug.c的编译选项
2.制作libgameplug.so供上层调用
新建android\system\core\libgameplug\文件夹,增加gameplug.c和Android.mk,gameplug.c负责启动
android\system\core\include\gameplug\gameplug.h,和JNI的接口
自己添加的自定义so文件库在编译的时候出现以下错误
-----------------------------------------------------------------------------
build/core/base_rules.mk:78: *** Module name: libgameplug
build/core/base_rules.mk:79: *** Makefile location: system/ibcom/gameplug
build/core/base_rules.mk:80: *
build/core/base_rules.mk:81: * Each module must use a LOCAL_MODULE_TAGS in its
build/core/base_rules.mk:82: * Android.mk. Possible tags declared by a module:
build/core/base_rules.mk:83: *
build/core/base_rules.mk:84: * optional, debug, eng, tests, samples
build/core/base_rules.mk:85: *
build/core/base_rules.mk:86: * If the module is expected to be in all builds
build/core/base_rules.mk:87: * of a product, then it should use the
build/core/base_rules.mk:88: * "optional" tag:
build/core/base_rules.mk:89: *
build/core/base_rules.mk:90: * Add "LOCAL_MODULE_TAGS := optional" in the
build/core/base_rules.mk:91: * Android.mk for the affected module, and add
build/core/base_rules.mk:92: * the LOCAL_MODULE value for that component
build/core/base_rules.mk:93: * into the PRODUCT_PACKAGES section of product
build/core/base_rules.mk:94: * makefile(s) where it's necessary, if
build/core/base_rules.mk:95: * appropriate.
build/core/base_rules.mk:96: *
build/core/base_rules.mk:97: * If the component should be in EVERY build of ALL
build/core/base_rules.mk:98: * products, then add its LOCAL_MODULE value to the
build/core/base_rules.mk:99: * PRODUCT_PACKAGES section of
build/core/base_rules.mk:100: * build/target/product/core.mk
build/core/base_rules.mk:101: *
build/core/base_rules.mk:102: *** user tag detected on new module - user tags are only supported on legacy modules. Stop.
-----------------------------------------------------------------------------
需要在android\build\core\user_tags.mk中添加你在Android.mk中LOCAL_MODULE定义的名字
这里是LOCAL_MODULE := libgameplug
3.init.rc增加service gameplug
android\system\core\rootdir\init.rc
service gameplug /system/bin/gameplug
disabled
oneshot
4.注册framework层JNI接口函数
添加 android\frameworks\base\services\jni\com_android_server_GameplugService.cpp
修改 android\frameworks\base\services\jni\onload.cpp
修改 android\frameworks\base\services\jni\Android.mk
修改 android\frameworks\base\services\java\com\android\server\SystemServer.java
修改 android\frameworks\base\services\java\com\android\server\GameplugService.java
增加 android\frameworks\base\core\java\android\os\IGameplugService.aidl
修改 android\frameworks\base\Android.mk
5.控制,volume+ start , volume- stop
修改 android\frameworks\base\media\java\android\media\AudioManager.java
6.package/app/settings增加选项enable/disbale gameplug,打开此选项后音量+/-当启动/关闭gameplug用,关闭此项还做音量键使用
修改 android\packages\apps\Settings\res\values\strings.xml
修改 android\packages\apps\Settings\res\xml\display_settings.xml
修改 android\packages\apps\Settings\src\com\android\settings\DisplaySettings.java
修改 android\frameworks\base\core\java\android\provider\Settings.java
7.编译
make update-api
make android
目标:用户可以通过配置脚本文件,自定义一系列的操作,例如:点击/长按/拖动/延时/颜色判断/循环,然后用音量+/-键启动/关闭脚本
思路:
1.linux下做一个c程序gameplug.c,此程序负责读取配置文件,完成用户定义的一系列操作。
2.init.rc中添加服务,该服务启动gameplug.c
3.framework用音量+/-开启/关闭服务。
4.settings中增加gameplug的选项,打开后音量+/-键用作启动/关闭脚本服务,关闭后做正常音量+/-用
流程:
1.写好自己的linux服务程序
android\system\core\toolbox\gameplug.c
修改android\system\core\toolbox\Android.mk,增加gameplug.c的编译选项
2.制作libgameplug.so供上层调用
新建android\system\core\libgameplug\文件夹,增加gameplug.c和Android.mk,gameplug.c负责启动
android\system\core\include\gameplug\gameplug.h,和JNI的接口
自己添加的自定义so文件库在编译的时候出现以下错误
-----------------------------------------------------------------------------
build/core/base_rules.mk:78: *** Module name: libgameplug
build/core/base_rules.mk:79: *** Makefile location: system/ibcom/gameplug
build/core/base_rules.mk:80: *
build/core/base_rules.mk:81: * Each module must use a LOCAL_MODULE_TAGS in its
build/core/base_rules.mk:82: * Android.mk. Possible tags declared by a module:
build/core/base_rules.mk:83: *
build/core/base_rules.mk:84: * optional, debug, eng, tests, samples
build/core/base_rules.mk:85: *
build/core/base_rules.mk:86: * If the module is expected to be in all builds
build/core/base_rules.mk:87: * of a product, then it should use the
build/core/base_rules.mk:88: * "optional" tag:
build/core/base_rules.mk:89: *
build/core/base_rules.mk:90: * Add "LOCAL_MODULE_TAGS := optional" in the
build/core/base_rules.mk:91: * Android.mk for the affected module, and add
build/core/base_rules.mk:92: * the LOCAL_MODULE value for that component
build/core/base_rules.mk:93: * into the PRODUCT_PACKAGES section of product
build/core/base_rules.mk:94: * makefile(s) where it's necessary, if
build/core/base_rules.mk:95: * appropriate.
build/core/base_rules.mk:96: *
build/core/base_rules.mk:97: * If the component should be in EVERY build of ALL
build/core/base_rules.mk:98: * products, then add its LOCAL_MODULE value to the
build/core/base_rules.mk:99: * PRODUCT_PACKAGES section of
build/core/base_rules.mk:100: * build/target/product/core.mk
build/core/base_rules.mk:101: *
build/core/base_rules.mk:102: *** user tag detected on new module - user tags are only supported on legacy modules. Stop.
-----------------------------------------------------------------------------
需要在android\build\core\user_tags.mk中添加你在Android.mk中LOCAL_MODULE定义的名字
这里是LOCAL_MODULE := libgameplug
3.init.rc增加service gameplug
android\system\core\rootdir\init.rc
service gameplug /system/bin/gameplug
disabled
oneshot
4.注册framework层JNI接口函数
添加 android\frameworks\base\services\jni\com_android_server_GameplugService.cpp
修改 android\frameworks\base\services\jni\onload.cpp
修改 android\frameworks\base\services\jni\Android.mk
修改 android\frameworks\base\services\java\com\android\server\SystemServer.java
修改 android\frameworks\base\services\java\com\android\server\GameplugService.java
增加 android\frameworks\base\core\java\android\os\IGameplugService.aidl
修改 android\frameworks\base\Android.mk
5.控制,volume+ start , volume- stop
修改 android\frameworks\base\media\java\android\media\AudioManager.java
6.package/app/settings增加选项enable/disbale gameplug,打开此选项后音量+/-当启动/关闭gameplug用,关闭此项还做音量键使用
修改 android\packages\apps\Settings\res\values\strings.xml
修改 android\packages\apps\Settings\res\xml\display_settings.xml
修改 android\packages\apps\Settings\src\com\android\settings\DisplaySettings.java
修改 android\frameworks\base\core\java\android\provider\Settings.java
7.编译
make update-api
make android
- android自动点击的实现流程记录
- Android 轮播图的实现 自动+手动滑动+指示+点击事件
- 安卓实现电脑端的QQ登录界面 自动提示+点击按钮提示输入记录
- android怎样实现自动点击功能
- 关于实现“点击记录变色”的情况
- Android 7.0 虚拟按键(NavigationBar)源码分析 之 点击事件的实现流程
- 解决【点击文本框会自动列出曾经的记录】问题
- ANdroid 模拟自动的点击按钮
- 实现鼠标自动点击
- Android点击事件的实现
- Android点击事件的实现
- android 实现button的点击
- android记录点击次数
- android 自动点击事件
- Android 自动点击
- Android:自动点击屏幕
- Android实现RecyclerView自动点击Item中的控件
- Android HFP流程记录
- 基于信号量的线程同步
- Windows 8 文件资源管理器(推荐)
- hadoop的文件系统一致模型
- windows 8 文件冲突界面改进
- windows 8 预览界面改进
- android自动点击的实现流程记录
- 软件发布时后面带的VOL Beta RC RTL的含义说明
- poj2029 Get Many Persimmon Trees
- OpenCV的cvRemap函数用法
- windows 8 中断处理界面改进
- Objective-C中@property和@synthesize的简要说明
- windows 8 Metro/Modern Style IE 10
- android中的message应用
- 校园记忆