Merge "Can't show 5GE at summary" into sc-dev

This commit is contained in:
SongFerng Wang
2021-02-19 09:24:12 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions

View File

@@ -29,6 +29,7 @@ import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
@@ -141,7 +142,7 @@ public class ProviderModelSliceHelper {
.setTitleItem(levelIcon, ListBuilder.ICON_IMAGE)
.addEndItem(toggleAction)
.setPrimaryAction(primaryAction)
.setSubtitle(summary);
.setSubtitle(Html.fromHtml(summary, Html.FROM_HTML_MODE_LEGACY));
return rowBuilder;
}

View File

@@ -40,6 +40,7 @@ import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.Html;
import androidx.slice.Slice;
import androidx.slice.builders.GridRowBuilder;
@@ -169,7 +170,7 @@ public class ProviderModelSliceHelperTest {
@Test
public void createCarrierRow_hasDdsAndActiveNetworkIsNotCellular_verifyTitleAndSummary() {
String expectDisplayName = "Name1";
String expectedSubtitle = "5G";
CharSequence expectedSubtitle = Html.fromHtml("5G", Html.FROM_HTML_MODE_LEGACY);
String networkType = "5G";
final int defaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();
@@ -199,8 +200,9 @@ public class ProviderModelSliceHelperTest {
String networkType = "5G";
String connectedText = ResourcesUtils.getResourcesString(mContext,
"mobile_data_connection_active");
String expectedSubtitle = ResourcesUtils.getResourcesString(mContext,
"preference_summary_default_combination", connectedText, networkType);
CharSequence expectedSubtitle = Html.fromHtml(ResourcesUtils.getResourcesString(mContext,
"preference_summary_default_combination", connectedText, networkType),
Html.FROM_HTML_MODE_LEGACY);
final int defaultDataSubId = SubscriptionManager.getDefaultDataSubscriptionId();
when(mDefaultDataSubscriptionInfo.getSubscriptionId()).thenReturn(defaultDataSubId);