Merge "[Settings] Connected carrier should not be forbidden ones" into sc-dev
This commit is contained in:
@@ -105,13 +105,20 @@ public class NetworkOperatorPreference extends Preference {
|
|||||||
return mCellId.equals(CellInfoUtil.getCellIdentity(cellinfo));
|
return mCellId.equals(CellInfoUtil.getCellIdentity(cellinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true when this preference is for forbidden network
|
||||||
|
*/
|
||||||
|
public boolean isForbiddenNetwork() {
|
||||||
|
return ((mForbiddenPlmns != null) && mForbiddenPlmns.contains(getOperatorNumeric()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the NetworkOperatorPreference by updating the title and the icon.
|
* Refresh the NetworkOperatorPreference by updating the title and the icon.
|
||||||
*/
|
*/
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
String networkTitle = getOperatorName();
|
String networkTitle = getOperatorName();
|
||||||
|
|
||||||
if ((mForbiddenPlmns != null) && mForbiddenPlmns.contains(getOperatorNumeric())) {
|
if (isForbiddenNetwork()) {
|
||||||
if (DBG) Log.d(TAG, "refresh forbidden network: " + networkTitle);
|
if (DBG) Log.d(TAG, "refresh forbidden network: " + networkTitle);
|
||||||
networkTitle += " "
|
networkTitle += " "
|
||||||
+ getContext().getResources().getString(R.string.forbidden_network);
|
+ getContext().getResources().getString(R.string.forbidden_network);
|
||||||
|
@@ -414,19 +414,30 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
if (networkList == null || networkList.size() == 0) {
|
if (networkList == null || networkList.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Due to the aggregation of cell between carriers, it's possible to get CellIdentity
|
||||||
|
// containing forbidden PLMN.
|
||||||
|
// Getting current network from ServiceState is no longer a good idea.
|
||||||
|
// Add an additional rule to avoid from showing forbidden PLMN to the user.
|
||||||
|
if (mForbiddenPlmns == null) {
|
||||||
|
updateForbiddenPlmns();
|
||||||
|
}
|
||||||
for (NetworkRegistrationInfo regInfo : networkList) {
|
for (NetworkRegistrationInfo regInfo : networkList) {
|
||||||
final CellIdentity cellIdentity = regInfo.getCellIdentity();
|
final CellIdentity cellIdentity = regInfo.getCellIdentity();
|
||||||
if (cellIdentity != null) {
|
if (cellIdentity == null) {
|
||||||
final NetworkOperatorPreference pref = new NetworkOperatorPreference(
|
continue;
|
||||||
getPrefContext(), cellIdentity, mForbiddenPlmns, mShow4GForLTE);
|
|
||||||
pref.setSummary(R.string.network_connected);
|
|
||||||
// Update the signal strength icon, since the default signalStrength value
|
|
||||||
// would be zero
|
|
||||||
// (it would be quite confusing why the connected network has no signal)
|
|
||||||
pref.setIcon(SignalStrength.NUM_SIGNAL_STRENGTH_BINS - 1);
|
|
||||||
mPreferenceCategory.addPreference(pref);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
final NetworkOperatorPreference pref = new NetworkOperatorPreference(
|
||||||
|
getPrefContext(), cellIdentity, mForbiddenPlmns, mShow4GForLTE);
|
||||||
|
if (pref.isForbiddenNetwork()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pref.setSummary(R.string.network_connected);
|
||||||
|
// Update the signal strength icon, since the default signalStrength value
|
||||||
|
// would be zero
|
||||||
|
// (it would be quite confusing why the connected network has no signal)
|
||||||
|
pref.setIcon(SignalStrength.NUM_SIGNAL_STRENGTH_BINS - 1);
|
||||||
|
mPreferenceCategory.addPreference(pref);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user