Merge "Add persistent property to disable strict mode" into ics-mr1

This commit is contained in:
Christopher Tate
2011-11-03 15:59:47 -07:00
committed by Android (Google) Code Review

View File

@@ -115,6 +115,14 @@ public final class StrictMode {
private static final boolean IS_USER_BUILD = "user".equals(Build.TYPE);
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.
*
@@ -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 |