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

Commit 1fff63c2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Add network policy for each sub on powerup"

parents 19dbb0ba 04237c1a
Loading
Loading
Loading
Loading
+37 −26
Original line number Original line Diff line number Diff line
@@ -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);


@@ -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()");
@@ -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;
    }
}
}