Merge "[Provider Model] Fix Internet preference crash" into sc-dev am: 548569e3eb am: 52394b4245

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/13425304

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic1ebca917ca4657bf72a0e3698723d8bae1d9610
This commit is contained in:
Weng Su
2021-02-01 07:29:50 +00:00
committed by Automerger Merge Worker
2 changed files with 23 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ import android.net.NetworkScoreManager;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.Looper;
import android.telephony.SubscriptionManager;
import androidx.lifecycle.Lifecycle;
import androidx.preference.Preference;
@@ -123,4 +124,13 @@ public class InternetPreferenceControllerTest {
assertThat(mPreference.getSummary()).isEqualTo(TEST_SUMMARY);
}
@Test
public void updateCellularSummary_getNullSubscriptionInfo_shouldNotCrash() {
final SubscriptionManager subscriptionManager = mock(SubscriptionManager.class);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(subscriptionManager);
when(subscriptionManager.getDefaultDataSubscriptionInfo()).thenReturn(null);
mController.updateCellularSummary();
}
}