Loading core/java/android/util/Slog.java +0 −3 Original line number Diff line number Diff line Loading @@ -217,7 +217,6 @@ public final class Slog { * @see Log#wtf(String, String) */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @NonNull String msg) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true); } Loading Loading @@ -263,7 +262,6 @@ public final class Slog { * * @see Log#wtf(String, Throwable) */ @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @Nullable Throwable tr) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true); } Loading @@ -284,7 +282,6 @@ public final class Slog { * @see Log#wtf(String, String, Throwable) */ @UnsupportedAppUsage @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @NonNull String msg, @Nullable Throwable tr) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true); } Loading core/java/com/android/internal/os/AndroidPrintStream.java +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Log; * * {@hide} */ @android.ravenwood.annotation.RavenwoodKeepWholeClass class AndroidPrintStream extends LoggingPrintStream { private final int priority; Loading core/java/com/android/internal/os/RuntimeInit.java +28 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import dalvik.system.VMRuntime; import libcore.content.type.MimeMap; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; Loading @@ -50,6 +51,7 @@ import java.util.logging.LogManager; * public consumption. * @hide */ @android.ravenwood.annotation.RavenwoodKeepPartialClass public class RuntimeInit { final static String TAG = "AndroidRuntime"; final static boolean DEBUG = false; Loading @@ -67,7 +69,15 @@ public class RuntimeInit { private static volatile ApplicationWtfHandler sDefaultApplicationWtfHandler; /** * Stored values of System.out and System.err before they've been replaced by * redirectLogStreams(). Kept open here for other Ravenwood internals to use. */ public static PrintStream sOut$ravenwood; public static PrintStream sErr$ravenwood; 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) { Loading Loading @@ -385,6 +395,7 @@ public class RuntimeInit { /** * Redirect System.out and System.err to the Android log. */ @android.ravenwood.annotation.RavenwoodReplace public static void redirectLogStreams() { System.out.close(); System.setOut(new AndroidPrintStream(Log.INFO, "System.out")); Loading @@ -392,6 +403,17 @@ public class RuntimeInit { System.setErr(new AndroidPrintStream(Log.WARN, "System.err")); } public static void redirectLogStreams$ravenwood() { if (sOut$ravenwood == null) { sOut$ravenwood = System.out; System.setOut(new AndroidPrintStream(Log.INFO, "System.out")); } if (sErr$ravenwood == null) { sErr$ravenwood = System.err; System.setErr(new AndroidPrintStream(Log.WARN, "System.err")); } } /** * Report a serious error in the current process. May or may not cause * the process to terminate (depends on system settings). Loading @@ -399,6 +421,7 @@ public class RuntimeInit { * @param tag to record with the error * @param t exception describing the error site and conditions */ @android.ravenwood.annotation.RavenwoodReplace public static void wtf(String tag, Throwable t, boolean system) { try { boolean exit = false; Loading Loading @@ -436,6 +459,11 @@ public class RuntimeInit { } } public static void wtf$ravenwood(String tag, Throwable t, boolean system) { // We've already emitted to logs, so there's nothing more to do here, // as we don't have a DropBox pipeline configured } /** * Set the default {@link ApplicationWtfHandler}, in case the ActivityManager is not ready yet. */ Loading core/tests/coretests/src/android/util/LogTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,13 @@ public class LogTest { private static final String PROPERTY_TAG = "log.tag.LogTest"; private static final String LOG_TAG = "LogTest"; @Test public void testWtf() { Log.wtf(LOG_TAG, "Message"); Log.wtf(LOG_TAG, "Message", new Throwable("Throwable")); Log.wtf(LOG_TAG, new Throwable("Throwable")); } @Test @Ignore public void testIsLoggable() { Loading core/tests/utiltests/src/android/util/SlogTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,11 @@ public class SlogTest { Slog.w(TAG, MSG, THROWABLE); Slog.e(TAG, MSG, THROWABLE); } @Test public void testWtf() { Slog.wtf(TAG, MSG); Slog.wtf(TAG, MSG, THROWABLE); Slog.wtf(TAG, THROWABLE); } } Loading
core/java/android/util/Slog.java +0 −3 Original line number Diff line number Diff line Loading @@ -217,7 +217,6 @@ public final class Slog { * @see Log#wtf(String, String) */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @NonNull String msg) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true); } Loading Loading @@ -263,7 +262,6 @@ public final class Slog { * * @see Log#wtf(String, Throwable) */ @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @Nullable Throwable tr) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true); } Loading @@ -284,7 +282,6 @@ public final class Slog { * @see Log#wtf(String, String, Throwable) */ @UnsupportedAppUsage @android.ravenwood.annotation.RavenwoodThrow public static int wtf(@Nullable String tag, @NonNull String msg, @Nullable Throwable tr) { return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true); } Loading
core/java/com/android/internal/os/AndroidPrintStream.java +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Log; * * {@hide} */ @android.ravenwood.annotation.RavenwoodKeepWholeClass class AndroidPrintStream extends LoggingPrintStream { private final int priority; Loading
core/java/com/android/internal/os/RuntimeInit.java +28 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import dalvik.system.VMRuntime; import libcore.content.type.MimeMap; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; Loading @@ -50,6 +51,7 @@ import java.util.logging.LogManager; * public consumption. * @hide */ @android.ravenwood.annotation.RavenwoodKeepPartialClass public class RuntimeInit { final static String TAG = "AndroidRuntime"; final static boolean DEBUG = false; Loading @@ -67,7 +69,15 @@ public class RuntimeInit { private static volatile ApplicationWtfHandler sDefaultApplicationWtfHandler; /** * Stored values of System.out and System.err before they've been replaced by * redirectLogStreams(). Kept open here for other Ravenwood internals to use. */ public static PrintStream sOut$ravenwood; public static PrintStream sErr$ravenwood; 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) { Loading Loading @@ -385,6 +395,7 @@ public class RuntimeInit { /** * Redirect System.out and System.err to the Android log. */ @android.ravenwood.annotation.RavenwoodReplace public static void redirectLogStreams() { System.out.close(); System.setOut(new AndroidPrintStream(Log.INFO, "System.out")); Loading @@ -392,6 +403,17 @@ public class RuntimeInit { System.setErr(new AndroidPrintStream(Log.WARN, "System.err")); } public static void redirectLogStreams$ravenwood() { if (sOut$ravenwood == null) { sOut$ravenwood = System.out; System.setOut(new AndroidPrintStream(Log.INFO, "System.out")); } if (sErr$ravenwood == null) { sErr$ravenwood = System.err; System.setErr(new AndroidPrintStream(Log.WARN, "System.err")); } } /** * Report a serious error in the current process. May or may not cause * the process to terminate (depends on system settings). Loading @@ -399,6 +421,7 @@ public class RuntimeInit { * @param tag to record with the error * @param t exception describing the error site and conditions */ @android.ravenwood.annotation.RavenwoodReplace public static void wtf(String tag, Throwable t, boolean system) { try { boolean exit = false; Loading Loading @@ -436,6 +459,11 @@ public class RuntimeInit { } } public static void wtf$ravenwood(String tag, Throwable t, boolean system) { // We've already emitted to logs, so there's nothing more to do here, // as we don't have a DropBox pipeline configured } /** * Set the default {@link ApplicationWtfHandler}, in case the ActivityManager is not ready yet. */ Loading
core/tests/coretests/src/android/util/LogTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,13 @@ public class LogTest { private static final String PROPERTY_TAG = "log.tag.LogTest"; private static final String LOG_TAG = "LogTest"; @Test public void testWtf() { Log.wtf(LOG_TAG, "Message"); Log.wtf(LOG_TAG, "Message", new Throwable("Throwable")); Log.wtf(LOG_TAG, new Throwable("Throwable")); } @Test @Ignore public void testIsLoggable() { Loading
core/tests/utiltests/src/android/util/SlogTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -44,4 +44,11 @@ public class SlogTest { Slog.w(TAG, MSG, THROWABLE); Slog.e(TAG, MSG, THROWABLE); } @Test public void testWtf() { Slog.wtf(TAG, MSG); Slog.wtf(TAG, MSG, THROWABLE); Slog.wtf(TAG, THROWABLE); } }