Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37ffc3a2 authored by junyulai's avatar junyulai
Browse files

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
parent e2b00d3a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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)