diff options
author | Michael W <baddaemon87@gmail.com> | 2019-10-28 16:23:21 +0100 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2019-10-29 10:33:18 +0100 |
commit | a4b49675ea5f69df5d19b8606e8e4fb2622e07d2 (patch) | |
tree | a76c5de684cc70555006528388e8f4b6f0f396df | |
parent | 9fb0f3a0b97a354e55c1b2a5860d009cde175f17 (diff) | |
download | android_packages_services_Telephony-lineage-16.0.tar.gz android_packages_services_Telephony-lineage-16.0.tar.bz2 android_packages_services_Telephony-lineage-16.0.zip |
NetworkSelection: Use the actual selection, not the first or last one foundlineage-16.0
* Right now, the preference values in the dialog is just the numeric value
of the operator
* In case of multiple networks of the same carrier, e.g. 2G and 3G variants
both being available and displayed, both get the same value, resulting in
at least a visual bug: the last selected network is possibly not
pre-selected when reopening the choice dialog
* Also the onClick method's findIndexOfValue won't notice or handle
multiple entries with the same value the way it's expected
* Make the values unique to prevent selection or display of the wrong
network
Test:
Before:
Select "Vodafone 3G"
Open dialog again: Selection is on "Vodafone 2G"
After:
Select "Vodafone 3G"
Open dialog again: Selection is on "Vodafone 3G"
Change-Id: Iab785e48cd442566d22cfbb8aa2519ba403674be
-rw-r--r-- | src/com/android/phone/NetworkSelectListPreference.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/phone/NetworkSelectListPreference.java b/src/com/android/phone/NetworkSelectListPreference.java index ad67122b6..07db5e25e 100644 --- a/src/com/android/phone/NetworkSelectListPreference.java +++ b/src/com/android/phone/NetworkSelectListPreference.java @@ -424,16 +424,24 @@ public class NetworkSelectListPreference extends ListPreference for (CellInfo cellInfo: mCellInfoList) { // Display each operator name only once. String networkTitle = getNetworkTitle(cellInfo); + String operator = getOperatorNumeric(cellInfo); + String uniqueOperator = operator; + int i = 1; + while (networkEntryValuesList.contains(uniqueOperator) || + forbiddenEntryValuesList.contains(uniqueOperator)) { + uniqueOperator = operator + "_" + i; + i++; + } if (!networkEntriesList.contains(networkTitle)) { if (CellInfoUtil.isForbidden(cellInfo, mForbiddenPlmns)) { networkTitle += " " + getContext().getResources().getString(R.string.forbidden_network); forbiddenEntriesList.add(networkTitle); - forbiddenEntryValuesList.add(getOperatorNumeric(cellInfo)); + forbiddenEntryValuesList.add(uniqueOperator); forbiddenCellInfos.add(cellInfo); } else { networkEntriesList.add(networkTitle); - networkEntryValuesList.add(getOperatorNumeric(cellInfo)); + networkEntryValuesList.add(uniqueOperator); sortedCellInfos.add(cellInfo); } } |