Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35b47259 authored by SongFerngWang's avatar SongFerngWang
Browse files

Can't show 5GE at summary

The 5GE has HTML tag, so it should do transformation by Html.fromHtml.

Bug: 180053606
Test: atest ProviderModelSliceHelperTest.java
Change-Id: I32ac255d50c52ce853f686ac22572fa1cb44e9cd
parent e74e93b3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
    }

+5 −3
Original line number Diff line number Diff line
@@ -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);