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

Commit 7b8ca397 authored by SongFerngWang's avatar SongFerngWang Committed by Automerger Merge Worker
Browse files

Add the subId chceking before the DB write allowed network type am: 3601a516

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1754899

Change-Id: Ia08066973979a1e057049429a6e3de5fdabfd691
parents 3dae63d9 3601a516
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2410,8 +2410,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     */
    public void setAllowedNetworkTypes(@TelephonyManager.AllowedNetworkTypesReason int reason,
            @TelephonyManager.NetworkTypeBitMask long networkTypes, Message response) {
        int subId = getSubId();
        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;
        }
        String mapAsString = "";
@@ -2422,10 +2427,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                            + mAllowedNetworkTypesForReasons.get(key))
                    .collect(Collectors.joining(","));
        }
        SubscriptionManager.setSubscriptionProperty(getSubId(),
        SubscriptionManager.setSubscriptionProperty(subId,
                SubscriptionManager.ALLOWED_NETWORK_TYPES,
                mapAsString);
        logd("SubId" + getSubId() + ",setAllowedNetworkTypes " + mapAsString);
        logd("setAllowedNetworkTypes: SubId" + subId + ",setAllowedNetworkTypes " + mapAsString);

        updateAllowedNetworkTypes(response);
        notifyAllowedNetworkTypesChanged(reason);