FileDocCategorySizeDatePackage
Console.javaAPI DocAndroid 5.1 API6924Thu Mar 12 22:22:42 GMT 2015com.android.systemui.recents.misc

Console

public class Console extends Object

Fields Summary
public static final Map
mTimeLogs
public static final String
AnsiReset
public static final String
AnsiBlack
public static final String
AnsiRed
public static final String
AnsiGreen
public static final String
AnsiYellow
public static final String
AnsiBlue
public static final String
AnsiPurple
public static final String
AnsiCyan
public static final String
AnsiWhite
public static boolean
Enabled
Constructors Summary
Methods Summary
public static voidlog(java.lang.String key)
Logs a key


        
         
        log(true, key, "", AnsiReset);
    
public static voidlog(boolean condition, java.lang.String key)
Logs a conditioned key

        if (condition) {
            log(condition, key, "", AnsiReset);
        }
    
public static voidlog(boolean condition, java.lang.String key, java.lang.Object data)
Logs a key in a specific color

        if (condition) {
            log(condition, key, data, AnsiReset);
        }
    
public static voidlog(boolean condition, java.lang.String key, java.lang.Object data, java.lang.String color)
Logs a key with data in a specific color

        if (condition) {
            System.out.println(color + key + AnsiReset + " " + data.toString());
        }
    
public static voidlogDivider(boolean condition)
Logs a divider bar

        if (condition) {
            System.out.println("==== [" + System.currentTimeMillis() +
                    "] ============================================================");
        }
    
public static voidlogError(android.content.Context context, java.lang.String msg)
Logs an error

        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
        Log.e("Recents", msg);
    
public static voidlogRawError(java.lang.String msg, java.lang.Exception e)
Logs a raw error

        Log.e("Recents", msg, e);
    
public static voidlogStackTrace()
Logs a stack trace

        logStackTrace("", 99);
    
public static voidlogStackTrace(int depth)
Logs a stack trace to a certain depth

        logStackTrace("", depth);
    
public static voidlogStackTrace(java.lang.String key, int depth)
Logs a stack trace to a certain depth with a key

        int offset = 0;
        StackTraceElement[] callStack = Thread.currentThread().getStackTrace();
        String tinyStackTrace = "";
        // Skip over the known stack trace classes
        for (int i = 0; i < callStack.length; i++) {
            StackTraceElement el = callStack[i];
            String className = el.getClassName();
            if (className.indexOf("dalvik.system.VMStack") == -1 &&
                className.indexOf("java.lang.Thread") == -1 &&
                className.indexOf("recents.Console") == -1) {
                break;
            } else {
                offset++;
            }
        }
        // Build the pretty stack trace
        int start = Math.min(offset + depth, callStack.length);
        int end = offset;
        String indent = "";
        for (int i = start - 1; i >= end; i--) {
            StackTraceElement el = callStack[i];
            tinyStackTrace += indent + " -> " + el.getClassName() +
                    "[" + el.getLineNumber() + "]." + el.getMethodName();
            if (i > end) {
                tinyStackTrace += "\n";
                indent += "  ";
            }
        }
        log(true, key, tinyStackTrace, AnsiRed);
    
public static voidlogStartTracingTime(boolean condition, java.lang.String key)
Starts a time trace

        if (condition) {
            long curTime = System.currentTimeMillis();
            mTimeLogs.put(key, curTime);
            Console.log(condition, "[Recents|" + key + "]",
                    "started @ " + curTime);
        }
    
public static voidlogTraceTime(boolean condition, java.lang.String key, java.lang.String desc)
Continues a time trace

        if (condition) {
            long timeDiff = System.currentTimeMillis() - mTimeLogs.get(key);
            Console.log(condition, "[Recents|" + key + "|" + desc + "]",
                    "+" + timeDiff + "ms");
        }
    
public static java.lang.StringmotionEventActionToString(int action)
Returns the stringified MotionEvent action

        switch (action) {
            case MotionEvent.ACTION_DOWN:
                return "Down";
            case MotionEvent.ACTION_UP:
                return "Up";
            case MotionEvent.ACTION_MOVE:
                return "Move";
            case MotionEvent.ACTION_CANCEL:
                return "Cancel";
            case MotionEvent.ACTION_POINTER_DOWN:
                return "Pointer Down";
            case MotionEvent.ACTION_POINTER_UP:
                return "Pointer Up";
            default:
                return "" + action;
        }
    
public static java.lang.StringtrimMemoryLevelToString(int level)

        switch (level) {
            case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
                return "UI Hidden";
            case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
                return "Running Moderate";
            case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
                return "Background";
            case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
                return "Running Low";
            case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
                return "Moderate";
            case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
                return "Critical";
            case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
                return "Complete";
            default:
                return "" + level;
        }