当前位置:首页>科技>正文

android怎样实现自动点击功能

2023-05-18 04:15:30 互联网 未知 科技

 android怎样实现自动点击功能

android怎样实现自动点击功能

思路:
1.linux下做一个c程序gameplug.c,此程序负责读取配置文件,完成用户定义的一系列操作。
2.init.rc中添加服务,该服务启动gameplug.c
3.framework用音量 /-开启/关闭服务。
4.settings中增加gameplug的选项,打开后音量 /-键用作启动/关闭脚本服务,关闭后做正常音量 /-用
流程:
1.写好自己的linux服务程序
androidsystemcore oolboxgameplug.c
修改androidsystemcore oolboxAndroid.mk,增加gameplug.c的编译选项
2.制作libgameplug.so供上层调用
新建androidsystemcorelibgameplug文件夹,增加gameplug.c和Android.mk,gameplug.c负责启动
androidsystemcoreincludegamepluggameplug.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 its 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.
-----------------------------------------------------------------------------
需要在androiduildcoreuser_tags.mk中添加你在Android.mk中LOCAL_MODULE定义的名字
这里是LOCAL_MODULE := libgameplug

3.init.rc增加service gameplug
androidsystemcore ootdirinit.rc
service gameplug /system/bin/gameplug
disabled
oneshot
4.注册framework层JNI接口函数
添加 androidframeworksaseservicesjnicom_android_server_GameplugService.cpp

修改 androidframeworksaseservicesjnionload.cpp

修改 androidframeworksaseservicesjniAndroid.mk

修改 androidframeworksaseservicesjavacomandroidserverSystemServer.java

修改 androidframeworksaseservicesjavacomandroidserverGameplugService.java

增加 androidframeworksasecorejavaandroidosIGameplugService.aidl

修改 androidframeworksaseAndroid.mk

5.控制,volume start , volume- stop
修改 androidframeworksasemediajavaandroidmediaAudioManager.java

6.package/app/settings增加选项enable/disbale gameplug,打开此选项后音量 /-当启动/关闭gameplug用,关闭此项还做音量键使用

修改 androidpackagesappsSettings esvaluesstrings.xml

修改 androidpackagesappsSettings esxmldisplay_settings.xml

修改 androidpackagesappsSettingssrccomandroidsettingsDisplaySettings.java
  修改 androidframeworksasecorejavaandroidproviderSettings.java
7.编译
make update-api
make android