Remove unnecessary byte array allocation:
The `upstreamEvents` byte array may not be used if debugging is
disabled. Remove the array allocation and retrieve the array
directly when required.
Test: atest TetheringTests
Change-Id: I7e1ddd3ce2e3079f07deebe3dd49aef832b24558
diff --git a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
index 32c1410..c77f951 100644
--- a/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
+++ b/Tethering/src/com/android/networkstack/tethering/metrics/TetheringMetrics.java
@@ -431,7 +431,6 @@
* @param reported a NetworkTetheringReported object containing statistics to write
*/
private void write(@NonNull final NetworkTetheringReported reported) {
- final byte[] upstreamEvents = reported.getUpstreamEvents().toByteArray();
mDependencies.write(reported);
if (DBG) {
Log.d(
@@ -445,7 +444,7 @@
+ ", userType: "
+ reported.getUserType().getNumber()
+ ", upstreamTypes: "
- + Arrays.toString(upstreamEvents)
+ + Arrays.toString(reported.getUpstreamEvents().toByteArray())
+ ", durationMillis: "
+ reported.getDurationMillis());
}