Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

crash before app starts : SecurityException: Permission Denial: INTERACT_ACROSS_USERS_FULL

Tags:

Background

I have a rooted device, which is Galaxy S3 I9300 , with Samsung stock based ROM, based on Android 4.3.

I never had any problems running an app i'm working on with this device.

The problem

ever since yesterday (and I didn't change anything on the device), each time I open the app, it shows for a very short time, closes itself without any crash dialog yet it shows the next log:

01-30 09:27:18.325: E/DatabaseUtils(2366): Writing exception to parcel 01-30 09:27:18.325: E/DatabaseUtils(2366): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL 01-30 09:27:18.325: E/DatabaseUtils(2366):  at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at android.content.ContentProvider$Transport.call(ContentProvider.java:279) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at android.os.Binder.execTransact(Binder.java:388) 01-30 09:27:18.325: E/DatabaseUtils(2366):  at dalvik.system.NativeStart.run(Native Method) 

it doesn't even get to the code of the class that extends Application ...

What I've found

It seems that this problem is very common (many have reported about it), but I can't find any solution and why it occurs, other than having a rooted device.

People also say the permission that is written here is actually a system permission, but I never even heard of it, let alone use it (not even sure what it is).

Problem is, the app I'm working on doesn't have anything related to root, plus it worked just a few days ago.

I've tried to re-install the ROM (Omega ROM v54) and also disable anything related to xposed framework. it didn't help.

The question

How do I fix this issue? How would I know other users won't have this problem?

Is it even related to rooted devices?


EDIT: i thought i've found an answer that fixes it, by choosing "revoke USB debugging..." on the developers section of the settings screen. it seemed to work at first, but later the problem returned and clicking it didn't do anything helpful anymore...


EDIT: I think it's just a bug on the app itself or the ROM, since I can't reproduce it anymore. It's quite weird since I'm quite sure I've tried to debug the app and put a breakpoint on the onCreate method of the acitivity (and maybe of the application class itself) and it didn't stop there.

like image 391
android developer Avatar asked Jan 30 '14 12:01

android developer


1 Answers

01-30 09:27:18.325: E/DatabaseUtils(2366): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL 

This error comes from where you get/set any user/system settings in your app. This particular error log is showing your settings get/set (from your app code) is calling from user 0 (USER_OWNER), but the setting you're changing is for user -2 (USER_CURRENT).

You can't change other users' settings without the permission android.permission.INTERACT_ACROSS_USERS_FULL.

You're probably not considering the case of having different userID's (between calling userID and userID whom the setting is for) in your code and calling set/get settings with the incorrect userID (I don't know why they're different when this happened - for ex, it might happen when there are more than one user accounts on the device).

You need to modify the code to take the correct userID into logic and call the settings set/get for the appropriate userID (the calling userID and the userID for whom the settings is modified for should be the same).

like image 65
iVoid Avatar answered Nov 09 '22 13:11

iVoid