summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaust93 <monumentum@gmail.com>2018-09-19 14:26:54 +0800
committerdianlujitao <dianlujitao@lineageos.org>2019-01-26 20:40:45 +0800
commite3d006fa722c02fc26acdfcaa43a3f3a1378eba9 (patch)
tree9ae181d63abddb8e9b067d48ffac8d84167dce66
parent47624191a40610c4f49c6f68643c0e345648f836 (diff)
downloadandroid_hardware_ril-e3d006fa722c02fc26acdfcaa43a3f3a1378eba9.tar.gz
android_hardware_ril-e3d006fa722c02fc26acdfcaa43a3f3a1378eba9.tar.bz2
android_hardware_ril-e3d006fa722c02fc26acdfcaa43a3f3a1378eba9.zip
libril: Fix manual network selection with old modem
* Old modem sends and applies mccmnc+network type, but new aosp telephony uses only digits. * Manually cut or append the "+" and strings after that to work around. Change-Id: I1015e6c0d6afdc0c03d70e9491d49331703eddcc
-rw-r--r--libril/Android.mk4
-rw-r--r--libril/ril_service.cpp12
2 files changed, 16 insertions, 0 deletions
diff --git a/libril/Android.mk b/libril/Android.mk
index d1e8ee3..cde192f 100644
--- a/libril/Android.mk
+++ b/libril/Android.mk
@@ -41,6 +41,10 @@ ifneq ($(DISABLE_RILD_OEM_HOOK),)
LOCAL_CFLAGS += -DOEM_HOOK_DISABLED
endif
+ifneq ($(TARGET_USES_OLD_MNC_FORMAT),)
+ LOCAL_CFLAGS += -DOLD_MNC_FORMAT
+endif
+
LOCAL_C_INCLUDES += external/nanopb-c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index dc2a4ce..5fe4153 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -1355,8 +1355,15 @@ Return<void> RadioImpl::setNetworkSelectionModeManual(int32_t serial,
#if VDBG
RLOGD("setNetworkSelectionModeManual: serial %d", serial);
#endif
+#ifndef OLD_MNC_FORMAT
dispatchString(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL,
operatorNumeric.c_str());
+#else
+ std::string opNum = operatorNumeric;
+ opNum.append("+");
+ dispatchString(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL,
+ opNum.c_str());
+#endif
return Void();
}
@@ -4573,7 +4580,12 @@ int radio::getAvailableNetworksResponse(int slotId,
for (int i = 0, j = 0; i < numStrings; i = i + 4, j++) {
networks[j].alphaLong = convertCharPtrToHidlString(resp[i]);
networks[j].alphaShort = convertCharPtrToHidlString(resp[i + 1]);
+#ifndef OLD_MNC_FORMAT
networks[j].operatorNumeric = convertCharPtrToHidlString(resp[i + 2]);
+#else
+ const char *mccmncIdx = strrchr(resp[i + 2], '+');
+ networks[j].operatorNumeric = hidl_string(resp[i + 2], mccmncIdx - resp[i + 2]);
+#endif
int status = convertOperatorStatusToInt(resp[i + 3]);
if (status == -1) {
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;