The wifi list is not null at no signal room

- check the wifi list's size for error message.
- fix the carrier's summary display "connect" at no signal room

Bug: 177390298
Test: atest ProviderModelSliceHelperTest
atest ProviderModelSliceTest

Change-Id: I692aadd01a290cce2438b0d3c084bef8d8d3fa24
This commit is contained in:
SongFerngWang
2021-01-29 15:54:09 +08:00
parent 0b1f51445c
commit 705f1df886
2 changed files with 6 additions and 5 deletions

View File

@@ -131,8 +131,9 @@ public class ProviderModelSlice extends WifiSlice {
}
// Third section: Add the Wi-Fi items which are not connected.
if (wifiList != null) {
log("get Wi-Fi items which are not connected");
if (wifiList != null && wifiList.size() > 0) {
log("get Wi-Fi items which are not connected. Wi-Fi items : " + wifiList.size());
final List<WifiSliceItem> disconnectedWifiList = wifiList.stream()
.filter(wifiSliceItem -> wifiSliceItem.getConnectedState()
!= WifiEntry.CONNECTED_STATE_CONNECTED)
@@ -149,8 +150,8 @@ public class ProviderModelSlice extends WifiSlice {
// 2) show all_network_unavailable:
// - while no wifi item + no carrier
// - while no wifi item + no data capability
if (worker == null || wifiList == null) {
log("wifiList is null");
if (worker == null || wifiList == null || wifiList.size() == 0) {
log("no wifi item");
int resId = R.string.non_carrier_network_unavailable;
if (!hasCarrier || !mHelper.isDataSimActive()) {
log("No carrier item or no carrier data.");

View File

@@ -175,7 +175,7 @@ public class ProviderModelSliceHelper {
}
protected boolean isDataSimActive() {
return MobileNetworkUtils.activeNetworkIsCellular(mContext);
return isNoCarrierData() ? false : MobileNetworkUtils.activeNetworkIsCellular(mContext);
}
protected boolean isNoCarrierData() {