Merge "[Provider Model] Fix Internet preference crash" into sc-dev
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user