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

Commit 257b6ecf authored by SongFerng Wang's avatar SongFerng Wang Committed by Gerrit Code Review
Browse files

Merge "Rename AllowedNetworkType to AllowedNetworkTypes"

parents 47cce2a6 d944798c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ public abstract class BaseCommands implements CommandsInterface {
    // This is used when establishing a connection to the
    // vendor ril so it starts up in the correct mode.
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    protected int mPreferredNetworkType;
    protected int mAllowedNetworkTypesBitmask;
    // CDMA subscription received from PhoneFactory
    protected int mCdmaSubscription;
    // Type of Phone, GSM or CDMA. Set by GsmCdmaPhone.
+1 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation;
import android.telephony.CarrierConfigManager;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.RadioAccessFamily;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
@@ -382,7 +381,7 @@ public class NetworkTypeController extends StateMachine {

    private @Annotation.OverrideNetworkType int getNrDisplayType() {
        // Don't show 5G icon if preferred network type does not include 5G
        if ((RadioAccessFamily.getRafFromNetworkType(mPhone.getCachedPreferredNetworkType())
        if ((mPhone.getCachedAllowedNetworkTypesBitmask()
                & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
            return TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        }
+4 −4
Original line number Diff line number Diff line
@@ -2428,7 +2428,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

        Rlog.d(LOG_TAG, "setAllowedNetworkTypes: modemRaf = " + modemRaf
                + " filteredRaf = " + filteredRaf);
        //TODO: Change to setAllowedNetworkTypeBitmap after 1.6 HAL is ready.
        //TODO: Change to setAllowedNetworkTypesBitmap after 1.6 HAL is ready.
        mCi.setPreferredNetworkType(RadioAccessFamily.getNetworkTypeFromRaf(filteredRaf), response);
        mPreferredNetworkTypeRegistrants.notifyRegistrants();
    }
@@ -2467,11 +2467,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Get the cached value of the preferred network type setting
     */
    public int getCachedPreferredNetworkType() {
    public int getCachedAllowedNetworkTypesBitmask() {
        if (mCi != null && mCi instanceof BaseCommands) {
            return ((BaseCommands) mCi).mPreferredNetworkType;
            return ((BaseCommands) mCi).mAllowedNetworkTypesBitmask;
        } else {
            return RILConstants.PREFERRED_NETWORK_MODE;
            return RadioAccessFamily.getRafFromNetworkType(RILConstants.PREFERRED_NETWORK_MODE);
        }
    }

+4 −2
Original line number Diff line number Diff line
@@ -171,7 +171,8 @@ public class PhoneFactory {
                    networkModes[i] = RILConstants.PREFERRED_NETWORK_MODE;

                    Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkModes[i]));
                    sCommandsInterfaces[i] = new RIL(context, networkModes[i],
                    sCommandsInterfaces[i] = new RIL(context,
                            RadioAccessFamily.getRafFromNetworkType(networkModes[i]),
                            cdmaSubscription, i);
                }
                HalVersion radioHalVersion;
@@ -288,7 +289,8 @@ public class PhoneFactory {

            int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
            for (int i = prevActiveModemCount; i < activeModemCount; i++) {
                sCommandsInterfaces[i] = new RIL(context, RILConstants.PREFERRED_NETWORK_MODE,
                sCommandsInterfaces[i] = new RIL(context, RadioAccessFamily.getRafFromNetworkType(
                        RILConstants.PREFERRED_NETWORK_MODE),
                        cdmaSubscription, i);
                sPhones[i] = createPhone(context, i);
                if (context.getPackageManager().hasSystemFeature(
+14 −15
Original line number Diff line number Diff line
@@ -659,22 +659,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
    //***** Constructors

    @UnsupportedAppUsage
    public RIL(Context context, int preferredNetworkType, int cdmaSubscription) {
        this(context, preferredNetworkType, cdmaSubscription, null);
    public RIL(Context context, int allowedNetworkTypes, int cdmaSubscription) {
        this(context, allowedNetworkTypes, cdmaSubscription, null);
    }

    @UnsupportedAppUsage
    public RIL(Context context, int preferredNetworkType,
    public RIL(Context context, int allowedNetworkTypes,
            int cdmaSubscription, Integer instanceId) {
        super(context);
        if (RILJ_LOGD) {
            riljLog("RIL: init preferredNetworkType=" + preferredNetworkType
            riljLog("RIL: init allowedNetworkTypes=" + allowedNetworkTypes
                    + " cdmaSubscription=" + cdmaSubscription + ")");
        }

        mContext = context;
        mCdmaSubscription  = cdmaSubscription;
        mPreferredNetworkType = preferredNetworkType;
        mAllowedNetworkTypesBitmask = allowedNetworkTypes;
        mPhoneType = RILConstants.NO_PHONE;
        mPhoneId = instanceId == null ? 0 : instanceId;
        if (isRadioBugDetectionEnabled()) {
@@ -3319,7 +3319,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
                        + " networkType = " + networkType);
            }
            mPreferredNetworkType = networkType;
            mAllowedNetworkTypesBitmask = RadioAccessFamily.getRafFromNetworkType(networkType);
            mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
@@ -3327,8 +3327,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                        (android.hardware.radio.V1_4.IRadio) radioProxy;
                try {
                    radioProxy14.setPreferredNetworkTypeBitmap(
                            rr.mSerial, convertToHalRadioAccessFamily(
                                    RadioAccessFamily.getRafFromNetworkType(networkType)));
                            rr.mSerial, convertToHalRadioAccessFamily(mAllowedNetworkTypesBitmask));
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setPreferredNetworkTypeBitmap", e);
                }
@@ -3522,15 +3521,15 @@ public class RIL extends BaseCommands implements CommandsInterface {

            android.hardware.radio.V1_6.IRadio radioProxy16 =
                    (android.hardware.radio.V1_6.IRadio) radioProxy;
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_NETWORK_TYPE_BITMAP, result,
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_NETWORK_TYPES_BITMAP, result,
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
            }

            mAllowedNetworkTypesBitmask = networkTypeBitmask;
            try {
                radioProxy16.setAllowedNetworkTypeBitmap(rr.mSerial, networkTypeBitmask);
                radioProxy16.setAllowedNetworkTypesBitmap(rr.mSerial, networkTypeBitmask);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setAllowedNetworkTypeBitmask", e);
            }
@@ -3552,7 +3551,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

            android.hardware.radio.V1_6.IRadio radioProxy16 =
                    (android.hardware.radio.V1_6.IRadio) radioProxy;
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_NETWORK_TYPE_BITMAP, result,
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP, result,
                    mRILDefaultWorkSource);

            if (RILJ_LOGD) {
@@ -3560,7 +3559,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                radioProxy16.getAllowedNetworkTypeBitmap(rr.mSerial);
                radioProxy16.getAllowedNetworkTypesBitmap(rr.mSerial);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "getAllowedNetworkTypeBitmask", e);
            }
@@ -6930,9 +6929,9 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_CANCEL_HANDOVER";
            case RIL_REQUEST_SET_DATA_THROTTLING:
                return "RIL_REQUEST_SET_DATA_THROTTLING";
            case RIL_REQUEST_SET_ALLOWED_NETWORK_TYPE_BITMAP:
            case RIL_REQUEST_SET_ALLOWED_NETWORK_TYPES_BITMAP:
                return "RIL_REQUEST_SET_ALLOWED_NETWORK_TYPE_BITMAP";
            case RIL_REQUEST_GET_ALLOWED_NETWORK_TYPE_BITMAP:
            case RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP:
                return "RIL_REQUEST_GET_ALLOWED_NETWORK_TYPE_BITMAP";
            default: return "<unknown request>";
        }
Loading