Fixed network name for about/sim_status

The network name in sim status dialog is not the same as the one in the
about page. This CL use the carrier text which is resolved in
ServiceStateTracker as the network name, this keep the network name sync
with the status bar and the summary of sim status in the about page.

Bug: 31784938
Test: build & manual test
Change-Id: Ia741baabaa98ae447dbedf9e28fd2fda222e6d2e
This commit is contained in:
Pengquan Meng
2019-05-07 14:39:45 -07:00
parent 65a258e2a2
commit 0ab776f69d
2 changed files with 34 additions and 14 deletions

View File

@@ -63,6 +63,7 @@ import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccManager;
@@ -103,6 +104,8 @@ public class SimStatusDialogControllerTest {
private PersistableBundle mPersistableBundle;
@Mock
private EuiccManager mEuiccManager;
@Mock
private SubscriptionManager mSubscriptionManager;
private SimStatusDialogController mController;
private Context mContext;
@@ -123,6 +126,7 @@ public class SimStatusDialogControllerTest {
doReturn(mPhoneStateListener).when(mController).getPhoneStateListener();
doReturn("").when(mController).getPhoneNumber();
doReturn(mSignalStrength).when(mController).getSignalStrength();
doReturn(mSubscriptionInfo).when(mSubscriptionManager).getActiveSubscriptionInfo(anyInt());
when(mEuiccManager.isEnabled()).thenReturn(true);
when(mEuiccManager.getEid()).thenReturn("");
@@ -130,6 +134,7 @@ public class SimStatusDialogControllerTest {
ReflectionHelpers.setField(mController, "mCarrierConfigManager", mCarrierConfigManager);
ReflectionHelpers.setField(mController, "mSubscriptionInfo", mSubscriptionInfo);
ReflectionHelpers.setField(mController, "mEuiccManager", mEuiccManager);
ReflectionHelpers.setField(mController, "mSubscriptionManager", mSubscriptionManager);
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(mPersistableBundle);
final ShadowPackageManager shadowPackageManager =
@@ -141,8 +146,8 @@ public class SimStatusDialogControllerTest {
@Test
public void initialize_updateNetworkProviderWithFoobarCarrier_shouldUpdateCarrierWithFoobar() {
final String carrierName = "foobar";
when(mServiceState.getOperatorAlphaLong()).thenReturn(carrierName);
final CharSequence carrierName = "foobar";
doReturn(carrierName).when(mSubscriptionInfo).getCarrierName();
mController.initialize();