diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp index 32f9712ee4..9fd037434d 100644 --- a/radio/1.4/Android.bp +++ b/radio/1.4/Android.bp @@ -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, } diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal index b0810a4422..3fe608f880 100644 --- a/radio/1.4/IRadio.hal +++ b/radio/1.4/IRadio.hal @@ -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 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); }; diff --git a/radio/1.4/IRadioResponse.hal b/radio/1.4/IRadioResponse.hal index a58a5c1a12..77aad03730 100644 --- a/radio/1.4/IRadioResponse.hal +++ b/radio/1.4/IRadioResponse.hal @@ -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); }; diff --git a/radio/1.4/types.hal b/radio/1.4/types.hal index cdfde9e9ee..cfeaaf6860 100644 --- a/radio/1.4/types.hal +++ b/radio/1.4/types.hal @@ -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; @@ -1720,3 +1721,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 allowedCarriers; + /** + * List of excluded carriers. + * The character '?' is used as wildcard character to match any value. + */ + vec 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; +};