title: DeadObjectException thrown by queryIntentActivities
body: <p>I'm getting the <code>DeadObjectException</code> from <code>queryIntentActivities</code> rarely.</p>
  
  <p>This is all I found for this issue: <a href="http://comments.gmane.org/gmane.comp.handhelds.android.acra/184" rel="nofollow noreferrer">http://comments.gmane.org/gmane.comp.handhelds.android.acra/184</a> So I tried to adjust my code like following (comment in this code is derived from the post mentioned above).</p>
  
  <p>I'm trying following:</p>
  
  <p><em>Old code</em></p>
  
  <pre><code>List&lt;ResolveInfo&gt; ril = pm.queryIntentActivities(mainIntent, 0);
  </code></pre>
  
  <p><em>New code</em></p>
  
  <pre><code>List&lt;ResolveInfo&gt; ril = null;
  try
  {
      ril = pm.queryIntentActivities(mainIntent, 0);
      // process data...
  }
  catch (DeadObjectException e)
  {
      // possibly happens because this process is still running but app is currently being updated by the android system
      // if this is really true, we can ignore the exception as the complete progress will be stopped anyways...
      L.e(e);
  }
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>I <em>can't</em> catch the exception, because by definition it is never thrown by <code>queryIntentActivities</code>. What can I do instead now to avoid this crash? I don't want to catch all exceptions here.</p>
  
  <p>Additionally I'm not sure if this exception really only happens, I've my app is updated while trying to call <code>queryIntentActivities</code>, it's just an assumption based on the post above. Can anyone confirm this?</p>
  
  <p><strong>Stacktrace</strong></p>
  
  <pre><code>java.lang.RuntimeException: Unable to start receiver com.my.app.receivers.PackageReceiver: java.lang.RuntimeException: Package manager has died
  at android.app.ActivityThread.handleReceiver(ActivityThread.java:3641)
  at android.app.ActivityThread.access$2000(ActivityThread.java:221)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:158)
  at android.app.ActivityThread.main(ActivityThread.java:7225)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  Caused by: java.lang.RuntimeException: Package manager has died
  at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:765)
  at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
  at com.my.app.utils.AppUtil.a(AppUtil.java:230)
  at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
  at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
  ... 8 more
  Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
  at android.os.BinderProxy.transactNative(Native Method)
  at android.os.BinderProxy.transact(Binder.java:503)
  at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
  at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
  ... 12 more
  java.lang.RuntimeException: Package manager has died
  at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:765)
  at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
  at com.my.app.utils.AppUtil.a(AppUtil.java:230)
  at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
  at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
  at android.app.ActivityThread.access$2000(ActivityThread.java:221)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:158)
  at android.app.ActivityThread.main(ActivityThread.java:7225)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
  at android.os.BinderProxy.transactNative(Native Method)
  at android.os.BinderProxy.transact(Binder.java:503)
  at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
  at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
  ... 12 more
  android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
  at android.os.BinderProxy.transactNative(Native Method)
  at android.os.BinderProxy.transact(Binder.java:503)
  at android.content.pm.IPackageManager$Stub$Proxy.queryIntentActivities(IPackageManager.java:3940)
  at android.app.ApplicationPackageManager.queryIntentActivitiesAsUser(ApplicationPackageManager.java:755)
  at android.app.ApplicationPackageManager.queryIntentActivities(ApplicationPackageManager.java:747)
  at com.my.app.utils.AppUtil.a(AppUtil.java:230)
  at com.my.app.receivers.PackageReceiver.onReceive(PackageReceiver.java:42)
  at android.app.ActivityThread.handleReceiver(ActivityThread.java:3634)
  at android.app.ActivityThread.access$2000(ActivityThread.java:221)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:158)
  at android.app.ActivityThread.main(ActivityThread.java:7225)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
  </code></pre>