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

Commit 4f59a2a1 authored by Michele Berionne's avatar Michele Berionne Committed by Michele
Browse files

Carrier restriction enhancements for Android Q

Add support for dual SIM to carrier restrictions.
Add support to exclude specific carriers in the list of carrier
restrictions.

Bug: 120313541
Test: Created test application to verify correct functionality.
Change-Id: Ib05267fda5f2fd0b8821a5812fcf47d460e60a2b
parent 1e9f52b1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ hidl_interface {
    types: [
        "AccessNetwork",
        "CardStatus",
        "CarrierRestrictionsWithPriority",
        "CellConfigLte",
        "CellInfo",
        "CellInfoLte",
@@ -37,14 +38,15 @@ hidl_interface {
        "FrequencyRange",
        "LteVopsInfo",
        "NetworkScanResult",
        "NrIndicators",
        "PdpProtocolType",
        "PhysicalChannelConfig",
        "RadioAccessFamily",
        "RadioCapability",
        "RadioFrequencyInfo",
        "RadioTechnology",
        "NrIndicators",
        "SetupDataCallResult",
        "SimLockMultiSimPolicy",
    ],
    gen_java: true,
}
+32 −0
Original line number Diff line number Diff line
@@ -21,10 +21,12 @@ import @1.2::DataRequestReason;
import @1.2::NetworkScanRequest;
import @1.3::IRadio;
import @1.4::AccessNetwork;
import @1.4::CarrierRestrictionsWithPriority;
import @1.4::DataProfileInfo;
import @1.4::EmergencyCallRouting;
import @1.4::EmergencyServiceCategory;
import @1.4::RadioAccessFamily;
import @1.4::SimLockMultiSimPolicy;

/**
 * This interface is used by telephony and telecom to talk to cellular radio.
@@ -167,4 +169,34 @@ interface IRadio extends @1.3::IRadio {
     */
    oneway setPreferredNetworkTypeBitmap(
            int32_t serial, bitfield<RadioAccessFamily> networkTypeBitmap);

    /**
     * Set carrier restrictions. Expected modem behavior:
     *  If never receives this command:
     *  - Must allow all carriers
     *  Receives this command:
     *  - Only allow carriers specified in carriers. The restriction persists across power cycles
     *    and FDR. If a present SIM is allowed, modem must not reload the SIM. If a present SIM is
     *    *not* allowed, modem must detach from the registered network and only keep emergency
     *    service, and notify Android SIM refresh reset with new SIM state being
     *    CardState:RESTRICTED. Emergency service must be enabled.
     *
     * @param serial Serial number of request.
     * @param carriers CarrierRestrictionsWithPriority consisting allowed and excluded carriers
     *        as defined in types.hal
     * @param multiSimPolicy Policy to be used for devices with multiple SIMs.
     *
     * Response callback is IRadioResponse.setAllowedCarriersResponse()
     */
    oneway setAllowedCarriers_1_4(int32_t serial, CarrierRestrictionsWithPriority carriers,
            SimLockMultiSimPolicy multiSimPolicy);

    /**
     * Get carrier restrictions.
     *
     * @param serial Serial number of request.
     *
     * Response callback is IRadioResponse.getAllowedCarriersResponse_1_3()
     */
    oneway getAllowedCarriers_1_4(int32_t serial);
};
+34 −0
Original line number Diff line number Diff line
@@ -18,6 +18,13 @@ package android.hardware.radio@1.4;

import @1.0::RadioResponseInfo;
import @1.3::IRadioResponse;
import @1.4::CardStatus;
import @1.4::CarrierRestrictionsWithPriority;
import @1.4::CellInfo;
import @1.4::DataRegStateResult;
import @1.4::RadioAccessFamily;
import @1.4::SetupDataCallResult;
import @1.4::SimLockMultiSimPolicy;

/**
 * Interface declaring response functions to solicited radio requests.
@@ -181,4 +188,31 @@ interface IRadioResponse extends @1.3::IRadioResponse {
     *   RadioError:SIM_ABSENT
     */
    oneway setupDataCallResponse_1_4(RadioResponseInfo info, SetupDataCallResult dcResponse);

    /**
     * @param info Response info struct containing response type, serial no. and error
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:INVALID_ARGUMENTS
     *   RadioError:REQUEST_NOT_SUPPORTED
     */
    oneway setAllowedCarriersResponse_1_4(RadioResponseInfo info);

    /**
     * Expected modem behavior:
     *  Return list of allowed carriers, and if all carriers are allowed.
     *
     * @param info Response info struct containing response type, serial no. and error
     * @param carriers Carrier restriction information.
     * @param multiSimPolicy Policy used for devices with multiple SIM cards.
     *
     * Valid errors returned:
     *   RadioError:NONE
     *   RadioError:RADIO_NOT_AVAILABLE
     *   RadioError:REQUEST_NOT_SUPPORTED
     */
    oneway getAllowedCarriersResponse_1_4(RadioResponseInfo info,
            CarrierRestrictionsWithPriority carriers, SimLockMultiSimPolicy multiSimPolicy);
};
+36 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.radio@1.4;

import @1.0::ApnAuthType;
import @1.0::ApnTypes;
import @1.0::Carrier;
import @1.0::CellInfoType;
import @1.0::DataCallFailCause;
import @1.0::DataProfileId;
@@ -1719,3 +1720,38 @@ struct SetupDataCallResult {
     */
    int32_t mtu;
};

enum SimLockMultiSimPolicy : int32_t {
    /**
     * Indicates that configuration applies to each slot independently.
     */
    NO_MULTISIM_POLICY = 0,
    /**
     * Indicates that any SIM card can be used as far as one valid card is present in the device.
     * For the modem, a SIM card is valid when its content (i.e. MCC, MNC, GID, SPN) matches the
     * carrier restriction configuration.
     */
    ONE_VALID_SIM_MUST_BE_PRESENT = 1,
};

struct CarrierRestrictionsWithPriority {
    /**
     * List of allowed carriers.
     * The character '?' is used as wildcard character to match any value.
     */
    vec<Carrier> allowedCarriers;
    /**
     * List of excluded carriers.
     * The character '?' is used as wildcard character to match any value.
     */
    vec<Carrier> excludedCarriers;
    /**
     * True means that only carriers included in the allowed list and not in the excluded list
     * are permitted. Eg. allowedCarriers match mcc/mnc, excludedCarriers has same mcc/mnc and
     * gid1 is ABCD. It means except the carrier whose gid1 is ABCD, all carriers with the
     * same mcc/mnc are allowed.
     * False means that all carriers are allowed except those included in the excluded list
     * and not in the allowed list.
     */
    bool allowedCarriersPrioritized;
};