Merge "Fix error response handling for RIL request" am: d15d4e41a8 am: 2058e9356b am: fcdec2c17f am: 8c40d68ff9 am: 0fdb2873d7

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1374156

Change-Id: I131e65bc99749f3ff6502f32970058b26fc4a37d
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 964e522..576e14c 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -763,7 +763,9 @@
                     if (ar.exception == null && ar.result != null) {
                         request.result = ar.result;     // Integer
                     } else {
-                        request.result = null;
+                        // request.result must be set to something non-null
+                        // for the calling thread to unblock
+                        request.result = new int[]{-1};
                         if (ar.result == null) {
                             loge("getPreferredNetworkType: Empty response");
                         } else if (ar.exception instanceof CommandException) {