From 3fa872792d7a19069315de348003e341d6343aaf Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Wed, 31 Aug 2016 23:47:22 +1000 Subject: RIL: Squash support for mQANElements commit d76a3247a3547e7c7a95a13db7cfa1ec2a061f3d Author: Mike Kasick Date: Thu Aug 30 13:42:27 2012 -0400 RILs: Eliminate repeated overrides of responseOperatorInfos. - Add mQANElements field, default to 4 in RIL, use in responseOperatorInfos. This may be set to 5 in subclassed RIL constructors. - Remove repeated overrides of responseOperatorInfos by subclassed RILs, as there's no logic change, just a disagreement as to whether the QUERY_AVAILABLE_NETWORKS response is an array with 4 or 5 per-network elements. - Size OperatorInfo ArrayList appropriately in SemcRIL and SonyQualcommRIL. Change-Id: I1254a670d8611f76aad13a6f197c67012c7d4c47 commit 0bac442311e73cdbd4582babdc4e95d51dc0c5b7 Author: koxxx Date: Thu Jul 9 22:27:13 2015 +0200 RIL: Make mQANElements configurable by property Change-Id: I21a3641d54ffd9e1b7d9f291c16bb9c6ca5f4542 Change-Id: I3657a41787ba2dc6549702bf6a2f549cf1aa6a7b --- src/java/com/android/internal/telephony/RIL.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index b7d576a4f..0bb3802cc 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -304,6 +304,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { private TelephonyMetrics mMetrics = TelephonyMetrics.getInstance(); + // Number of per-network elements expected in QUERY_AVAILABLE_NETWORKS's response. + // 4 elements is default, but many RILs actually return 5, making it impossible to + // divide the response array without prior knowledge of the number of elements. + protected int mQANElements = SystemProperties.getInt("ro.ril.telephony.mqanelements", 4); + //***** Events static final int EVENT_SEND = 1; @@ -4109,15 +4114,15 @@ public final class RIL extends BaseCommands implements CommandsInterface { String strings[] = (String [])responseStrings(p); ArrayList ret; - if (strings.length % 4 != 0) { + if (strings.length % mQANElements != 0) { throw new RuntimeException( "RIL_REQUEST_QUERY_AVAILABLE_NETWORKS: invalid response. Got " - + strings.length + " strings, expected multible of 4"); + + strings.length + " strings, expected multiple of " + mQANElements); } - ret = new ArrayList(strings.length / 4); + ret = new ArrayList(strings.length / mQANElements); - for (int i = 0 ; i < strings.length ; i += 4) { + for (int i = 0 ; i < strings.length ; i += mQANElements) { ret.add ( new OperatorInfo( strings[i+0], -- cgit v1.2.3