Provider model CarrierItem's subtitle show no connection

CarrierItem's subtitle show no connection when Wi-Fi
off + no service

Bug: 182433548
Test: atest ProviderModelSliceTest
atest ProviderModelSliceHelperTest
atest NetworkProviderWorkerTest
atest InternetConnectivityPanelTest
make RunSettingsRoboTests -j

Change-Id: I04778cf2b184c0a75dc6999ffde011a9ad5e0690
This commit is contained in:
SongFerngWang
2021-03-19 11:25:36 +08:00
parent 48cc107acd
commit fb2a1d9db9
3 changed files with 68 additions and 61 deletions

View File

@@ -24,6 +24,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
@@ -231,6 +232,7 @@ public class ProviderModelSliceHelper {
}
private String getMobileSummary(String networkTypeDescription) {
final WifiManager wifiManager = mContext.getSystemService(WifiManager.class);
String summary = networkTypeDescription;
if (isDataSimActive()) {
summary = mContext.getString(R.string.preference_summary_default_combination,
@@ -238,6 +240,8 @@ public class ProviderModelSliceHelper {
networkTypeDescription);
} else if (!isMobileDataEnabled()) {
summary = mContext.getString(R.string.mobile_data_off_summary);
} else if (!wifiManager.isWifiEnabled() && !isDataSimActive()) {
summary = mContext.getString(R.string.mobile_data_no_connection);
}
return summary;
}