Silence AM binder failures
Summary:
Sometimes IPC fails. A lot of the time, it just throws a
RuntimeException wrapping a RemoteException of some sort.
Let's not take down the process. (I suspect the whole OS is going down in these
cases but still)
@@ -61,11 +61,21 @@ public final class ProcessMetadataProvider extends BaseTraceProvider {
}
private void logProcessList() {
+ List<ActivityManager.RunningAppProcessInfo> infos;
+ try {
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
if (am == null) {
return;
}
- List<ActivityManager.RunningAppProcessInfo> infos = am.getRunningAppProcesses();
+ infos = am.getRunningAppProcesses();
+ } catch (Throwable ex) {
+ // IPC calls can fail for seemingly random reasons. Various layers in the
+ // framework end up wrapping the exceptions, so we can't look for the
+ // specific type.
+ // In any case, there's nothing we can do here.
+ return;
+ }
+
String processes = null;
if (infos != null) {
StringBuilder sb = new StringBuilder();
