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

Commit d7be4c70 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

LocalLog: add overloaded dump and reverseDump methods.

Both dump() and reverseDump() only need a single PrintWriter parameter.
This patch adds overloaded versions of these methods with that single
parameter. Callers can slowly migrate to these simpler methods over
time.

Test: Compiled.
Change-Id: I503df2af1d8115f715238f94551343fda1e951cb
parent 749dfc30
Loading
Loading
Loading
Loading
+17 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.util;
package android.util;


import android.annotation.UnsupportedAppUsage;
import android.annotation.UnsupportedAppUsage;

import java.io.FileDescriptor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.PrintWriter;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
@@ -55,6 +56,10 @@ public final class LocalLog {


    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        dump(pw);
    }

    public synchronized void dump(PrintWriter pw) {
        Iterator<String> itr = mLog.iterator();
        Iterator<String> itr = mLog.iterator();
        while (itr.hasNext()) {
        while (itr.hasNext()) {
            pw.println(itr.next());
            pw.println(itr.next());
@@ -62,6 +67,10 @@ public final class LocalLog {
    }
    }


    public synchronized void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public synchronized void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
        reverseDump(pw);
    }

    public synchronized void reverseDump(PrintWriter pw) {
        Iterator<String> itr = mLog.descendingIterator();
        Iterator<String> itr = mLog.descendingIterator();
        while (itr.hasNext()) {
        while (itr.hasNext()) {
            pw.println(itr.next());
            pw.println(itr.next());
@@ -75,10 +84,16 @@ public final class LocalLog {
        }
        }
        @UnsupportedAppUsage
        @UnsupportedAppUsage
        public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
            mLog.dump(fd, pw, args);
            mLog.dump(pw);
        }
        public void dump(PrintWriter pw) {
            mLog.dump(pw);
        }
        }
        public void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
        public void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) {
            mLog.reverseDump(fd, pw, args);
            mLog.reverseDump(pw);
        }
        public void reverseDump(PrintWriter pw) {
            mLog.reverseDump(pw);
        }
        }
    }
    }