Android的INJECT_EVENTS许可 [英] Android INJECT_EVENTS permission

查看:1989
本文介绍了Android的INJECT_EVENTS许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个在后台运行的服务,将能够注入的任何活动运行触摸屏事件的应用程序。我可以通过调用注入事件到一个活动,就是我的应用程序的一部分 Instrumentation.sendPointerSync(motionEvent); 但是,如果我试图从我的应用程序做到这一点没有一个活动跑我得到一个权限错误说我没有INJECT_EVENTS权限。我已经添加了此权限到我的表现是这样的:<使用-权限的Andr​​oid:名称=android.permission.INJECT_EVENTS>< /使用-许可> 它虽然仍抛出相同的权限例外。经过一番搜索我已经得到了答案,为了获得INJECT_EVENTS许可,您的应用程序必须由同一个签名,该系统与签署签署。我不清楚但是究竟是什么意思。我将不得不寻找一个定制ROM构建它,并与该应用程序与签订了相同的签名签名。然后我的设备上安装自定义ROM,然后安装我的应用程序,我就能够正确地注入触摸事件?如果是这样的话是我最好开始与已经放在一起,就像一个 />抑或是一种情况,我将需要获取Android项目的git的副本,并建立整个事情myslef?而无论哪种方式,没有人知道的地方,你可以点我这将让我在正确的方向努力做到这一点?

I am trying to create an application that will have a service running in the background that will be capable of injecting touch screen events into whatever activity is running. I am able to inject events into an Activity that is part of my application by calling Instrumentation.sendPointerSync(motionEvent); However if I try to do this without an activity from my application running I get a permission error saying that I don't have the INJECT_EVENTS permission. I've added this permission to my manifest like this: <uses-permission android:name="android.permission.INJECT_EVENTS"></uses-permission> Its still throwing the same permission exception though. After a bit of searching I've gotten the answer that in order to receive the INJECT_EVENTS permission your app must be signed by the same signature that the system is signed with. I am unclear however what exactly this means. I am going to have to find a custom rom build it and sign it with the same signature that the application is signed with. Then install the custom rom on my device, then install my app and I'll be able to inject the touch events correctly? If this is the case am I better off starting with a custom rom that is already put together, like one from this page Or is it a situation where I am going to need to grab a git copy of the android project and build the whole thing myslef? And either way does anyone know of a place you could point me that would get me working in the right direction to make this happen?

推荐答案

其实,这是pretty的一个根深蒂固的设备上简单。我认为这是流失/系统将获得什么权限的任何它所需要的应用程序。所以,简单地手动安装您的应用程序/系统(这里<一个描述href="http://androidforums.com/droid-all-things-root/64603-installing-apk-system-app-directory.html">http://androidforums.com/droid-all-things-root/64603-installing-apk-system-app-directory.html ):

Actually, this is pretty simple on a rooted device. I think any app that is running off /system will get access to whatever permissions it requires. So simply manually install your App to /system (as described here http://androidforums.com/droid-all-things-root/64603-installing-apk-system-app-directory.html ):

执行以下命令在终端仿真程序要重新挂载/系统目录为读/写和应用程序安装到从SD卡的/系统/应用程序目录下:

Execute the following commands in the terminal emulator to remount the /system directory as read/write and to install the application into the /system/app directory from the SDCARD:

su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cp /sdcard/APP.apk /system/app

如果您preFER使用亚行从您的计算机,执行这些命令:

If you prefer to use adb from your computer, execute these commands:

adb remount
adb shell cp /sdcard/APP.apk /system/app

有用户利用根浏览器从谷歌市场,以简化这个过程。

Several users have utilized root explorer from the Google marketplace to simplify this process.

另外,检查了这一点:<一href="http://stackoverflow.com/questions/3598662/how-to-compile-android-application-with-system-permissions">How编译系统权限的Andr​​oid应用程序

Alternatively, check this out: How to compile Android Application with system permissions

这篇关于Android的INJECT_EVENTS许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆