diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-04-18 16:25:59 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-18 16:25:59 +0000 |
commit | c726f6b537c5913600bc35ff866f1fb32800b9be (patch) | |
tree | b55d9f1129321613df123516e8d474fcfe58070b /core | |
parent | 14cd25f619fe981455aec9c79dc1abd89f4f5d8c (diff) | |
parent | b90e504ec17a7f509521c21f2b937a2ebefaf6ab (diff) | |
download | frameworks_base-c726f6b537c5913600bc35ff866f1fb32800b9be.zip frameworks_base-c726f6b537c5913600bc35ff866f1fb32800b9be.tar.gz frameworks_base-c726f6b537c5913600bc35ff866f1fb32800b9be.tar.bz2 |
am b90e504e: am 649da9b5: am 5a47a9f6: Merge "Native Runtime: Add LOG_ID_CRASH"
* commit 'b90e504ec17a7f509521c21f2b937a2ebefaf6ab':
Native Runtime: Add LOG_ID_CRASH
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/util/Log.java | 1 | ||||
-rw-r--r-- | core/java/com/android/internal/os/RuntimeInit.java | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java index abd173a..2b81072 100644 --- a/core/java/android/util/Log.java +++ b/core/java/android/util/Log.java @@ -352,6 +352,7 @@ public final class Log { /** @hide */ public static final int LOG_ID_RADIO = 1; /** @hide */ public static final int LOG_ID_EVENTS = 2; /** @hide */ public static final int LOG_ID_SYSTEM = 3; + /** @hide */ public static final int LOG_ID_CRASH = 4; /** @hide */ public static native int println_native(int bufID, int priority, String tag, String msg); diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 5538dca..4a26b4b 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -55,6 +55,11 @@ public class RuntimeInit { private static final native void nativeFinishInit(); private static final native void nativeSetExitWithoutCleanup(boolean exitWithoutCleanup); + private static int Clog_e(String tag, String msg, Throwable tr) { + return Log.println_native(Log.LOG_ID_CRASH, Log.ERROR, tag, + msg + '\n' + Log.getStackTraceString(tr)); + } + /** * Use this to log a message when a thread exits due to an uncaught * exception. The framework catches these for the main threads, so @@ -68,7 +73,7 @@ public class RuntimeInit { mCrashing = true; if (mApplicationObject == null) { - Slog.e(TAG, "*** FATAL EXCEPTION IN SYSTEM PROCESS: " + t.getName(), e); + Clog_e(TAG, "*** FATAL EXCEPTION IN SYSTEM PROCESS: " + t.getName(), e); } else { StringBuilder message = new StringBuilder(); message.append("FATAL EXCEPTION: ").append(t.getName()).append("\n"); @@ -77,7 +82,7 @@ public class RuntimeInit { message.append("Process: ").append(processName).append(", "); } message.append("PID: ").append(Process.myPid()); - Slog.e(TAG, message.toString(), e); + Clog_e(TAG, message.toString(), e); } // Bring up crash dialog, wait for it to be dismissed @@ -85,9 +90,9 @@ public class RuntimeInit { mApplicationObject, new ApplicationErrorReport.CrashInfo(e)); } catch (Throwable t2) { try { - Slog.e(TAG, "Error reporting crash", t2); + Clog_e(TAG, "Error reporting crash", t2); } catch (Throwable t3) { - // Even Slog.e() fails! Oh well. + // Even Clog_e() fails! Oh well. } } finally { // Try everything to make sure this process goes away. |