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

Commit d944798c authored by SongFerngWang's avatar SongFerngWang
Browse files

Rename AllowedNetworkType to AllowedNetworkTypes

Reference the ag/q/topic:%22b_171791177%22+(status:open%20OR%20status:merged)
and ag/q/topic:"getAllowedNetworkTypeBitmap"+(status:open%20OR%20status:merged)

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


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


        Rlog.d(LOG_TAG, "setAllowedNetworkTypes: modemRaf = " + modemRaf
        Rlog.d(LOG_TAG, "setAllowedNetworkTypes: modemRaf = " + modemRaf
                + " filteredRaf = " + filteredRaf);
                + " 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);
        mCi.setPreferredNetworkType(RadioAccessFamily.getNetworkTypeFromRaf(filteredRaf), response);
        mPreferredNetworkTypeRegistrants.notifyRegistrants();
        mPreferredNetworkTypeRegistrants.notifyRegistrants();
    }
    }
@@ -2467,11 +2467,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
    /**
     * Get the cached value of the preferred network type setting
     * Get the cached value of the preferred network type setting
     */
     */
    public int getCachedPreferredNetworkType() {
    public int getCachedAllowedNetworkTypesBitmask() {
        if (mCi != null && mCi instanceof BaseCommands) {
        if (mCi != null && mCi instanceof BaseCommands) {
            return ((BaseCommands) mCi).mPreferredNetworkType;
            return ((BaseCommands) mCi).mAllowedNetworkTypesBitmask;
        } else {
        } else {
            return RILConstants.PREFERRED_NETWORK_MODE;
            return RadioAccessFamily.getRafFromNetworkType(RILConstants.PREFERRED_NETWORK_MODE);
        }
        }
    }
    }


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


                    Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkModes[i]));
                    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);
                            cdmaSubscription, i);
                }
                }
                HalVersion radioHalVersion;
                HalVersion radioHalVersion;
@@ -288,7 +289,8 @@ public class PhoneFactory {


            int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
            int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
            for (int i = prevActiveModemCount; i < activeModemCount; i++) {
            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);
                        cdmaSubscription, i);
                sPhones[i] = createPhone(context, i);
                sPhones[i] = createPhone(context, i);
                if (context.getPackageManager().hasSystemFeature(
                if (context.getPackageManager().hasSystemFeature(
+14 −15
Original line number Original line Diff line number Diff line
@@ -656,22 +656,22 @@ public class RIL extends BaseCommands implements CommandsInterface {
    //***** Constructors
    //***** Constructors


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


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


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


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


            android.hardware.radio.V1_6.IRadio radioProxy16 =
            android.hardware.radio.V1_6.IRadio radioProxy16 =
                    (android.hardware.radio.V1_6.IRadio) radioProxy;
                    (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);
                    mRILDefaultWorkSource);


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

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


            android.hardware.radio.V1_6.IRadio radioProxy16 =
            android.hardware.radio.V1_6.IRadio radioProxy16 =
                    (android.hardware.radio.V1_6.IRadio) radioProxy;
                    (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);
                    mRILDefaultWorkSource);


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


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