Loading services/core/java/com/android/server/net/NetworkPolicyManagerService.java +37 −26 Original line number Original line Diff line number Diff line Loading @@ -1207,10 +1207,14 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final TelephonyManager tele = TelephonyManager.from(mContext); final TelephonyManager tele = TelephonyManager.from(mContext); // avoid creating policy when SIM isn't ready for (int pid = 0; pid < tele.getPhoneCount(); pid++) { if (!isDdsSimStateReady()) return; long[] subIds = SubscriptionManager.getSubId(pid); if ((subIds == null || subIds.length == 0) || !isSimStateReady(pid)) { continue; } final String subscriberId = tele.getSubscriberId(SubscriptionManager.getDefaultDataSubId()); final String subscriberId = tele.getSubscriberId(subIds[0]); final NetworkIdentity probeIdent = new NetworkIdentity( final NetworkIdentity probeIdent = new NetworkIdentity( TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false); TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false); Loading Loading @@ -1243,6 +1247,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { addNetworkPolicyLocked(policy); addNetworkPolicyLocked(policy); } } } } } private void readPolicyLocked() { private void readPolicyLocked() { if (LOGV) Slog.v(TAG, "readPolicyLocked()"); if (LOGV) Slog.v(TAG, "readPolicyLocked()"); Loading Loading @@ -2269,4 +2274,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { int slotId = SubscriptionManager.getSlotId(SubscriptionManager.getDefaultDataSubId()); int slotId = SubscriptionManager.getSlotId(SubscriptionManager.getDefaultDataSubId()); return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; } } // Return true if SIM state of input subscription is in READY state private boolean isSimStateReady(int slotId) { final TelephonyManager tm = TelephonyManager.from(mContext); return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; } } } Loading
services/core/java/com/android/server/net/NetworkPolicyManagerService.java +37 −26 Original line number Original line Diff line number Diff line Loading @@ -1207,10 +1207,14 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final TelephonyManager tele = TelephonyManager.from(mContext); final TelephonyManager tele = TelephonyManager.from(mContext); // avoid creating policy when SIM isn't ready for (int pid = 0; pid < tele.getPhoneCount(); pid++) { if (!isDdsSimStateReady()) return; long[] subIds = SubscriptionManager.getSubId(pid); if ((subIds == null || subIds.length == 0) || !isSimStateReady(pid)) { continue; } final String subscriberId = tele.getSubscriberId(SubscriptionManager.getDefaultDataSubId()); final String subscriberId = tele.getSubscriberId(subIds[0]); final NetworkIdentity probeIdent = new NetworkIdentity( final NetworkIdentity probeIdent = new NetworkIdentity( TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false); TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_UNKNOWN, subscriberId, null, false); Loading Loading @@ -1243,6 +1247,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { addNetworkPolicyLocked(policy); addNetworkPolicyLocked(policy); } } } } } private void readPolicyLocked() { private void readPolicyLocked() { if (LOGV) Slog.v(TAG, "readPolicyLocked()"); if (LOGV) Slog.v(TAG, "readPolicyLocked()"); Loading Loading @@ -2269,4 +2274,10 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { int slotId = SubscriptionManager.getSlotId(SubscriptionManager.getDefaultDataSubId()); int slotId = SubscriptionManager.getSlotId(SubscriptionManager.getDefaultDataSubId()); return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; } } // Return true if SIM state of input subscription is in READY state private boolean isSimStateReady(int slotId) { final TelephonyManager tm = TelephonyManager.from(mContext); return tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY; } } }