Only log first input reader length

It's not feasible to reliably differentiate a different
segment parsing from a seek.

Bug: 158742256
Test: atest CtsMediaParserTestCases
Test: atest CtsMediaParserHostTestCases
Change-Id: I7d62f1c2b9334bf601f38ce915b0fafdc76fbec1
Merged-In: I7d62f1c2b9334bf601f38ce915b0fafdc76fbec1
(cherry picked from commit 2eee34d2861ba2fba8bc4a23157acfd7dc7a53dd)
diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java
index 045b413..8bdca76 100644
--- a/apex/media/framework/java/android/media/MediaParser.java
+++ b/apex/media/framework/java/android/media/MediaParser.java
@@ -1186,11 +1186,10 @@
             // TODO: For efficiency, the same implementation should be used, by providing a
             // clearBuffers() method, or similar.
             long resourceLength = seekableInputReader.getLength();
-            if (resourceLength == -1) {
-                mResourceByteCount = -1;
-            }
-            if (mResourceByteCount != -1) {
-                mResourceByteCount += resourceLength;
+            if (mResourceByteCount == 0) {
+                // For resource byte count metric collection, we only take into account the length
+                // of the first provided input reader.
+                mResourceByteCount = resourceLength;
             }
             mExtractorInput =
                     new DefaultExtractorInput(