SubscriptionsPreferenceController shows the unique sim description.

Bug: 148303118
Bug: 150370656
Test: atest -c SubscriptionsPreferenceControllerTest
Change-Id: I041536fe0148087a068c6000383b382b0ff4e17c
This commit is contained in:
Jeremy Goldman
2021-01-15 16:32:07 +08:00
parent 8e2ecd5918
commit 9d87cd9126
33 changed files with 153 additions and 71 deletions

View File

@@ -62,6 +62,7 @@ import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import com.android.settings.R;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import org.junit.Before;
@@ -73,6 +74,8 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import java.util.Arrays;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowAlertDialogCompat.class)
public class SimSelectNotificationTest {
@@ -117,6 +120,7 @@ public class SimSelectNotificationTest {
.thenReturn(mNotificationManager);
when(mContext.getSystemService(Context.TELEPHONY_SERVICE))
.thenReturn(mTelephonyManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE))
.thenReturn(mSubscriptionManager);
when(mContext.getApplicationInfo()).thenReturn(new ApplicationInfo());
@@ -126,8 +130,10 @@ public class SimSelectNotificationTest {
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
when(mTelephonyManager.isDataEnabledForApn(TYPE_MMS)).thenReturn(false);
SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(mSubInfo));
when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
when(mSubscriptionManager.getActiveSubscriptionInfo(mSubId)).thenReturn(mSubInfo);
when(mSubInfo.getSubscriptionId()).thenReturn(mSubId);
when(mSubInfo.getDisplayName()).thenReturn(mFakeDisplayName);
when(mContext.getResources()).thenReturn(mResources);