[Provider model] Show a string on internet picker when mobile data off

- https://screenshot.googleplex.com/6JE9ma6UZmGCNFQ

Bug: 178680922
Test: Manual test passed
Test: atest passed
Change-Id: Id276e3f97b4380f648eb9e35ca7780a0ba32bdb2
This commit is contained in:
tom hsu
2021-02-05 22:42:58 +08:00
parent fcdd955dff
commit 00798a5902
2 changed files with 45 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.util.ArraySet;
import androidx.annotation.VisibleForTesting;
@@ -255,14 +256,17 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
mUpdateListener.onChildrenUpdated();
}
private String getMobilePreferenceSummary(int subId) {
private CharSequence getMobilePreferenceSummary(int subId) {
String result = mSubsPrefCtrlInjector.getNetworkType(
mContext, mConfig, mTelephonyDisplayInfo, subId);
if (!mTelephonyManager.isDataEnabled()) {
return mContext.getString(R.string.mobile_data_off_summary);
}
if (!result.isEmpty() && mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext)) {
result = mContext.getString(R.string.preference_summary_default_combination,
mContext.getString(R.string.mobile_data_connection_active), result);
}
return result;
return Html.fromHtml(result, Html.FROM_HTML_MODE_LEGACY);
}
private Drawable getIcon(int subId) {