从不受信任的UID呼叫 [英] Calling from not trusted UID
本文介绍了从不受信任的UID呼叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在Android Studio中运行UIAutomator时,有时会显示崩溃.
When I was running UIAutomator in Android Studio, a crash shows sometimes.
W/ActivityManager: Crash of app com.example.testsample running instrumentation ComponentInfo{com.example.testsample.test/android.support.test.runner.AndroidJUnitRunner}
07-16 19:19:34.191 7834-7850/? W/Binder: Binder call failed.
java.lang.SecurityException: Calling from not trusted UID!
at android.app.UiAutomationConnection.throwIfCalledByNotTrustedUidLocked(UiAutomationConnection.java:427)
at android.app.UiAutomationConnection.shutdown(UiAutomationConnection.java:324)
at android.app.IUiAutomationConnection$Stub.onTransact(IUiAutomationConnection.java:209)
at android.os.Binder.execTransact(Binder.java:570)
但并非每次都显示.如果没有显示,我可以成功运行.谁能帮我?谢谢.
But it didn't shows every time. I can run successfully when this not showed. Can Anyone help me? Thanks.
推荐答案
private void throwIfCalledByNotTrustedUidLocked() {
final int callingUid = Binder.getCallingUid();
if (callingUid != mOwningUid && mOwningUid != Process.SYSTEM_UID
&& callingUid != 0 /*root*/) {
throw new SecurityException("Calling from not trusted UID!");
}
}
这是引发错误的方法.也许 uid
与进程 uid
不同,或者该设备上的 uid
不是 root
.也许您可以在您的应用程序中添加一些打印件以进行查找.
This is the method which throws your error. Perhaps the uid
is different than the process uid
or the uid
on that device is not root
. Maybe you can add some prints in your app to find out.
这篇关于从不受信任的UID呼叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文