ReportingAdministrator do not detect android.os.DeadSystemException
henrichg opened this issue · 2 comments
Exception:
java.lang.RuntimeException: Unable to stop service androidx.work.impl.background.systemjob.SystemJobService@3b93b7d: android.os.DeadSystemRuntimeException: android.os.DeadSystemException
In app is this class:
@autoservice(ReportingAdministrator.class)
CustomACRAReportingAdministrator implements ReportingAdministrator {}
In shouldStartCollecting() is:
if (_exception instanceof DeadSystemException) return flase;
if (_exception instanceof DeadSystemRuntimeException) return false;
But ACRA reports these Exceptions. Why?
Because maybe in some situations is Exception from reportBuilder null?
Throwable _exception = reportBuilder.getException();
if (_exception == null)
return true;
Full stack:
java.lang.RuntimeException: Unable to stop service androidx.work.impl.background.systemjob.SystemJobService@3b93b7d: android.os.DeadSystemRuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleStopService(ActivityThread.java:4846)
at android.app.ActivityThread.-$$Nest$mhandleStopService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2290)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8149)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
Caused by: android.os.DeadSystemRuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleStopService(ActivityThread.java:4840)
... 9 more
Caused by: android.os.DeadSystemException
... 10 more
Your exception is clearly a RuntimeException
, not a DeadSystemException
, even if it was caused by one. You should probably check all exception causes for DeadSystemException
if you don't want to report those at any level.
Hm, ok, I will implemeting this:
if (_exception instanceof RuntimeException) {
String stackTrace = Log.getStackTraceString(_exception);
if (stackTrace.contains("android.os.DeadSystemException"))
return false;
if (stackTrace.contains("android.os.DeadSystemRuntimeException"))
return false;
}
Because by me, DeadSystemRuntimeException is rethrowed as DeadSystemException and this is rethrowed as RuntimeException.
Maybe this helps me detecting DeadSystemException.