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

Commit 9b7d07ad authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "Add the subId chceking before the DB write allowed network type" into sc-dev

parents 2503a110 7491ff63
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -2404,8 +2404,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     */
     */
    public void setAllowedNetworkTypes(@TelephonyManager.AllowedNetworkTypesReason int reason,
    public void setAllowedNetworkTypes(@TelephonyManager.AllowedNetworkTypesReason int reason,
            @TelephonyManager.NetworkTypeBitMask long networkTypes, Message response) {
            @TelephonyManager.NetworkTypeBitMask long networkTypes, Message response) {
        int subId = getSubId();
        if (!TelephonyManager.isValidAllowedNetworkTypesReason(reason)) {
        if (!TelephonyManager.isValidAllowedNetworkTypesReason(reason)) {
            Rlog.e(LOG_TAG, "Invalid allowed network type reason: " + reason);
            loge("setAllowedNetworkTypes: Invalid allowed network type reason: " + reason);
            return;
        }
        if (!SubscriptionManager.isUsableSubscriptionId(subId)) {
            loge("setAllowedNetworkTypes: Invalid subscriptionId: " + subId);
            return;
            return;
        }
        }
        String mapAsString = "";
        String mapAsString = "";
@@ -2416,10 +2421,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                            + mAllowedNetworkTypesForReasons.get(key))
                            + mAllowedNetworkTypesForReasons.get(key))
                    .collect(Collectors.joining(","));
                    .collect(Collectors.joining(","));
        }
        }
        SubscriptionManager.setSubscriptionProperty(getSubId(),
        SubscriptionManager.setSubscriptionProperty(subId,
                SubscriptionManager.ALLOWED_NETWORK_TYPES,
                SubscriptionManager.ALLOWED_NETWORK_TYPES,
                mapAsString);
                mapAsString);
        logd("SubId" + getSubId() + ",setAllowedNetworkTypes " + mapAsString);
        logd("setAllowedNetworkTypes: SubId" + subId + ",setAllowedNetworkTypes " + mapAsString);


        updateAllowedNetworkTypes(response);
        updateAllowedNetworkTypes(response);
        notifyAllowedNetworkTypesChanged(reason);
        notifyAllowedNetworkTypesChanged(reason);