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

Commit a7c05570 authored by SongFerng Wang's avatar SongFerng Wang Committed by Android (Google) Code Review
Browse files

Merge "Add device's NR information into PhoneCapability"

parents 912c9ba4 88f98a52
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ public class CellularNetworkValidator {
     */
    public boolean isValidationFeatureSupported() {
        return PhoneConfigurationManager.getInstance().getCurrentPhoneCapability()
                .validationBeforeSwitchSupported;
                .isNetworkValidationBeforeSwitchSupported();
    }

    @VisibleForTesting
+2 −2
Original line number Diff line number Diff line
@@ -367,7 +367,7 @@ public class PhoneConfigurationManager {
    }

    public int getNumberOfModemsWithSimultaneousDataConnections() {
        return mStaticCapability.maxActiveData;
        return mStaticCapability.getMaxActiveInternetData();
    }

    private void notifyCapabilityChanged() {
@@ -382,7 +382,7 @@ public class PhoneConfigurationManager {
     */
    public void switchMultiSimConfig(int numOfSims) {
        log("switchMultiSimConfig: with numOfSims = " + numOfSims);
        if (getStaticPhoneCapability().logicalModemList.size() < numOfSims) {
        if (getStaticPhoneCapability().getLogicalModemList().size() < numOfSims) {
            log("switchMultiSimConfig: Phone is not capable of enabling "
                    + numOfSims + " sims, exiting!");
            return;
+20 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

package com.android.internal.telephony;

import static android.telephony.PhoneCapability.DEVICE_NR_CAPABILITY_NONE;
import static android.telephony.PhoneCapability.DEVICE_NR_CAPABILITY_NSA;
import static android.telephony.PhoneCapability.DEVICE_NR_CAPABILITY_SA;

import static com.android.internal.telephony.RILConstants.RADIO_NOT_AVAILABLE;
import static com.android.internal.telephony.RILConstants.REQUEST_NOT_SUPPORTED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES;
@@ -79,6 +83,7 @@ public class RadioConfig extends Handler {
    private final SparseArray<RILRequest> mRequestList = new SparseArray<RILRequest>();
    /* default work source which will blame phone process */
    private final WorkSource mDefaultWorkSource;
    private final int mDeviceNrCapability;
    private static RadioConfig sRadioConfig;

    protected Registrant mSimSlotStatusRegistrant;
@@ -103,6 +108,14 @@ public class RadioConfig extends Handler {

        mDefaultWorkSource = new WorkSource(context.getApplicationInfo().uid,
                context.getPackageName());

        boolean is5gStandalone = context.getResources().getBoolean(
                com.android.internal.R.bool.config_telephony5gStandalone);
        boolean is5gNonStandalone = context.getResources().getBoolean(
                com.android.internal.R.bool.config_telephony5gNonStandalone);
        mDeviceNrCapability =
                (is5gStandalone ? DEVICE_NR_CAPABILITY_SA : DEVICE_NR_CAPABILITY_NONE) | (
                        is5gNonStandalone ? DEVICE_NR_CAPABILITY_NSA : DEVICE_NR_CAPABILITY_NONE);
    }

    /**
@@ -539,6 +552,13 @@ public class RadioConfig extends Handler {
        }
    }

    /**
     * Returns the device's nr capability.
     */
    public int getDeviceNrCapability() {
        return mDeviceNrCapability;
    }

    static ArrayList<IccSlotStatus> convertHalSlotStatus(
            ArrayList<android.hardware.radio.config.V1_0.SimSlotStatus> halSlotStatusList) {
        ArrayList<IccSlotStatus> response = new ArrayList<IccSlotStatus>(halSlotStatusList.size());
+2 −3
Original line number Diff line number Diff line
@@ -123,7 +123,6 @@ public class RadioConfigResponse extends IRadioConfigResponse.Stub {
        // TODO b/121394331: clean up V1_1.PhoneCapability fields.
        int maxActiveVoiceCalls = 0;
        int maxActiveData = phoneCapability.maxActiveData;
        int max5G = 0;
        boolean validationBeforeSwitchSupported = phoneCapability.isInternetLingeringSupported;
        List<ModemInfo> logicalModemList = new ArrayList();

@@ -132,8 +131,8 @@ public class RadioConfigResponse extends IRadioConfigResponse.Stub {
            logicalModemList.add(new ModemInfo(modemInfo.modemId));
        }

        return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, max5G, logicalModemList,
                validationBeforeSwitchSupported);
        return new PhoneCapability(maxActiveVoiceCalls, maxActiveData, logicalModemList,
                validationBeforeSwitchSupported, mRadioConfig.getDeviceNrCapability());
    }
    /**
     * Response function for IRadioConfig.getPhoneCapability().
+2 −2
Original line number Diff line number Diff line
@@ -57,9 +57,9 @@ import org.mockito.Mock;
public class CellularNetworkValidatorTest extends TelephonyTest {
    private CellularNetworkValidator mValidatorUT;
    private static final PhoneCapability CAPABILITY_WITH_VALIDATION_SUPPORTED =
            new PhoneCapability(1, 1, 0, null, true);
            new PhoneCapability(1, 1, null, true, PhoneCapability.DEVICE_NR_CAPABILITY_NONE);
    private static final PhoneCapability CAPABILITY_WITHOUT_VALIDATION_SUPPORTED =
            new PhoneCapability(1, 1, 0, null, false);
            new PhoneCapability(1, 1, null, false, PhoneCapability.DEVICE_NR_CAPABILITY_NONE);
    private final CellIdentityLte mCellIdentityLte1 = new CellIdentityLte(123, 456, 0, 0, 111);
    private final CellIdentityLte mCellIdentityLte2 = new CellIdentityLte(321, 654, 0, 0, 222);
    @Mock
Loading