Search in sources :

Example 66 with FastPrintWriter

use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by DirtyUnicorns.

the class BackStackRecord method commitInternal.

int commitInternal(boolean allowStateLoss) {
    if (mCommitted) {
        throw new IllegalStateException("commit already called");
    }
    if (FragmentManagerImpl.DEBUG) {
        Log.v(TAG, "Commit: " + this);
        LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
        PrintWriter pw = new FastPrintWriter(logw, false, 1024);
        dump("  ", null, pw, null);
        pw.flush();
    }
    mCommitted = true;
    if (mAddToBackStack) {
        mIndex = mManager.allocBackStackIndex(this);
    } else {
        mIndex = -1;
    }
    mManager.enqueueAction(this, allowStateLoss);
    return mIndex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 67 with FastPrintWriter

use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by AOSPA.

the class BackStackRecord method commitInternal.

int commitInternal(boolean allowStateLoss) {
    if (mCommitted) {
        throw new IllegalStateException("commit already called");
    }
    if (FragmentManagerImpl.DEBUG) {
        Log.v(TAG, "Commit: " + this);
        LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
        PrintWriter pw = new FastPrintWriter(logw, false, 1024);
        dump("  ", null, pw, null);
        pw.flush();
    }
    mCommitted = true;
    if (mAddToBackStack) {
        mIndex = mManager.allocBackStackIndex(this);
    } else {
        mIndex = -1;
    }
    mManager.enqueueAction(this, allowStateLoss);
    return mIndex;
}
Also used : LogWriter(android.util.LogWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 68 with FastPrintWriter

use of com.android.internal.util.FastPrintWriter in project android_frameworks_base by AOSPA.

the class WindowLeaked method dumpGfxInfo.

public void dumpGfxInfo(FileDescriptor fd, String[] args) {
    FileOutputStream fout = new FileOutputStream(fd);
    PrintWriter pw = new FastPrintWriter(fout);
    try {
        synchronized (mLock) {
            final int count = mViews.size();
            pw.println("Profile data in ms:");
            for (int i = 0; i < count; i++) {
                ViewRootImpl root = mRoots.get(i);
                String name = getWindowName(root);
                pw.printf("\n\t%s (visibility=%d)", name, root.getHostVisibility());
                ThreadedRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer;
                if (renderer != null) {
                    renderer.dumpGfxInfo(pw, fd, args);
                }
            }
            pw.println("\nView hierarchy:\n");
            int viewsCount = 0;
            int displayListsSize = 0;
            int[] info = new int[2];
            for (int i = 0; i < count; i++) {
                ViewRootImpl root = mRoots.get(i);
                root.dumpGfxInfo(info);
                String name = getWindowName(root);
                pw.printf("  %s\n  %d views, %.2f kB of display lists", name, info[0], info[1] / 1024.0f);
                pw.printf("\n\n");
                viewsCount += info[0];
                displayListsSize += info[1];
            }
            pw.printf("\nTotal ViewRootImpl: %d\n", count);
            pw.printf("Total Views:        %d\n", viewsCount);
            pw.printf("Total DisplayList:  %.2f kB\n\n", displayListsSize / 1024.0f);
        }
    } finally {
        pw.flush();
    }
}
Also used : FastPrintWriter(com.android.internal.util.FastPrintWriter) FileOutputStream(java.io.FileOutputStream) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 69 with FastPrintWriter

use of com.android.internal.util.FastPrintWriter in project platform_frameworks_base by android.

the class ActivityManager method dumpPackageStateStatic.

/**
     * @hide
     */
public static void dumpPackageStateStatic(FileDescriptor fd, String packageName) {
    FileOutputStream fout = new FileOutputStream(fd);
    PrintWriter pw = new FastPrintWriter(fout);
    dumpService(pw, fd, "package", new String[] { packageName });
    pw.println();
    dumpService(pw, fd, Context.ACTIVITY_SERVICE, new String[] { "-a", "package", packageName });
    pw.println();
    dumpService(pw, fd, "meminfo", new String[] { "--local", "--package", packageName });
    pw.println();
    dumpService(pw, fd, ProcessStats.SERVICE_NAME, new String[] { packageName });
    pw.println();
    dumpService(pw, fd, "usagestats", new String[] { "--packages", packageName });
    pw.println();
    dumpService(pw, fd, BatteryStats.SERVICE_NAME, new String[] { packageName });
    pw.flush();
}
Also used : FastPrintWriter(com.android.internal.util.FastPrintWriter) FileOutputStream(java.io.FileOutputStream) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Example 70 with FastPrintWriter

use of com.android.internal.util.FastPrintWriter in project platform_frameworks_base by android.

the class ActivityThread method handleDumpService.

private void handleDumpService(DumpComponentInfo info) {
    final StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
    try {
        Service s = mServices.get(info.token);
        if (s != null) {
            PrintWriter pw = new FastPrintWriter(new FileOutputStream(info.fd.getFileDescriptor()));
            s.dump(info.fd.getFileDescriptor(), pw, info.args);
            pw.flush();
        }
    } finally {
        IoUtils.closeQuietly(info.fd);
        StrictMode.setThreadPolicy(oldPolicy);
    }
}
Also used : StrictMode(android.os.StrictMode) FastPrintWriter(com.android.internal.util.FastPrintWriter) FileOutputStream(java.io.FileOutputStream) PrintWriter(java.io.PrintWriter) FastPrintWriter(com.android.internal.util.FastPrintWriter)

Aggregations

FastPrintWriter (com.android.internal.util.FastPrintWriter)128 PrintWriter (java.io.PrintWriter)122 FileOutputStream (java.io.FileOutputStream)61 StringWriter (java.io.StringWriter)34 LogWriter (android.util.LogWriter)24 StrictMode (android.os.StrictMode)17 IOException (java.io.IOException)16 FileNotFoundException (java.io.FileNotFoundException)12 Date (java.util.Date)10 HashMap (java.util.HashMap)8 Map (java.util.Map)8 Uri (android.net.Uri)7 Message (android.os.Message)7 ArrayMap (android.util.ArrayMap)7 PrintWriterPrinter (android.util.PrintWriterPrinter)7 SimpleDateFormat (java.text.SimpleDateFormat)7 NotFoundException (android.content.res.Resources.NotFoundException)5 Point (android.graphics.Point)5 LogPrinter (android.util.LogPrinter)5 Printer (android.util.Printer)5