Merge "show network selection notification based on nw signal" into pi-dev
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 9f4767a..4e69d34 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -616,24 +616,37 @@
PhoneFactory.getPhone(phoneId) : PhoneFactory.getDefaultPhone();
if (TelephonyCapabilities.supportsNetworkSelection(phone)) {
if (SubscriptionManager.isValidSubscriptionId(subId)) {
- // get the shared preference of network_selection.
- // empty is auto mode, otherwise it is the operator alpha name
- // in case there is no operator name, check the operator numeric
- SharedPreferences sp =
- PreferenceManager.getDefaultSharedPreferences(mContext);
- String networkSelection =
- sp.getString(Phone.NETWORK_SELECTION_NAME_KEY + subId, "");
- if (TextUtils.isEmpty(networkSelection)) {
- networkSelection =
- sp.getString(Phone.NETWORK_SELECTION_KEY + subId, "");
+ // if restoring manual selection is controlled by framework, then get network
+ // selection from shared preference, otherwise get from real network indicators.
+ boolean restoreSelection = !mContext.getResources().getBoolean(
+ com.android.internal.R.bool.skip_restoring_network_selection);
+ String selectedNetworkOperatorName;
+ boolean isManualSelection;
+ if (restoreSelection) {
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
+ selectedNetworkOperatorName =
+ sp.getString(Phone.NETWORK_SELECTION_NAME_KEY + subId, "");
+ // get the shared preference of network_selection.
+ // empty is auto mode, otherwise it is the operator alpha name
+ // in case there is no operator name, check the operator numeric
+ if (TextUtils.isEmpty(selectedNetworkOperatorName)) {
+ selectedNetworkOperatorName =
+ sp.getString(Phone.NETWORK_SELECTION_KEY + subId, "");
+ }
+ isManualSelection = !TextUtils.isEmpty(selectedNetworkOperatorName);
+ } else {
+ selectedNetworkOperatorName = phone.getServiceStateTracker().mSS
+ .getOperatorAlpha();
+ isManualSelection = phone.getServiceStateTracker().mSS.getIsManualSelection();
}
- if (DBG) log("updateNetworkSelection()..." + "state = " +
- serviceState + " new network " + networkSelection);
+ if (DBG) {
+ log("updateNetworkSelection()..." + "state = " + serviceState + " new network "
+ + (isManualSelection ? selectedNetworkOperatorName : ""));
+ }
- if (serviceState == ServiceState.STATE_OUT_OF_SERVICE
- && !TextUtils.isEmpty(networkSelection)) {
- showNetworkSelection(networkSelection, subId);
+ if (serviceState == ServiceState.STATE_OUT_OF_SERVICE && isManualSelection) {
+ showNetworkSelection(selectedNetworkOperatorName, subId);
mSelectedUnavailableNotify = true;
} else {
if (mSelectedUnavailableNotify) {