Use vendor record key when interacting with mVendorService am: 626861c7e5

Original change: https://android-review.googlesource.com/c/device/google/atv/+/3497664

Change-Id: I1a5198f2c64f04287a49eca43fdedde8ca08cdb9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/InterfaceOffloadManager.java b/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/InterfaceOffloadManager.java
index 8759883..efe2112 100644
--- a/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/InterfaceOffloadManager.java
+++ b/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/InterfaceOffloadManager.java
@@ -81,6 +81,17 @@
                 mOffloadIntentStore.getPassthroughIntentsForInterface(mNetworkInterface));
     }
 
+    void retrieveAndClearMetrics() {
+        if (!mIsNetworkAvailable) {
+            return;
+        }
+        if (!mOffloadWriter.isVendorServiceConnected()) {
+            Log.e(TAG, "Vendor service disconnected, cannot apply mDNS offload state");
+            return;
+        }
+        mOffloadWriter.retrieveAndClearMetrics(mCurrentOffloadKeys);
+    }
+
     private void clearProtocolResponses() {
         applyOffloadIntents(Collections.emptySet());
     }
diff --git a/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/MdnsOffloadManagerService.java b/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/MdnsOffloadManagerService.java
index df4b4d3..89bb3ec 100644
--- a/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/MdnsOffloadManagerService.java
+++ b/MdnsOffloadManagerService/src/com/android/tv/mdnsoffloadmanager/MdnsOffloadManagerService.java
@@ -462,7 +462,8 @@
                 if (Intent.ACTION_SCREEN_ON.equals(action)) {
                     Log.d(TAG, "SCREEN_ON");
                     mOffloadWriter.setOffloadState(false);
-                    mOffloadWriter.retrieveAndClearMetrics(mOffloadIntentStore.getRecordKeys());
+                    mInterfaceOffloadManagers.values().forEach(
+                            InterfaceOffloadManager::retrieveAndClearMetrics);
                 } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
                     Log.d(TAG, "SCREEN_OFF");
                     try {