Package manager has died

2020-05-23 08:52发布

I got mail from a user who has a lot of apps installed that he has problems when my app gathers activity info with this code:

getPackageManager().queryIntentActivities(mAinIntent, 0)

whole source here: https://github.com/ligi/FAST

this is what happens

Caused by: java.lang.RuntimeException: Package manager has died
at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:479)
at org.ligi.fast.BaseAppGatherAsyncTask.doInBackground(BaseAppGatherAsyncTask.java:34)
at org.ligi.fast.BaseAppGatherAsyncTask.doInBackground(BaseAppGatherAsyncTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 5 more
Caused by: android.os.TransactionTooLargeExceptionTransactionTooLargeException
at android.os.BinderProxy.transact(Native Method)
at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:2230)
at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:473)
... 9 more
Log:
0 D: Writing unhandled exception to: /data/data/org.ligi.fast/files/3.7-1364933885194.tracedroid

there seems to be a problem that I am running against the 1mb border, but how to get out of there? How else can I get the needed info? Is there a way to chunk up the data?

1条回答
2楼-- · 2020-05-23 09:17

I ran into this error a while ago with the same user input. Though my thrown event was different. I ended up catching the exception and reporting back the user gracefully that there were too many apps installed with the ability to handle . Out of several hundred thousand installs I have only seen this error off-handedly less than five times for a project, I know that isn't an excuse but some devices just don't have the heap to handle indexing the intents of each application installed on the device.

查看更多
登录 后发表回答