Created
December 13, 2011 04:31
-
-
Save drewis/1470599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java | |
index 4d7a9bb..b49f7cd 100644 | |
--- a/core/java/android/os/StrictMode.java | |
+++ b/core/java/android/os/StrictMode.java | |
@@ -123,6 +123,13 @@ public final class StrictMode { | |
*/ | |
public static final String VISUAL_PROPERTY = "persist.sys.strictmode.visual"; | |
+ /** | |
+ * The boolean system property to control screen flashes on violations. | |
+ * | |
+ * @hide | |
+ */ | |
+ public static final String OVERRIDE_PROPERTY = "persist.sys.strictmode.override"; | |
+ | |
// Only log a duplicate stack trace to the logs every second. | |
private static final long MIN_LOG_INTERVAL_MS = 1000; | |
@@ -894,10 +901,11 @@ public final class StrictMode { | |
public static boolean conditionallyEnableDebugLogging() { | |
boolean doFlashes = !amTheSystemServerProcess() && | |
SystemProperties.getBoolean(VISUAL_PROPERTY, IS_ENG_BUILD); | |
+ boolean OverrideStrict = SystemProperties.getBoolean(OVERRIDE_PROPERTY, false); | |
// For debug builds, log event loop stalls to dropbox for analysis. | |
// Similar logic also appears in ActivityThread.java for system apps. | |
- if (IS_USER_BUILD && !doFlashes) { | |
+ if (IS_USER_BUILD && !doFlashes || OverrideStrict) { | |
setCloseGuardEnabled(false); | |
return false; | |
} | |
@@ -906,7 +914,7 @@ public final class StrictMode { | |
StrictMode.DETECT_DISK_READ | | |
StrictMode.DETECT_NETWORK; | |
- if (!IS_USER_BUILD) { | |
+ if (!IS_USER_BUILD && !OverrideStrict) { | |
threadPolicyMask |= StrictMode.PENALTY_DROPBOX; | |
if (IS_ENG_BUILD) { | |
threadPolicyMask |= StrictMode.PENALTY_LOG; | |
@@ -918,11 +926,11 @@ public final class StrictMode { | |
StrictMode.setThreadPolicyMask(threadPolicyMask); | |
- if (IS_USER_BUILD) { | |
+ if (IS_USER_BUILD || OverrideStrict) { | |
setCloseGuardEnabled(false); | |
} else { | |
VmPolicy.Builder policyBuilder = new VmPolicy.Builder().detectAll().penaltyDropBox(); | |
- if (IS_ENG_BUILD) { | |
+ if (IS_ENG_BUILD && !OverrideStrict) { | |
policyBuilder.penaltyLog(); | |
} | |
setVmPolicy(policyBuilder.build()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment