logcat buffer over flow because too many StrictModeViolation

121 views
Skip to first unread message

koba

unread,
Dec 8, 2011, 3:57:19 AM12/8/11
to android-platform
Hi,

When I check logcat output to investigate boot sequence, there are too
may stack dumps of StrictModeViolation and ring buffer of logcat is
over-flowed.

So I modified frameworks/base/core/java/android/os/StrictMode.java not
to generate StrictModeDiskWriteViolation and
StrictModeDiskReadViolation.
This is very ugly. Is there any smarter way to disable StrictMode in
system-wide?


diff --git a/core/java/android/os/StrictMode.java b/core/java/android/
os/StrictMode.java
index 4d7a9bb..3fd5095 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -1038,6 +1038,10 @@ public final class StrictMode {

// Part of BlockGuard.Policy interface:
public void onWriteToDisk() {
+ return;/* koba: ignore all StrictModeDiskWriteViolation */
+ }
+ /*
+ public void onWriteToDisk() {
if ((mPolicyMask & DETECT_DISK_WRITE) == 0) {
return;
}
@@ -1048,6 +1052,7 @@ public final class StrictMode {
e.fillInStackTrace();
startHandlingViolationException(e);
}
+ */

// Not part of BlockGuard.Policy; just part of StrictMode:
void onCustomSlowCall(String name) {
@@ -1064,6 +1069,10 @@ public final class StrictMode {

// Part of BlockGuard.Policy interface:
public void onReadFromDisk() {
+ return; /* koba: ignore all StrictModeDiskReadViolation */
+ }
+ /*
+ public void onReadFromDisk() {
if ((mPolicyMask & DETECT_DISK_READ) == 0) {
return;
}
@@ -1074,6 +1083,7 @@ public final class StrictMode {
e.fillInStackTrace();
startHandlingViolationException(e);
}
+ */

// Part of BlockGuard.Policy interface:
public void onNetwork() {

koba

unread,
Dec 12, 2011, 2:13:24 AM12/12/11
to android-platform
A simpler way not to output StrictModeViolation log.


At frameworks/base
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/
os/StrictM
index 4d7a9bb..cc98e69 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -113,7 +113,8 @@ public final class StrictMode {
private static final String TAG = "StrictMode";
private static final boolean LOG_V = Log.isLoggable(TAG,
Log.VERBOSE);

- private static final boolean IS_USER_BUILD =
"user".equals(Build.TYPE);
+ //private static final boolean IS_USER_BUILD =
"user".equals(Build.TYPE);
+ private static final boolean IS_USER_BUILD = true;
private static final boolean IS_ENG_BUILD =
"eng".equals(Build.TYPE);

/**

Reply all
Reply to author
Forward
0 new messages