diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-10-02 09:37:26 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-02 09:37:26 -0700 |
commit | 1d536848af1531dd14af52000f5ab505162bf123 (patch) | |
tree | 9a4c6cc710ae957b1cb96ee2c2e2f4a6f5df0c3c /core/java/android/util | |
parent | f7851e3f80b724ac65c589985b81e0a89a54bae0 (diff) | |
parent | 239dc099a0d56eba3c7a537df23ef3c5046b2667 (diff) | |
download | frameworks_base-1d536848af1531dd14af52000f5ab505162bf123.zip frameworks_base-1d536848af1531dd14af52000f5ab505162bf123.tar.gz frameworks_base-1d536848af1531dd14af52000f5ab505162bf123.tar.bz2 |
am 239dc099: am 164371fb: Fix issue #11005453: [SUW] G+ profile creation for new user broken
* commit '239dc099a0d56eba3c7a537df23ef3c5046b2667':
Fix issue #11005453: [SUW] G+ profile creation for new user broken
Diffstat (limited to 'core/java/android/util')
-rw-r--r-- | core/java/android/util/Log.java | 25 | ||||
-rw-r--r-- | core/java/android/util/Slog.java | 16 |
2 files changed, 38 insertions, 3 deletions
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java index 6a6f027..8c1cf5f 100644 --- a/core/java/android/util/Log.java +++ b/core/java/android/util/Log.java @@ -84,14 +84,14 @@ public final class Log { public static final int ASSERT = 7; /** - * Exception class used to capture a stack trace in {@link #wtf()}. + * Exception class used to capture a stack trace in {@link #wtf}. */ private static class TerribleFailure extends Exception { TerribleFailure(String msg, Throwable cause) { super(msg, cause); } } /** - * Interface to handle terrible failures from {@link #wtf()}. + * Interface to handle terrible failures from {@link #wtf}. * * @hide */ @@ -257,6 +257,15 @@ public final class Log { } /** + * Like {@link #wtf(String, String)}, but also writes to the log the full + * call stack. + * @hide + */ + public static int wtfStack(String tag, String msg) { + return wtfStack(LOG_ID_MAIN, tag, msg); + } + + /** * What a Terrible Failure: Report an exception that should never happen. * Similar to {@link #wtf(String, String)}, with an exception to log. * @param tag Used to identify the source of a log message. @@ -274,8 +283,18 @@ public final class Log { * @param tr An exception to log. May be null. */ public static int wtf(String tag, String msg, Throwable tr) { + return wtf(LOG_ID_MAIN, tag, msg, tr); + } + + static int wtfStack(int logId, String tag, String msg) { + TerribleFailure here = new TerribleFailure("here", null); + here.fillInStackTrace(); + return wtf(logId, tag, msg, here); + } + + static int wtf(int logId, String tag, String msg, Throwable tr) { TerribleFailure what = new TerribleFailure(msg, tr); - int bytes = println_native(LOG_ID_MAIN, ASSERT, tag, msg + '\n' + getStackTraceString(tr)); + int bytes = println_native(logId, ASSERT, tag, msg + '\n' + getStackTraceString(tr)); sWtfHandler.onTerribleFailure(tag, what); return bytes; } diff --git a/core/java/android/util/Slog.java b/core/java/android/util/Slog.java index ecf5ea1..a5c22ff 100644 --- a/core/java/android/util/Slog.java +++ b/core/java/android/util/Slog.java @@ -78,6 +78,22 @@ public final class Slog { msg + '\n' + Log.getStackTraceString(tr)); } + public static int wtf(String tag, String msg) { + return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null); + } + + public static int wtfStack(String tag, String msg) { + return Log.wtfStack(Log.LOG_ID_SYSTEM, tag, msg); + } + + public static int wtf(String tag, Throwable tr) { + return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr); + } + + public static int wtf(String tag, String msg, Throwable tr) { + return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr); + } + public static int println(int priority, String tag, String msg) { return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg); } |