Fix crash when MultipathPolicyTracker cannot get IMSI
Catch the exception when cannot get IMSI to fix races that network establish/tear down is not in-sync with SIM. If this happens, this will be automatically recovered when the next onCapabilitiesChanged event fires. Test: FrameworksNetTests Fix: 212399727 Change-Id: I3877806c0f98d8e7e3a77df75738b1799e4b68d3
This commit is contained in:
@@ -71,7 +71,6 @@ import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -222,8 +221,10 @@ public class MultipathPolicyTracker {
|
||||
"Can't get TelephonyManager for subId %d", mSubId));
|
||||
}
|
||||
|
||||
subscriberId = Objects.requireNonNull(tele.getSubscriberId(),
|
||||
"Null subscriber Id for subId " + mSubId);
|
||||
subscriberId = tele.getSubscriberId();
|
||||
if (subscriberId == null) {
|
||||
throw new IllegalStateException("Null subscriber Id for subId " + mSubId);
|
||||
}
|
||||
mNetworkTemplate = new NetworkTemplate.Builder(NetworkTemplate.MATCH_MOBILE)
|
||||
.setSubscriberIds(Set.of(subscriberId))
|
||||
.setMeteredness(NetworkStats.METERED_YES)
|
||||
|
||||
Reference in New Issue
Block a user