从用户 0 作为用户 -1 调用,未经许可 INTERACT_ACROSS_USERS 或 INTERACT_ACROSS_USERS_FULL 不允许

Posted

技术标签:

【中文标题】从用户 0 作为用户 -1 调用,未经许可 INTERACT_ACROSS_USERS 或 INTERACT_ACROSS_USERS_FULL 不允许【英文标题】:Call from user 0 as user -1 without permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not allowed 【发布时间】:2019-06-13 13:01:01 【问题描述】:

我的应用程序在设备 android

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.a.software.app, PID: 10551
    java.lang.RuntimeException: Unable to start activity ComponentInfoio.a.software.app/io.a.software.app.ui.SplashActivity: java.lang.SecurityException: Call from user 0 as user -1 without permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not allowed.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2902)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3037)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6642)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.SecurityException: Call from user 0 as user -1 without permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not allowed.
        at android.os.Parcel.createException(Parcel.java:1942)
        at android.os.Parcel.readException(Parcel.java:1910)
        at android.os.Parcel.readException(Parcel.java:1860)
        at android.view.accessibility.IAccessibilityManager$Stub$Proxy.addClient(IAccessibilityManager.java:295)
        at android.view.accessibility.AccessibilityManager.tryConnectToServiceLocked(AccessibilityManager.java:1125)
        at android.view.accessibility.AccessibilityManager.<init>(AccessibilityManager.java:358)
        at android.view.accessibility.AccessibilityManager.getInstance(AccessibilityManager.java:336)
        at android.view.View.setFlags(View.java:14010)
        at android.view.View.<init>(View.java:5565)
        at android.view.ViewGroup.<init>(ViewGroup.java:659)
        at android.view.ViewGroup.<init>(ViewGroup.java:655)
        at android.view.ViewGroup.<init>(ViewGroup.java:651)
        at android.view.ViewGroup.<init>(ViewGroup.java:647)
        at android.widget.FrameLayout.<init>(FrameLayout.java:78)
        at com.android.internal.policy.DecorView.<init>(DecorView.java:255)
        at com.android.internal.policy.PhoneWindow.generateDecor(PhoneWindow.java:2305)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2657)
        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:410)
        at android.app.Activity.setContentView(Activity.java:2769)
        at io.a.software.app.ui.SplashActivity.onCreate(SplashActivity.kt:28)
        at android.app.Activity.performCreate(Activity.java:7131)
        at android.app.Activity.performCreate(Activity.java:7122)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2882)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3037) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6642) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.accessibility.AccessibilityManagerService$SecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(AccessibilityManagerService.java:3522)
        at com.android.server.accessibility.AccessibilityManagerService.addClient(AccessibilityManagerService.java:487)
        at android.view.accessibility.IAccessibilityManager$Stub.onTransact(IAccessibilityManager.java:82)
        at android.os.Binder.execTransact(Binder.java:731)

这是我的 XML SplashCreen 文件 activity_splash.xml

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_
android:layout_
android:orientation="vertical"
android:gravity="center"
android:background="@android:color/white">

<ImageView
    android:layout_
    android:layout_
    android:layout_marginBottom="20dp"
    android:scaleType="centerInside"
    android:src="@drawable/ic_logo"/>

<ProgressBar
    android:layout_
    android:layout_ />

【问题讨论】:

我有同样的问题,真的不知道如何找出是什么原因造成的......但我会确保在解决问题后尽快发布解决方案。 不敢相信,但this 是我的解决方案... @malimo Omg,非常感谢你,伙计,你帮助了我! ***.com/questions/28134128/… 【参考方案1】:

将此行添加到应用程序标记:android:protectionLevel="signature"

【讨论】:

以上是关于从用户 0 作为用户 -1 调用,未经许可 INTERACT_ACROSS_USERS 或 INTERACT_ACROSS_USERS_FULL 不允许的主要内容,如果未能解决你的问题,请参考以下文章

如何在未经许可的情况下在Android中使用意图拨打电话?

未经许可的地理定位[重复]

从 curl 使用 Auth0 调用 Laravel 5.3 API 时未经授权的用户

未经许可将 SCNNode 向北旋转以进行位置跟踪

Rails 5,设计嵌套属性,未经许可的参数

未经相机许可无法打开相机“0”