From 47c070d54302cefd01517742044c803e694133d8 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Dec 2020 12:06:30 +0100 Subject: [PATCH] Check for dead system --- app/src/main/java/eu/faircode/email/Log.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index d73d4af411..31f70fbfc5 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -41,6 +41,7 @@ import android.os.BadParcelableException; import android.os.Build; import android.os.Bundle; import android.os.DeadObjectException; +import android.os.DeadSystemException; import android.os.Debug; import android.os.PowerManager; import android.os.RemoteException; @@ -689,7 +690,7 @@ public class Log { // Some Android versions (Samsung) send images as clip data return false; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { /* java.lang.RuntimeException: Failure from system at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1327) @@ -706,7 +707,16 @@ public class Log { */ Throwable cause = ex; while (cause != null) { - if (cause instanceof DeadObjectException) // Includes DeadSystemException + if (cause instanceof DeadObjectException) + return false; + cause = cause.getCause(); + } + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Throwable cause = ex; + while (cause != null) { + if (cause instanceof DeadSystemException) return false; cause = cause.getCause(); }