Make sure manual selected network is shown in next search result.
When user want to manually select a cellular network, modem searches
available networks and return a list to NetworkSelectListPreference.
We need to make sure that if user selects a network, it will shown
as "chosen" next time user opens it again.
But challenge is, every time user opens this preference the available
networks will be different. For each network, we used to use index as
their "value" which will be later determined which was previous choice.
Now instead of relative index which changes every time, we use MCCMNC
as value since they are unique, so that however available network list
changes, it will show user's previous choice correctly.
Bug: 72029476
Test: manual
Change-Id: Ib559dbaa0da07150cfd85f395cdfd8a4399977cb
diff --git a/src/com/android/phone/NetworkSelectListPreference.java b/src/com/android/phone/NetworkSelectListPreference.java
index cc54b09..c2ed1ae 100644
--- a/src/com/android/phone/NetworkSelectListPreference.java
+++ b/src/com/android/phone/NetworkSelectListPreference.java
@@ -411,7 +411,7 @@
String networkTitle = getNetworkTitle(cellInfo);
if (!networkEntriesList.contains(networkTitle)) {
networkEntriesList.add(networkTitle);
- networkEntryValuesList.add(Integer.toString(networkEntriesList.size() + 1));
+ networkEntryValuesList.add(getOperatorNumeric(cellInfo));
}
}
setEntries(networkEntriesList.toArray(new CharSequence[networkEntriesList.size()]));
@@ -510,6 +510,16 @@
}
/**
+ * Returns the operator numeric (MCCMNC) obtained in the manual search.
+ *
+ * @param cellInfo contains the information of the network.
+ * @return MCCMNC string.
+ */
+ private String getOperatorNumeric(CellInfo cellInfo) {
+ return getOperatorInfoFromCellInfo(cellInfo).getOperatorNumeric();
+ }
+
+ /**
* Wrap a cell info into an operator info.
*/
private OperatorInfo getOperatorInfoFromCellInfo(CellInfo cellInfo) {