FileDocCategorySizeDatePackage
DumpUtils.javaAPI DocAndroid 5.1 API1795Thu Mar 12 22:22:10 GMT 2015com.android.internal.util

DumpUtils

public final class DumpUtils extends Object
Helper functions for dumping the state of system services.

Fields Summary
Constructors Summary
private DumpUtils()

    
Methods Summary
public static voiddumpAsync(android.os.Handler handler, com.android.internal.util.DumpUtils$Dump dump, java.io.PrintWriter pw, long timeout)
Helper for dumping state owned by a handler thread. Because the caller might be holding an important lock that the handler is trying to acquire, we use a short timeout to avoid deadlocks. The process is inelegant but this function is only used for debugging purposes.

        final StringWriter sw = new StringWriter();
        if (handler.runWithScissors(new Runnable() {
            @Override
            public void run() {
                PrintWriter lpw = new FastPrintWriter(sw);
                dump.dump(lpw);
                lpw.close();
            }
        }, timeout)) {
            pw.print(sw.toString());
        } else {
            pw.println("... timed out");
        }