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

Commit cd531da8 authored by calvinpan's avatar calvinpan Committed by Brad Ebinger
Browse files

Redesign the setPreferredNetworkType

1. Support get/setSubscriptionProperty() for allowed network types.
2. That SubscriptionInfoUpdater call TelephonyManager API to prevent
that set the network type to modem and not AND with allowed network
types.

Bug: 136730709
Test: By Manual
1. setAllowedNetwork to disable 5G
2. setPreferredNetworkTypeBitmask to set NR_LTE_GSM_WCDMA
3. framework set LTE_GSM_WCDMA to modem
Merged-In: I3198131246e3206e856457d336fbead46340a24b
Change-Id: I3198131246e3206e856457d336fbead46340a24b
parent 141b5bf9
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2670,6 +2670,9 @@ public class SubscriptionController extends ISub.Stub {
            case SubscriptionManager.WFC_IMS_ROAMING_ENABLED:
            case SubscriptionManager.WFC_IMS_ROAMING_ENABLED:
                value.put(propKey, Integer.parseInt(propValue));
                value.put(propKey, Integer.parseInt(propValue));
                break;
                break;
            case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                value.put(propKey, Long.parseLong(propValue));
                break;
            default:
            default:
                if (DBG) logd("Invalid column name");
                if (DBG) logd("Invalid column name");
                break;
                break;
@@ -2739,6 +2742,7 @@ public class SubscriptionController extends ISub.Stub {
                        case SubscriptionManager.IS_OPPORTUNISTIC:
                        case SubscriptionManager.IS_OPPORTUNISTIC:
                        case SubscriptionManager.GROUP_UUID:
                        case SubscriptionManager.GROUP_UUID:
                        case SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES:
                        case SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES:
                        case SubscriptionManager.ALLOWED_NETWORK_TYPES:
                            resultValue = cursor.getString(0);
                            resultValue = cursor.getString(0);
                            break;
                            break;
                        default:
                        default:
+14 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ import android.service.euicc.EuiccProfileInfo;
import android.service.euicc.EuiccService;
import android.service.euicc.EuiccService;
import android.service.euicc.GetEuiccProfileInfoListResult;
import android.service.euicc.GetEuiccProfileInfoListResult;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
import android.telephony.RadioAccessFamily;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
@@ -55,6 +55,7 @@ import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Pair;
import android.util.Pair;


import com.android.telephony.Rlog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.euicc.EuiccController;
import com.android.internal.telephony.euicc.EuiccController;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.metrics.TelephonyMetrics;
@@ -556,6 +557,18 @@ public class SubscriptionInfoUpdater extends Handler {
                    }
                    }


                    // Set the modem network mode
                    // Set the modem network mode
                    long allowedNetworkTypes = -1;
                    try {
                        allowedNetworkTypes = Long.parseLong(
                                SubscriptionController.getInstance().getSubscriptionProperty(subId,
                                        SubscriptionManager.ALLOWED_NETWORK_TYPES));
                    } catch (NumberFormatException err) {
                        logd("NumberFormat exception");
                    }

                    long networkTypeBitMask = RadioAccessFamily.getRafFromNetworkType(networkType);
                    networkType = RadioAccessFamily.getNetworkTypeFromRaf(
                            (int) (networkTypeBitMask & allowedNetworkTypes));
                    PhoneFactory.getPhone(phoneId).setPreferredNetworkType(networkType, null);
                    PhoneFactory.getPhone(phoneId).setPreferredNetworkType(networkType, null);


                    // Only support automatic selection mode on SIM change.
                    // Only support automatic selection mode on SIM change.