Merge "Simplify & update ANR logging; report ANR data into the dropbox. Eliminate the per-process 200ms timeout during ANR thread-dumping. Dump all the threads at once, then wait for the file to stabilize. Seems to work great and is much, much, much faster."

This commit is contained in:
Dan Egnor
2010-01-11 15:09:51 -08:00
committed by Android (Google) Code Review
9 changed files with 203 additions and 206 deletions

View File

@@ -53,6 +53,15 @@ public class Build {
/** The end-user-visible name for the end product. */
public static final String MODEL = getString("ro.product.model");
/** @pending The system bootloader version number. */
public static final String BOOTLOADER = getString("ro.bootloader");
/** @pending The radio firmware version number. */
public static final String RADIO = getString("gsm.version.baseband");
/** @pending The device serial number. */
public static final String SERIAL = getString("ro.serialno");
/** Various version strings. */
public static class VERSION {
/**

View File

@@ -153,14 +153,16 @@ public class FileUtils
public static String readTextFile(File file, int max, String ellipsis) throws IOException {
InputStream input = new FileInputStream(file);
try {
if (max > 0) { // "head" mode: read the first N bytes
long size = file.length();
if (max > 0 || (size > 0 && max == 0)) { // "head" mode: read the first N bytes
if (size > 0 && (max == 0 || size < max)) max = (int) size;
byte[] data = new byte[max + 1];
int length = input.read(data);
if (length <= 0) return "";
if (length <= max) return new String(data, 0, length);
if (ellipsis == null) return new String(data, 0, max);
return new String(data, 0, max) + ellipsis;
} else if (max < 0) { // "tail" mode: read it all, keep the last N
} else if (max < 0) { // "tail" mode: keep the last N
int len;
boolean rolled = false;
byte[] last = null, data = null;
@@ -180,7 +182,7 @@ public class FileUtils
}
if (ellipsis == null || !rolled) return new String(last);
return ellipsis + new String(last);
} else { // "cat" mode: read it all
} else { // "cat" mode: size unknown, read it all in streaming fashion
ByteArrayOutputStream contents = new ByteArrayOutputStream();
int len;
byte[] data = new byte[1024];

View File

@@ -2942,7 +2942,13 @@ public final class Settings {
*/
public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
/**
* If nonzero, ANRs in invisible background processes bring up a dialog.
* Otherwise, the process will be silently killed.
* @hide
*/
public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
/**
* @hide
*/