Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d982851d authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Use FastPrintWriter... everywhere."

parents 5d2bba0d 8c84109b
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.IBinder;
import com.android.internal.app.IUsageStats;
import com.android.internal.os.PkgUsageStats;
import com.android.internal.os.TransferPipe;
import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.MemInfoReader;

import android.content.ComponentName;
@@ -2206,9 +2207,11 @@ public class ActivityManager {
     */
    public static void dumpPackageStateStatic(FileDescriptor fd, String packageName) {
        FileOutputStream fout = new FileOutputStream(fd);
        PrintWriter pw = new PrintWriter(fout);
        PrintWriter pw = new FastPrintWriter(fout);
        dumpService(pw, fd, Context.ACTIVITY_SERVICE, new String[] { "package", packageName });
        pw.println();
        dumpService(pw, fd, "procstats", new String[] { packageName });
        pw.println();
        dumpService(pw, fd, "package", new String[] { packageName });
        pw.println();
        dumpService(pw, fd, BatteryStats.SERVICE_NAME, new String[] { packageName });
+9 −5
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ import android.security.AndroidKeyStoreProvider;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.RuntimeInit;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.Objects;
import com.android.org.conscrypt.OpenSSLSocketImpl;

@@ -899,7 +900,7 @@ public final class ActivityThread {
        public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin,
                boolean dumpInfo, boolean dumpDalvik, String[] args) {
            FileOutputStream fout = new FileOutputStream(fd);
            PrintWriter pw = new PrintWriter(fout);
            PrintWriter pw = new FastPrintWriter(fout);
            try {
                return dumpMemInfo(pw, checkin, dumpInfo, dumpDalvik);
            } finally {
@@ -1176,7 +1177,7 @@ public final class ActivityThread {

        @Override
        public void dumpDbInfo(FileDescriptor fd, String[] args) {
            PrintWriter pw = new PrintWriter(new FileOutputStream(fd));
            PrintWriter pw = new FastPrintWriter(new FileOutputStream(fd));
            PrintWriterPrinter printer = new PrintWriterPrinter(pw);
            SQLiteDebug.dump(printer, args);
            pw.flush();
@@ -2730,7 +2731,8 @@ public final class ActivityThread {
        try {
            Service s = mServices.get(info.token);
            if (s != null) {
                PrintWriter pw = new PrintWriter(new FileOutputStream(info.fd.getFileDescriptor()));
                PrintWriter pw = new FastPrintWriter(new FileOutputStream(
                        info.fd.getFileDescriptor()));
                s.dump(info.fd.getFileDescriptor(), pw, info.args);
                pw.flush();
            }
@@ -2745,7 +2747,8 @@ public final class ActivityThread {
        try {
            ActivityClientRecord r = mActivities.get(info.token);
            if (r != null && r.activity != null) {
                PrintWriter pw = new PrintWriter(new FileOutputStream(info.fd.getFileDescriptor()));
                PrintWriter pw = new FastPrintWriter(new FileOutputStream(
                        info.fd.getFileDescriptor()));
                r.activity.dump(info.prefix, info.fd.getFileDescriptor(), pw, info.args);
                pw.flush();
            }
@@ -2760,7 +2763,8 @@ public final class ActivityThread {
        try {
            ProviderClientRecord r = mLocalProviders.get(info.token);
            if (r != null && r.mLocalProvider != null) {
                PrintWriter pw = new PrintWriter(new FileOutputStream(info.fd.getFileDescriptor()));
                PrintWriter pw = new FastPrintWriter(new FileOutputStream(
                        info.fd.getFileDescriptor()));
                r.mLocalProvider.dump(info.fd.getFileDescriptor(), pw, info.args);
                pw.flush();
            }
+4 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Printer;
import com.android.internal.util.FastPrintWriter;

import java.io.PrintWriter;
import java.io.StringWriter;
@@ -327,7 +328,9 @@ public class ApplicationErrorReport implements Parcelable {
         */
        public CrashInfo(Throwable tr) {
            StringWriter sw = new StringWriter();
            tr.printStackTrace(new PrintWriter(sw));
            PrintWriter pw = new FastPrintWriter(sw, false, 256);
            tr.printStackTrace(pw);
            pw.flush();
            stackTrace = sw.toString();
            exceptionMessage = tr.getMessage();

+5 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import android.util.LogWriter;
import com.android.internal.util.FastPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -583,8 +584,9 @@ final class BackStackRecord extends FragmentTransaction implements
        if (FragmentManagerImpl.DEBUG) {
            Log.v(TAG, "Commit: " + this);
            LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
            PrintWriter pw = new PrintWriter(logw);
            PrintWriter pw = new FastPrintWriter(logw, false, 1024);
            dump("  ", null, pw, null);
            pw.flush();
        }
        mCommitted = true;
        if (mAddToBackStack) {
@@ -691,8 +693,9 @@ final class BackStackRecord extends FragmentTransaction implements
        if (FragmentManagerImpl.DEBUG) {
            Log.v(TAG, "popFromBackStack: " + this);
            LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
            PrintWriter pw = new PrintWriter(logw);
            PrintWriter pw = new FastPrintWriter(logw, false, 1024);
            dump("  ", null, pw, null);
            pw.flush();
        }

        bumpBackStackNesting(-1);
+7 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.android.internal.util.FastPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -445,12 +446,13 @@ final class FragmentManagerImpl extends FragmentManager {
    private void throwException(RuntimeException ex) {
        Log.e(TAG, ex.getMessage());
        LogWriter logw = new LogWriter(Log.ERROR, TAG);
        PrintWriter pw = new PrintWriter(logw);
        PrintWriter pw = new FastPrintWriter(logw, false, 1024);
        if (mActivity != null) {
            Log.e(TAG, "Activity state:");
            try {
                mActivity.dump("  ", null, pw, new String[] { });
            } catch (Exception e) {
                pw.flush();
                Log.e(TAG, "Failed dumping state", e);
            }
        } else {
@@ -458,9 +460,11 @@ final class FragmentManagerImpl extends FragmentManager {
            try {
                dump("  ", null, pw, new String[] { });
            } catch (Exception e) {
                pw.flush();
                Log.e(TAG, "Failed dumping state", e);
            }
        }
        pw.flush();
        throw ex;
    }

@@ -1806,8 +1810,9 @@ final class FragmentManagerImpl extends FragmentManager {
                    Log.v(TAG, "restoreAllState: back stack #" + i
                        + " (index " + bse.mIndex + "): " + bse);
                    LogWriter logw = new LogWriter(Log.VERBOSE, TAG);
                    PrintWriter pw = new PrintWriter(logw);
                    PrintWriter pw = new FastPrintWriter(logw, false, 1024);
                    bse.dump("  ", pw, false);
                    pw.flush();
                }
                mBackStack.add(bse);
                if (bse.mIndex >= 0) {
Loading