OSDN Git Service

Do not treat NULL response as error for getAllowedCarriers
authorJayachandran C <jayachandranc@google.com>
Fri, 28 Apr 2017 07:57:13 +0000 (00:57 -0700)
committerJayachandran C <jayachandranc@google.com>
Fri, 28 Apr 2017 17:58:09 +0000 (10:58 -0700)
NULL is a valid response in RIL_REQUEST_GET_CARRIER_RESTRICTIONS
as per RIL.h. NULL implies all carriers are allowed. This fix skips
setting error if response is NULL to fix VTS failure.

Test: VTS
Bug: 37157801
Change-Id: Ida3d2d0f10693ed396b236ac9512afb277ce2ddb

libril/ril_service.cpp

index 59aafa8..c1f47fd 100644 (file)
@@ -6171,8 +6171,14 @@ int radio::getAllowedCarriersResponse(int slotId,
         populateResponseInfo(responseInfo, serial, responseType, e);
         CarrierRestrictions carrierInfo = {};
         bool allAllowed = true;
-        if (response == NULL || responseLen != sizeof(RIL_CarrierRestrictions)) {
-            RLOGE("getAllowedCarriersResponse Invalid response: NULL");
+        if (response == NULL) {
+#if VDBG
+            RLOGD("getAllowedCarriersResponse response is NULL: all allowed");
+#endif
+            carrierInfo.allowedCarriers.resize(0);
+            carrierInfo.excludedCarriers.resize(0);
+        } else if (responseLen != sizeof(RIL_CarrierRestrictions)) {
+            RLOGE("getAllowedCarriersResponse Invalid response");
             if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
         } else {
             RIL_CarrierRestrictions *pCr = (RIL_CarrierRestrictions *)response;