Calling from not trusted UID

二次信任 提交于 2019-12-24 18:57:20

问题


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.


回答1:


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!");
    }
}

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.



来源:https://stackoverflow.com/questions/51360801/calling-from-not-trusted-uid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!