diff options
| -rw-r--r-- | core/java/android/os/StrictMode.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index cc2fa8532d3d..99f58a0b9199 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -116,6 +116,14 @@ public final class StrictMode { private static final boolean IS_ENG_BUILD = "eng".equals(Build.TYPE); /** + * Boolean system property to disable strict mode checks outright. + * Set this to 'true' to force disable; 'false' has no effect on other + * enable/disable policy. + * @hide + */ + public static final String DISABLE_PROPERTY = "persist.sys.strictmode.disable"; + + /** * The boolean system property to control screen flashes on violations. * * @hide @@ -891,16 +899,24 @@ public final class StrictMode { * @hide */ public static boolean conditionallyEnableDebugLogging() { - boolean doFlashes = !amTheSystemServerProcess() && - SystemProperties.getBoolean(VISUAL_PROPERTY, IS_ENG_BUILD); + boolean doFlashes = SystemProperties.getBoolean(VISUAL_PROPERTY, false) + && !amTheSystemServerProcess(); + final boolean suppress = SystemProperties.getBoolean(DISABLE_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 (!doFlashes && (IS_USER_BUILD || suppress)) { setCloseGuardEnabled(false); return false; } + // Eng builds have flashes on all the time. The suppression property + // overrides this, so we force the behavior only after the short-circuit + // check above. + if (IS_ENG_BUILD) { + doFlashes = true; + } + // Thread policy controls BlockGuard. int threadPolicyMask = StrictMode.DETECT_DISK_WRITE | StrictMode.DETECT_DISK_READ | |