Loading radio/1.6/IRadio.hal +39 −0 Original line number Diff line number Diff line Loading @@ -544,4 +544,43 @@ interface IRadio extends @1.5::IRadio { * as the input param. */ oneway setCarrierInfoForImsiEncryption_1_6(int32_t serial, @1.6::ImsiEncryptionInfo imsiEncryptionInfo); /** * Get the local and global phonebook records from the SIM card. * This should be called again after a simPhonebookChanged notification is received. * * The phonebook records are received via IRadioIndication.simPhonebookRecordsReceived() * * @param serial Serial number of request. * * Response callback is IRadioResponse.getSimPhonebookRecordsResponse() */ oneway getSimPhonebookRecords(int32_t serial); /** * Get the phone book capacity * * @param serial Serial number of request. * * Response function is defined from IRadioResponse.getSimPhonebookCapacityResponse() */ oneway getSimPhonebookCapacity(int32_t serial); /** * Insert, delete or update a phonebook record on the SIM card. * If the index of recordInfo is 0, the phonebook record will be added to global or * local phonebook, and global phonebook has higher priority than local phonebook. * * If the fields in the recordInfo are all empty except for the index, the phonebook * record specified by the index will be deleted. * * The indication simPhonebookChanged will be called after every successful call of * updateSimPhonebookRecords. * * @param serial Serial number of request. * @param recordInfo Details of the record to insert, delete or update. * * Response callback is IRadioResponse.updateSimPhonebookRecordsResponse() */ oneway updateSimPhonebookRecords(int32_t serial, PhonebookRecordInfo recordInfo); }; radio/1.6/IRadioIndication.hal +25 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,9 @@ import @1.6::LinkCapacityEstimate; import @1.6::NetworkScanResult; import @1.6::SignalStrength; import @1.6::SetupDataCallResult; import @1.6::PbReceivedStatus; import @1.6::PhysicalChannelConfig; import @1.6::PhonebookRecordInfo; /** * Interface declaring unsolicited radio indications. Loading Loading @@ -72,7 +74,6 @@ interface IRadioIndication extends @1.5::IRadioIndication { */ oneway currentLinkCapacityEstimate_1_6(RadioIndicationType type, LinkCapacityEstimate lce); /** * Indicates current signal strength of the radio. * Loading Loading @@ -113,4 +114,27 @@ interface IRadioIndication extends @1.5::IRadioIndication { */ oneway currentPhysicalChannelConfigs_1_6(RadioIndicationType type, vec<PhysicalChannelConfig> configs); /** * Indicates whether SIM phonebook is changed. * * This indication is sent whenever the SIM phonebook is changed, including SIM is * inserted or removed and updated by IRadio.updateSimPhonebookRecords. * * @param type Type of radio indication */ oneway simPhonebookChanged(RadioIndicationType type); /** * Indicates the content of all the used records in the SIM phonebook. * * This indication is associated with the API getSimPhonebookRecords and * might be received more than once that is replying on the record count. * * @param type Type of radio indication * @param status Status of PbReceivedStatus * @param records Vector of PhonebookRecordInfo */ oneway simPhonebookRecordsReceived(RadioIndicationType type, PbReceivedStatus status, vec<PhonebookRecordInfo> records); }; radio/1.6/IRadioResponse.hal +54 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import @1.6::RadioResponseInfo; import @1.6::SetupDataCallResult; import @1.6::SignalStrength; import @1.6::SlicingConfig; import @1.6::PhonebookCapacity; /** * Interface declaring response functions to solicited radio requests. Loading Loading @@ -436,4 +437,57 @@ interface IRadioResponse extends @1.5::IRadioResponse { */ oneway getSlicingConfigResponse(RadioResponseInfo info, SlicingConfig slicingConfig); /** * @param info Response info struct containing response type, serial no. and error * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway getSimPhonebookRecordsResponse(RadioResponseInfo info); /** * @param info Response info struct containing response type, serial no. and error * @param capacity Response capacity enum indicating response processing status * * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway getSimPhonebookCapacityResponse(RadioResponseInfo info, PhonebookCapacity capacity); /** * @param info Response info struct containing response type, serial no. and error * @param updatedRecordIndex The index of the updated or inserted record in the phonebook and * the minimum value is 1 * * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:SIM_ERR * RadioError:NO_SUCH_ENTRY * RadioError:NO_RESOURCES * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway updateSimPhonebookRecordsResponse(RadioResponseInfo info, int32_t updatedRecordIndex); }; radio/1.6/types.hal +103 −0 Original line number Diff line number Diff line Loading @@ -1104,3 +1104,106 @@ struct ImsiEncryptionInfo { @1.1::ImsiEncryptionInfo base; PublicKeyType keyType; // Public key type }; /** * Phonebook-record-information specified by EF_ADN(Abbreviated dialing numbers) * record of SIM as per 3GPP spec 31.102 v15 Section-4.4.2.3. */ struct PhonebookRecordInfo { /** Record index. 0 is used to insert a record */ uint32_t recordId; /** Alpha identifier, empty string if no value */ string name; /** Dialling number, empty string if no value */ string number; /** Email addresses */ vec<string> emails; /** Additional numbers */ vec<string> additionalNumbers; }; struct PhonebookCapacity { /** * Maximum number of ADN records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdnRecords; /** * Used ADN records in the SIM phonebook * Needs to be non-negative */ int32_t usedAdnRecords; /** * Maximum email records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxEmailRecords; /** * Used email records in the SIM phonebook * Needs to be non-negative */ int32_t usedEmailRecords; /** * Maximum additional number records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdditionalNumberRecords; /** * Used additional number records in the SIM phonebook * Needs to be non-negative */ int32_t usedAdditionalNumberRecords; /** * Maximum name length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxNameLen; /** * Maximum number length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxNumberLen; /** * Maximum email length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxEmailLen; /** * Maximum additional number length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdditionalNumberLen; }; /** * Enum representing the status of the received PB indication, * PB_RECEIVED_OK indicates this retrieval is fine * PB_RECEIVED_ERROR indicates one error happens, in general, the process * can't be restored soon. * PB_RECEIVED_ABORT indicates the process is interrupted, in this case, * modem might need resources and interrupt the current process, or it is * timed out to receive all indications, and client can retry soon. * PB_RECEIVED_FINAL indicates the whole process is finished with a full * chunk of phonebook data, means this is a last indication with the left * data. */ enum PbReceivedStatus : int32_t { PB_RECEIVED_OK = 1, PB_RECEIVED_ERROR = 2, PB_RECEIVED_ABORT = 3, PB_RECEIVED_FINAL = 4, }; radio/1.6/vts/functional/radio_hidl_hal_api.cpp +138 −0 Original line number Diff line number Diff line Loading @@ -737,3 +737,141 @@ TEST_P(RadioHidlTest_v1_6, setCarrierInfoForImsiEncryption_1_6) { ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED})); } } /* * Test IRadio.getSimPhonebookRecords() for the response returned. */ TEST_F(RadioHidlTest_v1_6, getSimPhonebookRecords) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookRecords(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } } /* * Test IRadio.getSimPhonebookCapacity for the response returned. */ TEST_P(RadioHidlTest_v1_6, getSimPhonebookCapacity) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); ::android::hardware::radio::V1_6::PhonebookCapacity pbCapacity = radioRsp_v1_6->capacity; if(pbCapacity.maxAdnRecords > 0) { EXPECT_TRUE(pbCapacity.maxNameLen > 0 && pbCapacity.maxNumberLen > 0); EXPECT_TRUE(pbCapacity.usedAdnRecords <= pbCapacity.maxAdnRecords); } if(pbCapacity.maxEmailRecords > 0) { EXPECT_TRUE(pbCapacity.maxEmailLen > 0); EXPECT_TRUE(pbCapacity.usedEmailRecords <= pbCapacity.maxEmailRecords); } if(pbCapacity.maxAdditionalNumberRecords > 0) { EXPECT_TRUE(pbCapacity.maxAdditionalNumberLen > 0); EXPECT_TRUE(pbCapacity.usedAdditionalNumberRecords <= pbCapacity.maxAdditionalNumberRecords); } } } /* * Test IRadio.updateSimPhonebookRecords() for the response returned. */ TEST_F(RadioHidlTest_v1_6, updateSimPhonebookRecords) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); ::android::hardware::radio::V1_6::PhonebookCapacity pbCapacity = radioRsp_v1_6->capacity; serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookRecords(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); if(pbCapacity.maxAdnRecords > 0 && pbCapacity.usedAdnRecords < pbCapacity.maxAdnRecords) { // Add a phonebook record PhonebookRecordInfo recordInfo; recordInfo.recordId = 0; recordInfo.name = "ABC"; recordInfo.number = "1234567890"; serial = GetRandomSerialNumber(); radio_v1_6->updateSimPhonebookRecords(serial, recordInfo); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); int index = radioRsp_v1_6->updatedRecordIndex; EXPECT_TRUE(index > 0); // Deleted a phonebook record recordInfo.recordId = index; recordInfo.name = ""; recordInfo.number = ""; serial = GetRandomSerialNumber(); radio_v1_6->updateSimPhonebookRecords(serial, recordInfo); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); } } } Loading
radio/1.6/IRadio.hal +39 −0 Original line number Diff line number Diff line Loading @@ -544,4 +544,43 @@ interface IRadio extends @1.5::IRadio { * as the input param. */ oneway setCarrierInfoForImsiEncryption_1_6(int32_t serial, @1.6::ImsiEncryptionInfo imsiEncryptionInfo); /** * Get the local and global phonebook records from the SIM card. * This should be called again after a simPhonebookChanged notification is received. * * The phonebook records are received via IRadioIndication.simPhonebookRecordsReceived() * * @param serial Serial number of request. * * Response callback is IRadioResponse.getSimPhonebookRecordsResponse() */ oneway getSimPhonebookRecords(int32_t serial); /** * Get the phone book capacity * * @param serial Serial number of request. * * Response function is defined from IRadioResponse.getSimPhonebookCapacityResponse() */ oneway getSimPhonebookCapacity(int32_t serial); /** * Insert, delete or update a phonebook record on the SIM card. * If the index of recordInfo is 0, the phonebook record will be added to global or * local phonebook, and global phonebook has higher priority than local phonebook. * * If the fields in the recordInfo are all empty except for the index, the phonebook * record specified by the index will be deleted. * * The indication simPhonebookChanged will be called after every successful call of * updateSimPhonebookRecords. * * @param serial Serial number of request. * @param recordInfo Details of the record to insert, delete or update. * * Response callback is IRadioResponse.updateSimPhonebookRecordsResponse() */ oneway updateSimPhonebookRecords(int32_t serial, PhonebookRecordInfo recordInfo); };
radio/1.6/IRadioIndication.hal +25 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,9 @@ import @1.6::LinkCapacityEstimate; import @1.6::NetworkScanResult; import @1.6::SignalStrength; import @1.6::SetupDataCallResult; import @1.6::PbReceivedStatus; import @1.6::PhysicalChannelConfig; import @1.6::PhonebookRecordInfo; /** * Interface declaring unsolicited radio indications. Loading Loading @@ -72,7 +74,6 @@ interface IRadioIndication extends @1.5::IRadioIndication { */ oneway currentLinkCapacityEstimate_1_6(RadioIndicationType type, LinkCapacityEstimate lce); /** * Indicates current signal strength of the radio. * Loading Loading @@ -113,4 +114,27 @@ interface IRadioIndication extends @1.5::IRadioIndication { */ oneway currentPhysicalChannelConfigs_1_6(RadioIndicationType type, vec<PhysicalChannelConfig> configs); /** * Indicates whether SIM phonebook is changed. * * This indication is sent whenever the SIM phonebook is changed, including SIM is * inserted or removed and updated by IRadio.updateSimPhonebookRecords. * * @param type Type of radio indication */ oneway simPhonebookChanged(RadioIndicationType type); /** * Indicates the content of all the used records in the SIM phonebook. * * This indication is associated with the API getSimPhonebookRecords and * might be received more than once that is replying on the record count. * * @param type Type of radio indication * @param status Status of PbReceivedStatus * @param records Vector of PhonebookRecordInfo */ oneway simPhonebookRecordsReceived(RadioIndicationType type, PbReceivedStatus status, vec<PhonebookRecordInfo> records); };
radio/1.6/IRadioResponse.hal +54 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import @1.6::RadioResponseInfo; import @1.6::SetupDataCallResult; import @1.6::SignalStrength; import @1.6::SlicingConfig; import @1.6::PhonebookCapacity; /** * Interface declaring response functions to solicited radio requests. Loading Loading @@ -436,4 +437,57 @@ interface IRadioResponse extends @1.5::IRadioResponse { */ oneway getSlicingConfigResponse(RadioResponseInfo info, SlicingConfig slicingConfig); /** * @param info Response info struct containing response type, serial no. and error * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway getSimPhonebookRecordsResponse(RadioResponseInfo info); /** * @param info Response info struct containing response type, serial no. and error * @param capacity Response capacity enum indicating response processing status * * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway getSimPhonebookCapacityResponse(RadioResponseInfo info, PhonebookCapacity capacity); /** * @param info Response info struct containing response type, serial no. and error * @param updatedRecordIndex The index of the updated or inserted record in the phonebook and * the minimum value is 1 * * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:SIM_ERR * RadioError:NO_SUCH_ENTRY * RadioError:NO_RESOURCES * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ oneway updateSimPhonebookRecordsResponse(RadioResponseInfo info, int32_t updatedRecordIndex); };
radio/1.6/types.hal +103 −0 Original line number Diff line number Diff line Loading @@ -1104,3 +1104,106 @@ struct ImsiEncryptionInfo { @1.1::ImsiEncryptionInfo base; PublicKeyType keyType; // Public key type }; /** * Phonebook-record-information specified by EF_ADN(Abbreviated dialing numbers) * record of SIM as per 3GPP spec 31.102 v15 Section-4.4.2.3. */ struct PhonebookRecordInfo { /** Record index. 0 is used to insert a record */ uint32_t recordId; /** Alpha identifier, empty string if no value */ string name; /** Dialling number, empty string if no value */ string number; /** Email addresses */ vec<string> emails; /** Additional numbers */ vec<string> additionalNumbers; }; struct PhonebookCapacity { /** * Maximum number of ADN records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdnRecords; /** * Used ADN records in the SIM phonebook * Needs to be non-negative */ int32_t usedAdnRecords; /** * Maximum email records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxEmailRecords; /** * Used email records in the SIM phonebook * Needs to be non-negative */ int32_t usedEmailRecords; /** * Maximum additional number records possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdditionalNumberRecords; /** * Used additional number records in the SIM phonebook * Needs to be non-negative */ int32_t usedAdditionalNumberRecords; /** * Maximum name length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxNameLen; /** * Maximum number length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxNumberLen; /** * Maximum email length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxEmailLen; /** * Maximum additional number length possible in the SIM phonebook * Needs to be non-negative */ int32_t maxAdditionalNumberLen; }; /** * Enum representing the status of the received PB indication, * PB_RECEIVED_OK indicates this retrieval is fine * PB_RECEIVED_ERROR indicates one error happens, in general, the process * can't be restored soon. * PB_RECEIVED_ABORT indicates the process is interrupted, in this case, * modem might need resources and interrupt the current process, or it is * timed out to receive all indications, and client can retry soon. * PB_RECEIVED_FINAL indicates the whole process is finished with a full * chunk of phonebook data, means this is a last indication with the left * data. */ enum PbReceivedStatus : int32_t { PB_RECEIVED_OK = 1, PB_RECEIVED_ERROR = 2, PB_RECEIVED_ABORT = 3, PB_RECEIVED_FINAL = 4, };
radio/1.6/vts/functional/radio_hidl_hal_api.cpp +138 −0 Original line number Diff line number Diff line Loading @@ -737,3 +737,141 @@ TEST_P(RadioHidlTest_v1_6, setCarrierInfoForImsiEncryption_1_6) { ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED})); } } /* * Test IRadio.getSimPhonebookRecords() for the response returned. */ TEST_F(RadioHidlTest_v1_6, getSimPhonebookRecords) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookRecords(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } } /* * Test IRadio.getSimPhonebookCapacity for the response returned. */ TEST_P(RadioHidlTest_v1_6, getSimPhonebookCapacity) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); ::android::hardware::radio::V1_6::PhonebookCapacity pbCapacity = radioRsp_v1_6->capacity; if(pbCapacity.maxAdnRecords > 0) { EXPECT_TRUE(pbCapacity.maxNameLen > 0 && pbCapacity.maxNumberLen > 0); EXPECT_TRUE(pbCapacity.usedAdnRecords <= pbCapacity.maxAdnRecords); } if(pbCapacity.maxEmailRecords > 0) { EXPECT_TRUE(pbCapacity.maxEmailLen > 0); EXPECT_TRUE(pbCapacity.usedEmailRecords <= pbCapacity.maxEmailRecords); } if(pbCapacity.maxAdditionalNumberRecords > 0) { EXPECT_TRUE(pbCapacity.maxAdditionalNumberLen > 0); EXPECT_TRUE(pbCapacity.usedAdditionalNumberRecords <= pbCapacity.maxAdditionalNumberRecords); } } } /* * Test IRadio.updateSimPhonebookRecords() for the response returned. */ TEST_F(RadioHidlTest_v1_6, updateSimPhonebookRecords) { serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookCapacity(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); if (cardStatus.base.base.base.cardState == CardState::ABSENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::INVALID_SIM_STATE, ::android::hardware::radio::V1_6::RadioError::RADIO_NOT_AVAILABLE, ::android::hardware::radio::V1_6::RadioError::MODEM_ERR, ::android::hardware::radio::V1_6::RadioError::INVALID_ARGUMENTS, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } else if (cardStatus.base.base.base.cardState == CardState::PRESENT) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_v1_6->rspInfo.error, {::android::hardware::radio::V1_6::RadioError::NONE, ::android::hardware::radio::V1_6::RadioError::REQUEST_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); ::android::hardware::radio::V1_6::PhonebookCapacity pbCapacity = radioRsp_v1_6->capacity; serial = GetRandomSerialNumber(); radio_v1_6->getSimPhonebookRecords(serial); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); if(pbCapacity.maxAdnRecords > 0 && pbCapacity.usedAdnRecords < pbCapacity.maxAdnRecords) { // Add a phonebook record PhonebookRecordInfo recordInfo; recordInfo.recordId = 0; recordInfo.name = "ABC"; recordInfo.number = "1234567890"; serial = GetRandomSerialNumber(); radio_v1_6->updateSimPhonebookRecords(serial, recordInfo); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); int index = radioRsp_v1_6->updatedRecordIndex; EXPECT_TRUE(index > 0); // Deleted a phonebook record recordInfo.recordId = index; recordInfo.name = ""; recordInfo.number = ""; serial = GetRandomSerialNumber(); radio_v1_6->updateSimPhonebookRecords(serial, recordInfo); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_6->rspInfo.type); EXPECT_EQ(serial, radioRsp_v1_6->rspInfo.serial); EXPECT_EQ(::android::hardware::radio::V1_6::RadioError::NONE, radioRsp_v1_6->rspInfo.error); } } }