Sync frameworks/libs/net version of SharedLog
There are two versions of SharedLog after it was copied in aosp/1849358.
Moving forward, this is the version of the class that will be kept.
I also checked SharedLogTest and it those are both in sync.
Test: m
Bug: 235901424
Change-Id: Id0899286d582be1478dc3e4a407c190ea2ffd71a
diff --git a/staticlibs/device/com/android/net/module/util/SharedLog.java b/staticlibs/device/com/android/net/module/util/SharedLog.java
index 37c6f6d..17b061e 100644
--- a/staticlibs/device/com/android/net/module/util/SharedLog.java
+++ b/staticlibs/device/com/android/net/module/util/SharedLog.java
@@ -26,6 +26,7 @@
import java.time.LocalDateTime;
import java.util.ArrayDeque;
import java.util.Deque;
+import java.util.Iterator;
import java.util.StringJoiner;
@@ -94,6 +95,15 @@
mLocalLog.dump(writer);
}
+ /**
+ * Reverse dump the contents of this log.
+ *
+ * <p>This method may be called on any thread.
+ */
+ public void reverseDump(PrintWriter writer) {
+ mLocalLog.reverseDump(writer);
+ }
+
//////
// Methods that both log an entry and emit it to the system log.
//////
@@ -228,5 +238,12 @@
pw.println(s);
}
}
+
+ synchronized void reverseDump(PrintWriter pw) {
+ final Iterator<String> itr = mLog.descendingIterator();
+ while (itr.hasNext()) {
+ pw.println(itr.next());
+ }
+ }
}
}