Skip to content

Commit

Permalink
Merge 36df875 into 8af1c04
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Jul 26, 2018
2 parents 8af1c04 + 36df875 commit 7728da2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Expand Up @@ -7,6 +7,7 @@
import static junit.framework.Assert.fail;

import android.content.Context;
import android.os.Build;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;

Expand Down Expand Up @@ -97,7 +98,14 @@ public void testStrictModeDescException() {

if (exception != null) {
String desc = strictModeHandler.getViolationDescription(exception.getMessage());
assertEquals("DiskRead", desc);

if (Build.VERSION.SDK_INT >= 28) {
// the violation description format changed to be more generic in P,
// no longer possible to get a full description
assertNull(desc);
} else {
assertEquals("DiskRead", desc);
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions sdk/src/main/java/com/bugsnag/android/StrictModeHandler.java
Expand Up @@ -5,6 +5,7 @@
import android.text.TextUtils;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

class StrictModeHandler {
Expand All @@ -26,7 +27,7 @@ class StrictModeHandler {
private static final int DETECT_VM_CLEARTEXT_NETWORK = 0x40 << 8;


private static final String STRICT_MODE_CLZ_NAME = "android.os.StrictMode";
private static final String STRICT_MODE_CLZ_NAME = "android.os.strictmode";

@SuppressLint("UseSparseArrays")
private static final Map<Integer, String> POLICY_CODE_MAP = new HashMap<>();
Expand Down Expand Up @@ -57,7 +58,7 @@ boolean isStrictModeThrowable(Throwable throwable) {
Throwable cause = getRootCause(throwable);
Class<? extends Throwable> causeClass = cause.getClass();
String simpleName = causeClass.getName();
return simpleName.startsWith(STRICT_MODE_CLZ_NAME);
return simpleName.toLowerCase(Locale.US).startsWith(STRICT_MODE_CLZ_NAME);
}

@Nullable
Expand Down

0 comments on commit 7728da2

Please sign in to comment.