Prevent NullPointerException in SimStatusDialogController
In rare cases the SignalStrength we get for a SIM can be null, which wasn't checked for in this code. This CL adds a null check and fixes the tests so it's possible to verify the fix (one of the methods that would have crashed was being spy'd over unnecessarily). Fixes: 132570076 Test: make RunSettingsRobotests Change-Id: Ifdec24f184ee2d93e5e242eb2c20695249992fc6
This commit is contained in:
@@ -297,6 +297,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
||||
}
|
||||
|
||||
private void updateSignalStrength(SignalStrength signalStrength) {
|
||||
if (signalStrength == null) {
|
||||
return;
|
||||
}
|
||||
final int subscriptionId = mSubscriptionInfo.getSubscriptionId();
|
||||
final PersistableBundle carrierConfig =
|
||||
mCarrierConfigManager.getConfigForSubId(subscriptionId);
|
||||
@@ -430,13 +433,11 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
||||
mSubscriptionInfo.getSubscriptionId());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
int getDbm(SignalStrength signalStrength) {
|
||||
private int getDbm(SignalStrength signalStrength) {
|
||||
return signalStrength.getDbm();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
int getAsuLevel(SignalStrength signalStrength) {
|
||||
private int getAsuLevel(SignalStrength signalStrength) {
|
||||
return signalStrength.getAsuLevel();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user