OSDN Git Service

Only actually log the DNS events we have.
authorLorenzo Colitti <lorenzo@google.com>
Mon, 23 May 2016 05:10:19 +0000 (14:10 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Mon, 23 May 2016 07:39:18 +0000 (16:39 +0900)
DnsEventListenerService#logAndClear was always logging 100 DNS
events regardless of how many were actually logged. The rest of
the events were either all zero or previously-recorded events.

Bug: 28204408
Change-Id: I9da3b07a2e7b7512397a3eb6568a877815eb3312

services/core/java/com/android/server/connectivity/DnsEventListenerService.java

index d3f8af0..18ab731 100644 (file)
@@ -78,9 +78,11 @@ public class DnsEventListenerService extends IDnsEventListener.Stub {
                 return;
             }
 
+            // Only log as many events as we actually have.
+            byte[] eventTypes = Arrays.copyOf(mEventTypes, mEventCount);
             byte[] returnCodes = Arrays.copyOf(mReturnCodes, mEventCount);
             int[] latenciesMs = Arrays.copyOf(mLatenciesMs, mEventCount);
-            DnsEvent.logEvent(mNetId, mEventTypes, mReturnCodes, mLatenciesMs);
+            DnsEvent.logEvent(mNetId, eventTypes, returnCodes, latenciesMs);
             maybeLog(String.format("Logging %d results for netId %d", mEventCount, mNetId));
             mEventCount = 0;
         }