In my application I need to start the main activity the following way as documented in several other threads on SO:
final String packageName = getApplicationContext().getPackageName();
final Intent launchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
startActivity(launchIntent);
The above line of code is in my Android library project as I don't know at this place the class of my Main activity.
This works like a charm when deploying app trough the USB interface on test devices but this error occurs when installing app from Google Play on 4.3 devices.
07-03 13:54:19.843: E/DatabaseUtils(2344): Writing exception to parcel
07-03 13:54:19.843: E/DatabaseUtils(2344): 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
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13140)
07-03 13:54:19.843: E/DatabaseUtils(2344): at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:607)
07-03 13:54:19.843: E/DatabaseUtils(2344): at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
07-03 13:54:19.843: E/DatabaseUtils(2344): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
07-03 13:54:19.843: E/DatabaseUtils(2344): at android.os.Binder.execTransact(Binder.java:388)
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.server.SystemServer.init1(Native Method)
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.server.SystemServer.main(SystemServer.java:2012)
07-03 13:54:19.843: E/DatabaseUtils(2344): at java.lang.reflect.Method.invokeNative(Native Method)
07-03 13:54:19.843: E/DatabaseUtils(2344): at java.lang.reflect.Method.invoke(Method.java:525)
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
07-03 13:54:19.843: E/DatabaseUtils(2344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
07-03 13:54:19.843: E/DatabaseUtils(2344): at dalvik.system.NativeStart.main(Native Method)
Has someone experienced the same problem?
Edit:
I didn't mentioned that several threads in SO mentioned that "android.permission.INTERACT_ACROSS_USERS_FULL is a signature level permission. Your app will not be able to use it until and unless it has the same signature as the system."
Permission Denial: startActivity asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
Permission Denial: this requires android.permission.INTERACT_ACROSS_USERS_FULL
What do I do about: this requires android.permission.INTERACT_ACROSS_USERS_FULL
But as the above code seems to be used by other developers, I'm still hoping for a solution.
Edit 2:
Remove stack not related to problem.