首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >但是它仍然错误应用程序需要INJECT_EVENTS权限。

但是它仍然错误应用程序需要INJECT_EVENTS权限。
EN

Stack Overflow用户
提问于 2015-06-15 09:19:39
回答 1查看 1.8K关注 0票数 0

我跟着:事件权限用于对其他应用程序进行测试的事件

1.我的手机成功了。

2.我已经遵循签署申请APK并将app.apk复制到system/app,并通过app root explorer将app.apk设置为rw-r--r--

3.我在<uses-permission android:name="android.permission.INJECT_EVENTS" />中添加了Androidmanifest.xml

但它仍然错误,需要注入许可。我也不知道原因?

代码语言:javascript
复制
    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)

代码注入事件

代码语言:javascript
复制
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安卓4.4.4

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-15 09:27:10

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

博士们在这里读

允许应用程序将用户事件(键、触摸、跟踪球)注入事件流,并将它们传递到任何窗口。在没有此权限的情况下,您只能在自己的进程中将事件传递到windows。 不适用于第三方应用程序

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30841539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档