I have upgraded my (rooted) OnePlus X phone from Oxygen OS 2.2.x to 3.1.4 (dirty upgrade, from Lollipop to Marshmallow).
Since doing that, the settings view crashed with "Unfortunately, Package installer has stopped" when I try to view the permission details for some apps. For example, when I open try to view the permissions for Hangouts (Settings > Apps > Hangouts > permissions), the above dialog appears and the following output is shown in logcat:
AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: com.android.packageinstaller, PID: 16689
AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.packageinstaller/com.android.packageinstaller.permission.ui.ManagePermissionsActivity}: java.lang.SecurityException: com.google.android.talk from uid 10100 not allowed to perform WRITE_CONTACTS
AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2493)
AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2576)
AndroidRuntime: at android.app.ActivityThread.access$1000(ActivityThread.java:155)
AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5539)
AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
AndroidRuntime: Caused by: java.lang.SecurityException: com.google.android.talk from uid 10100 not allowed to perform WRITE_CONTACTS
AndroidRuntime: at android.app.AppOpsManager.checkOp(AppOpsManager.java:1521)
AndroidRuntime: at com.android.packageinstaller.permission.model.AppPermissionGroup.create(AppPermissionGroup.java:152)
AndroidRuntime: at com.android.packageinstaller.permission.model.AppPermissionGroup.create(AppPermissionGroup.java:94)
AndroidRuntime: at com.android.packageinstaller.permission.model.AppPermissions.loadPermissionGroups(AppPermissions.java:136)
AndroidRuntime: at com.android.packageinstaller.permission.model.AppPermissions.<init>(AppPermissions.java:66)
AndroidRuntime: at com.android.packageinstaller.permission.ui.handheld.AppPermissionsFragment.onCreate(AppPermissionsFragment.java:105)
AndroidRuntime: at android.app.Fragment.performCreate(Fragment.java:2198)
AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
AndroidRuntime: at android.app.BackStackRecord.run(BackStackRecord.java:793)
AndroidRuntime: at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1535)
AndroidRuntime: at android.app.FragmentController.execPendingActions(FragmentController.java:325)
AndroidRuntime: at android.app.Activity.performStart(Activity.java:6305)
AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2456)
AndroidRuntime: ... 9 more
And when I open access Settings > Apps > Gears icon > Access permissions, the Android activity briefly appears and then closes. There is no error dialog, but logcat does show the following error:
AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
AndroidRuntime: Process: com.android.packageinstaller, PID: 19194
AndroidRuntime: java.lang.RuntimeException: An error occurred while executing doInBackground()
AndroidRuntime: at android.os.AsyncTask$3.done(AsyncTask.java:309)
AndroidRuntime: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
AndroidRuntime: at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
AndroidRuntime: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
AndroidRuntime: Caused by: java.lang.SecurityException: com.ubercab from uid 10102 not allowed to perform CAMERA
AndroidRuntime: at android.app.AppOpsManager.checkOp(AppOpsManager.java:1521)
AndroidRuntime: at com.android.packageinstaller.permission.model.AppPermissionGroup.create(AppPermissionGroup.java:152)
AndroidRuntime: at com.android.packageinstaller.permission.model.PermissionApps.loadPermissionApps(PermissionApps.java:189)
AndroidRuntime: at com.android.packageinstaller.permission.model.PermissionApps.-wrap0(PermissionApps.java)
AndroidRuntime: at com.android.packageinstaller.permission.model.PermissionApps$PermissionAppsLoader.doInBackground(PermissionApps.java:375)
AndroidRuntime: at com.android.packageinstaller.permission.model.PermissionApps$PermissionAppsLoader.doInBackground(PermissionApps.java:374)
AndroidRuntime: at android.os.AsyncTask$2.call(AsyncTask.java:295)
AndroidRuntime: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
AndroidRuntime: ... 4 more
Why does this happen, and how can I fix this?