Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Crash on Android 8.0 Oreo: SecurityException: Permission Denial: null asks to run as user 450 but is calling from user 0

I upgrade my phone to Android Oreo. When I'm running my app on this device. My app crashes. While it's running well on Android 7 and lower devices.

This is the log:

E/AndroidRuntime: FATAL EXCEPTION: main
                                                         Process: com.test.test, PID: 28271
                                                         java.lang.SecurityException: Permission Denial: null asks to run as user 450 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS
                                                             at android.os.Parcel.readException(Parcel.java:1942)
                                                             at android.os.Parcel.readException(Parcel.java:1888)
                                                             at android.view.autofill.IAutoFillManager$Stub$Proxy.addClient(IAutoFillManager.java:326)
                                                             at android.view.autofill.AutofillManager.ensureServiceClientAddedIfNeededLocked(AutofillManager.java:896)
                                                             at android.view.autofill.AutofillManager.notifyViewExited(AutofillManager.java:487)
                                                             at android.view.View.notifyEnterOrExitForAutoFillIfNeeded(View.java:6945)
                                                             at android.view.View.dispatchAttachedToWindow(View.java:17413)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
                                                             at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1658)
                                                             at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
                                                             at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
                                                             at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                                                             at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                                                             at android.view.Choreographer.doFrame(Choreographer.java:658)
                                                             at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                                                             at android.os.Handler.handleCallback(Handler.java:789)
                                                             at android.os.Handler.dispatchMessage(Handler.java:98)
                                                             at android.os.Looper.loop(Looper.java:164)
                                                             at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
like image 519
wei wang Avatar asked Aug 23 '17 17:08

wei wang


2 Answers

I have experienced this problem.

In my case, after perform a startActivity, the application throwed the following exception:

Fatal Exception: java.lang.SecurityException: Permission Denial: null asks to run as user 66853 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS
       at android.os.Parcel.readException(Parcel.java:1942)
       at android.os.Parcel.readException(Parcel.java:1888)
       at android.view.autofill.IAutoFillManager$Stub$Proxy.addClient(IAutoFillManager.java:326)
       at android.view.autofill.AutofillManager.ensureServiceClientAddedIfNeededLocked(AutofillManager.java:896)
       at android.view.autofill.AutofillManager.notifyViewExited(AutofillManager.java:487)
       at android.view.View.notifyEnterOrExitForAutoFillIfNeeded(View.java:6945)
       at android.view.View.dispatchAttachedToWindow(View.java:17413)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3326)
       at android.view.ViewGroup.addViewInner(ViewGroup.java:4955)
       at android.view.ViewGroup.addView(ViewGroup.java:4746)
       at android.view.ViewGroup.addView(ViewGroup.java:4686)
       at android.support.v7.widget.RecyclerView$5.addView(RecyclerView.java:711)
       at android.support.v7.widget.ChildHelper.addView(ChildHelper.java:107)
       at android.support.v7.widget.RecyclerView$LayoutManager.addViewInt(RecyclerView.java:7877)
       at android.support.v7.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:7835)
       at android.support.v7.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:7823)
       at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1565)
       at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
       at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
       at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
       at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3025)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:21998)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:21998)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:21998)
       at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1308)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.widget.ScrollView.onMeasure(ScrollView.java:350)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:21998)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6580)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:721)
       at android.view.View.measure(View.java:21998)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2410)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1498)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1751)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
       at android.view.Choreographer.doCallbacks(Choreographer.java:723)
       at android.view.Choreographer.doFrame(Choreographer.java:658)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6541)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

After hours of investigation, I identified that my class BaseActivity, who is extended by all application activities, has implemented a protected method called getUserId, like the example below:

 class BaseActivity extends AppCompatActivity {

   ...

   protected int getUserId() {
     return getCurrentUserRepository().getId();
   }
 }

I just changed the method name to another and the application back to work again:

 class BaseActivity extends AppCompatActivity {

   ...

   protected int getApplicationUserId() {
     return getCurrentUserRepository().getId();
   }
 }

I could not find any method with same name in base classes, but as can we see in stacktrace, this method was probably called by Reflection.

Other important think is that just activities who implements any EditText view throws the exception. The problem occour after implementation of Autofill Framework in API 26.

like image 54
Isac Avatar answered Nov 07 '22 03:11

Isac


I have experienced same issue in kotlin. This Issue Happens only when Edittext is implemented in activity and Having getUserId() method in this Class or it parent class. Changing getUserId() to getUserIdd() fixed my problem.

In Kotlin I had a variable

var userId=0

I changed it to

var userIdd=0

Solved My problem.

like image 20
Sayandh Avatar answered Nov 07 '22 03:11

Sayandh