将安卓工作室项目 apk 签名为系统应用程序以使用权限INJECT_EVENTS


Instrumentation m_Instrumentation = new Instrumentation();    
m_Instrumentation.sendPointerSync(MotionEvent.obtain(
                        SystemClock.uptimeMillis()+555,
                        SystemClock.uptimeMillis()+600,
                        MotionEvent.ACTION_UP,500,1000, 0));

我想尝试使用Android Studio开发TeamViewer的模拟。显示应用程序 UI 时,此代码片段工作正常,我想在应用程序在后台时使用 sendPointerSync 方法,它给我消息:

java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission

我添加了权限,它给出了消息:

Permissions with the protection level signature or signatureOrSystem are only granted to system apps. If an app is a regular non-system app, it will never be able to use these permissions.

如何将应用程序签名为系统应用程序?

如何将应用程序签名为系统应用程序?

使用与安卓系统相同的密钥签名!如果您的应用和系统具有相同的证书,则您的应用会自动识别为"系统应用"。

但通常你没有系统

密钥,只要你没有自己构建和签署Android系统。

最新更新