但它仍然错误的应用程序需要INJECT_EVENTS权限 [英] But it still error application requires INJECT_EVENTS permission

查看:1693
本文介绍了但它仍然错误的应用程序需要INJECT_EVENTS权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循:的Andr​​oid INJECT_EVENTS许可
和<一个href=\"http://stackoverflow.com/questions/14410903/permission-inject-events-for-instrumenation-to-other-apps\">Permission: INJECT_EVENTS为Instrumenation到其他应用

1.我已经做了根我的手机的成功。

1.I have done root my phone success.

2.我已经做了如下签名应用APK 并复制 app.apk 系统/应用程序并设置权限 app.apk RW​​-R - R的 -

2.I have done follow sign application APK and copy app.apk to system/app and set permission app.apk to rw-r--r-- by app root explorer

3.我添加&LT;使用许可权的android:NAME =android.permission.INJECT_EVENTS/&GT; 在AndroidManifest.xml

3.I add <uses-permission android:name="android.permission.INJECT_EVENTS" /> in Androidmanifest.xml

但它仍然需要差错注入permissoin。我不知道为什么?

but It still error require inject permissoin. I don't know why?

    06-06 21:23:31.815: E/OpenCV::camera(21812): calling (*pGetPropertyC)(0x7bde06c8, 3)
06-06 21:23:32.058: E/AndroidRuntime(21812): FATAL EXCEPTION: Thread-1881
06-06 21:23:32.058: E/AndroidRuntime(21812): Process: com.example.handtracking, PID: 21812
06-06 21:23:32.058: E/AndroidRuntime(21812): java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
06-06 21:23:32.058: E/AndroidRuntime(21812):    at android.os.Parcel.readException(Parcel.java:1472)
06-06 21:23:32.058: E/AndroidRuntime(21812):    at android.os.Parcel.readException(Parcel.java:1426)
06-06 21:23:32.058: E/AndroidRuntime(21812):    at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:356)
06-06 21:23:32.058: E/AndroidRuntime(21812):    at android.hardware.input.InputManager.injectInputEvent(InputManager.java:642)
06-06 21:23:32.058: E/AndroidRuntime(21812):    at android.app.Instrumentation.sendPointerSync(Instrumentation.java:937)
06-06 21:23:32.058: E/AndroidRuntime(21812):    at com.example.handtracking.CameraService$CameraWorker$2.run(CameraService.java:293)
06-06 21:23:32.274: E/Surface(240): queueBuffer: error queuing buffer to SurfaceTexture, -32
06-06 21:23:32.276: E/MtkCam/DisplayClient(240): (22102)[enquePrvOps] mpStreamOps->enqueue_buffer failed: status[Broken pipe(32)], rpImgBuf(0xb7381fb8,0xaeeb1000) (enquePrvOps){#369:mediatek/hardware/mtkcam/v1/client/DisplayClient/DisplayClient.Stream.cpp}
06-06 21:23:32.406: E/Sensors(785): handleToDriver handle(0)
06-06 21:23:32.406: E/Sensors(785): handleToDriver handle(0)
06-06 21:23:32.409: E/Sensors(785): new setDelay handle(0),ns(1000000)m, error(0), index(1)
06-06 21:23:32.409: E/Accel(785): ACC batch: handle:0, en:0, maxBatchReportLatencyNs:0 
06-06 21:23:32.409: E/Sensors(785): sensor 0 go to common batch
06-06 21:23:32.480: E/Sensors(785): handleToDriver handle(0)
06-06 21:23:32.480: E/Sensors(785): handleToDriver handle(0)
06-06 21:23:32.483: E/Sensors(785): new setDelay handle(0),ns(1000000)m, error(0), index(1)
06-06 21:23:32.483: E/Accel(785): ACC batch: handle:0, en:0, maxBatchReportLatencyNs:0 
06-06 21:23:32.483: E/Sensors(785): sensor 0 go to common batch
06-06 21:23:32.743: E/PROXIMITY(785): ProximitySensor: unknown event (type=3, code=0)
06-06 21:23:32.843: E/PROXIMITY(785): ProximitySensor: unknown event (type=3, code=0)
06-06 21:23:33.543: E/PROXIMITY(785): ProximitySensor: unknown event (type=3, code=0)

code注入事件

Code Inject event

thread_touch = new Thread(){
                       @Override
                       public void run(){
                               Instrumentation m_Instrumentation = new Instrumentation();

                               m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                                       SystemClock.uptimeMillis(),
                                       SystemClock.uptimeMillis(),
                                       MotionEvent.ACTION_DOWN,x, y, 0));
                               m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                                       SystemClock.uptimeMillis(),
                                       SystemClock.uptimeMillis(),
                                       MotionEvent.ACTION_UP,x,y, 0));
                       }
                   };
                   thread_touch.start();

我的手机是联想P70的Andr​​oid 4.4.4

My phone is Lenovo P70 android 4.4.4

推荐答案

此权限授予系统应用。第三方不能拥有它。除非你的系统证书签名您的应用程序,你将不会被授予 INJECT_EVENTS 的权限。

This permission is granted to system apps. 3rd party cannot have it. Unless you sign your app with system certificate, you will not be granted INJECT_EVENTS permission.

文档读到这里

允许应用程序截获用户事件(按键,触摸,轨迹球)
  成事件流,并提供给任何窗口。如果没有这个
  权限,只能提供事件窗口在你自己
  流程。

Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window. Without this permission, you can only deliver events to windows in your own process.

不为第三方应用

这篇关于但它仍然错误的应用程序需要INJECT_EVENTS权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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