Move dump() to dumpAsync(), more oneway calls.

When calling out to dump services hosted by external apps, use
dumpAsync() to avoid hanging if the remote process is wedged.

(cherry picked from commit 850c83e6da3b34a4eab804133420247fc9dbb8a1)

Test: builds, boots, runs with minimal logs triggered
Bug: 32715088

Merged-In: I70aa2666ae21dae8f09ded2063bed359c0b210c5

Change-Id: Ic2be10dc8478d613cea6e2c976b9987c250b86b7
diff --git a/services/core/java/com/android/server/NetworkScoreService.java b/services/core/java/com/android/server/NetworkScoreService.java
index 4e969be..4c9ea58 100644
--- a/services/core/java/com/android/server/NetworkScoreService.java
+++ b/services/core/java/com/android/server/NetworkScoreService.java
@@ -46,8 +46,10 @@
 import com.android.internal.annotations.GuardedBy;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.content.PackageMonitor;
+import com.android.internal.os.TransferPipe;
 
 import java.io.FileDescriptor;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -439,12 +441,9 @@
 
         for (INetworkScoreCache scoreCache : getScoreCaches()) {
             try {
-                scoreCache.asBinder().dump(fd, args);
-            } catch (RemoteException e) {
-                writer.println("Unable to dump score cache");
-                if (Log.isLoggable(TAG, Log.VERBOSE)) {
-                    Log.v(TAG, "Unable to dump score cache", e);
-                }
+                TransferPipe.dumpAsync(scoreCache.asBinder(), fd, args);
+            } catch (IOException | RemoteException e) {
+                writer.println("Failed to dump score cache: " + e);
             }
         }
         if (mServiceConnection != null) {