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

Commit 7491ff63 authored by SongFerngWang's avatar SongFerngWang
Browse files

Add the subId chceking before the DB write allowed network type

Bug: 185264531
Test: Build pass

Change-Id: Ie0dd29e39e218454ae0b8e7bcd4ceced9347941b
parent f89b0b17
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2404,8 +2404,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 = "";
@@ -2416,10 +2421,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);