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

Commit d88382cf authored by SongFerngWang's avatar SongFerngWang Committed by Android Build Coastguard Worker
Browse files

The Network name is not same as statusbar at SIM Edit page

Using subscriptionInfo to get the network name.

Bug: 203035698
Bug: 201591202
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=RenameMobileNetworkDialogFragmentTest (PASS)

Change-Id: I84848a2801172b46f7cc3ff39d88ad57e34514a4
(cherry picked from commit 050b6d52)
parent 90ba7e19
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.graphics.Paint;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Bundle;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -52,7 +51,6 @@ import com.android.settingslib.DeviceInfoUtils;

import com.google.common.collect.ImmutableMap;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@@ -180,8 +178,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen

        final TextView operatorName = view.findViewById(R.id.operator_name_value);
        mTelephonyManager = mTelephonyManager.createForSubscriptionId(mSubId);
        final ServiceState serviceState = mTelephonyManager.getServiceState();
        operatorName.setText(serviceState == null ? "" : serviceState.getOperatorAlphaLong());
        operatorName.setText(info.getCarrierName());

        final TextView phoneTitle = view.findViewById(R.id.number_label);
        phoneTitle.setVisibility(info.isOpportunistic() ? View.GONE : View.VISIBLE);
+1 −6
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -73,8 +72,6 @@ public class RenameMobileNetworkDialogFragmentTest {
    @Mock
    private TelephonyManager mTelephonyMgr;
    @Mock
    private ServiceState mServiceState;
    @Mock
    private SubscriptionManager mSubscriptionMgr;
    @Mock
    private SubscriptionInfo mSubscriptionInfo;
@@ -95,11 +92,9 @@ public class RenameMobileNetworkDialogFragmentTest {
        stm.setTelephonyManagerForSubscriptionId(mSubscriptionId, mTelephonyMgr);
        when(mTelephonyMgr.createForSubscriptionId(anyInt())).thenReturn(mTelephonyMgr);

        when(mTelephonyMgr.getServiceState()).thenReturn(mServiceState);
        when(mServiceState.getOperatorAlphaLong()).thenReturn("fake carrier name");

        when(mSubscriptionInfo.getSubscriptionId()).thenReturn(mSubscriptionId);
        when(mSubscriptionInfo.getDisplayName()).thenReturn("test");
        when(mSubscriptionInfo.getCarrierName()).thenReturn("fake carrier name");
        when(mSubscriptionMgr.setDisplayName(any(), anyInt(), anyInt())).thenReturn(0);

        mActivity = spy(Robolectric.buildActivity(FragmentActivity.class).setup().get());