Adding HAL API for disabling subscription

Bug: 141018421
Test: vts on cuttlefish
Change-Id: I90ded163ddc047916c205513ab77a886ebcc48f7
Merged-In: I90ded163ddc047916c205513ab77a886ebcc48f7
This commit is contained in:
Malcolm Chen 2019-11-12 19:03:12 -08:00
parent cd99e3f2eb
commit fb6d6241c7
9 changed files with 301 additions and 5 deletions

View file

@ -349,7 +349,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.radio</name>
<version>1.4</version>
<version>1.5</version>
<interface>
<name>IRadio</name>
<instance>slot1</instance>

View file

@ -599,10 +599,11 @@ adb0efdf1462e9b2e742c0dcadd598666aac551f178be06e755bfcdf5797abd0 android.hardwar
94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
2d16429145dc1158bf3e45c7de86a39e461dec3ec00512c11a7e5249535a2e96 android.hardware.neuralnetworks@1.3::types
274fb1254a6d1a97824ec5c880eeefc0e410dc6d3a2a4c34052201169d2b7de0 android.hardware.radio@1.5::types
c8e81d912827a5d49b2ddcdc4eb4556c5d231a899a1dca879309e04210daa4a0 android.hardware.radio@1.5::IRadio
a62a93faf173b14a6175b683ebf61ffa568dc61f81e369d2dce7b1265e86cf2f android.hardware.radio@1.5::IRadioIndication
260ce05806d753d728f844d405e832179ed7d9b65986ec18fef3d21cf7285587 android.hardware.radio@1.5::IRadioResponse
4c666aaf3944ad91c2428b8456d0db4a2f81191f8c294f046a2f539e9fc7b6fd android.hardware.radio@1.5::IRadio
3afac66f21a33bc9c4b80481c7d5540038348651d9a7d8af64ea13610af138da android.hardware.radio@1.5::IRadioIndication
70e977f2ccefd2e503bedb3a66313639b53fbc7bde025538b07f41e2292b6624 android.hardware.radio@1.5::IRadioResponse
55f0a15642869ec98a55ea0a5ac049d3e1a6245ff7750deb6bcb7182057eee83 android.hardware.radio.config@1.3::types
b27ab0cd40b0b078cdcd024bfe1061c4c4c065f3519eeb9347fa359a3268a5ae android.hardware.radio.config@1.3::IRadioConfig
742360c775313438b0f82256eac62fb5bbc76a6ae6f388573f3aa142fb2c1eea android.hardware.radio.config@1.3::IRadioConfigIndication
7683fed9d253956071f18b152e6be657719536f98d9b534433d5e411bcde5061 android.hardware.radio.config@1.3::IRadioConfigResponse

View file

@ -55,4 +55,45 @@ interface IRadio extends @1.4::IRadio {
*/
oneway setSignalStrengthReportingCriteria_1_5(int32_t serial,
SignalThresholdInfo signalThresholdInfo, AccessNetwork accessNetwork);
/**
* Enable or disable UiccApplications on the SIM. If disabled:
* - Modem will not register on any network.
* - SIM must be PRESENT, and the IccId of the SIM must still be accessible.
* - The corresponding modem stack is still functional, e.g. able to make emergency calls or
* do network scan.
* By default if this API is not called, the uiccApplications must be enabled automatically.
* It must work for both single SIM and DSDS cases for UX consistency.
* The preference is per SIM, and must be remembered over power cycle, modem reboot, or SIM
* insertion / unplug.
*
* @param serial: Serial number of request.
* @param enable: true if to enable uiccApplications, false to disable.
* Response callback is IRadioResponse.enableUiccApplicationsResponse()
*/
oneway enableUiccApplications(int32_t serial, bool enable);
/**
* Whether uiccApplications are enabled, or disabled.
*
* By default uiccApplications must be enabled, unless enableUiccApplications() with enable
* being false is called.
*
* @param serial Serial number of request.
*
* Response callback is IRadioResponse.areUiccApplicationsEnabledResponse()
*/
oneway areUiccApplicationsEnabled(int32_t serial);
/**
* Query whether disabling and enabling UiccApplications functionality is supported. If not,
* calling enableUiccApplications with a different value will return
* RadioError:REQUEST_NOT_SUPPORTED.
*
* @param serial Serial number of request.
*
* Response callback is IRadioResponse.canToggleUiccApplicationsEnablementResponse()
*/
oneway canToggleUiccApplicationsEnablement(int32_t serial);
};

View file

@ -23,4 +23,11 @@ import @1.4::IRadioIndication;
* Interface declaring unsolicited radio indications.
*/
interface IRadioIndication extends @1.4::IRadioIndication {
/**
* Report change of whether uiccApplications are enabled, or disabled.
*
* @param type Type of radio indication
* @param enabled whether uiccApplications are enabled, or disabled
*/
oneway uiccApplicationsEnablementChanged(RadioIndicationType type, bool enabled);
};

View file

@ -32,4 +32,41 @@ interface IRadioResponse extends @1.4::IRadioResponse {
* RadioError:RADIO_NOT_AVAILABLE
*/
oneway setSignalStrengthReportingCriteriaResponse_1_5(RadioResponseInfo info);
/**
* @param info Response info struct containing response type, serial no. and error
*
* Valid errors returned:
* RadioError:NONE
* RadioError:SIM_ABSENT
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INTERNAL_ERR
* RadioError:BUSY
* RadioError:REQUEST_NOT_SUPPORTED
*/
oneway enableUiccApplicationsResponse(RadioResponseInfo info);
/**
* @param info Response info struct containing response type, serial no. and error
* @param enabled whether Uicc applications are enabled.
*
* Valid errors returned:
* RadioError:NONE
* RadioError:SIM_ABSENT
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
*/
oneway areUiccApplicationsEnabledResponse(RadioResponseInfo info, bool enabled);
/**
* @param info Response info struct containing response type, serial no. and error
* @param canToggle whether toggling UiccApplications functionality is supported.
*
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INTERNAL_ERR
*/
oneway canToggleUiccApplicationsEnablementResponse(RadioResponseInfo info, bool canToggle);
};

View file

@ -276,3 +276,173 @@ TEST_F(RadioHidlTest_v1_5, setSignalStrengthReportingCriteria_1_5_NGRAN_SSSINR)
toString(radioRsp_v1_5->rspInfo.error).c_str());
ASSERT_TRUE(CheckAnyOfErrors(radioRsp_v1_5->rspInfo.error, {RadioError::NONE}));
}
/*
* Test IRadio.enableUiccApplications() for the response returned.
*/
TEST_F(RadioHidlTest_v1_5, togglingUiccApplicationsNotSupported) {
serial = GetRandomSerialNumber();
radio_v1_5->canToggleUiccApplicationsEnablement(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// No error should happen.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Supported case will be tested by other test cases.
if (radioRsp_v1_5->canToggleUiccApplicationsEnablement) return;
// Enabling UiccApplications should still work as it should be enabled by default.
serial = GetRandomSerialNumber();
radio_v1_5->enableUiccApplications(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Disabling UiccApplications should return REQUEST_NOT_SUPPORTED error.
serial = GetRandomSerialNumber();
radio_v1_5->enableUiccApplications(serial, false);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
EXPECT_EQ(RadioError::REQUEST_NOT_SUPPORTED, radioRsp_v1_5->rspInfo.error);
// Query areUiccApplicationsEnabled should return true.
serial = GetRandomSerialNumber();
radio_v1_5->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
ASSERT_TRUE(radioRsp_v1_5->areUiccApplicationsEnabled);
}
/*
* Test IRadio.enableUiccApplications() for the response returned.
* For SIM ABSENT case.
*/
TEST_F(RadioHidlTest_v1_5, togglingUiccApplicationsSupportedSimAbsent) {
serial = GetRandomSerialNumber();
radio_v1_5->canToggleUiccApplicationsEnablement(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// No error should happen.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Not supported case will be tested by togglingUiccApplicationsNotSupported test case.
if (!radioRsp_v1_5->canToggleUiccApplicationsEnablement) return;
// This test case only test SIM ABSENT case.
if (cardStatus.base.base.cardState != CardState::ABSENT) return;
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_v1_5->enableUiccApplications(serial, false);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is absent, RadioError::SIM_ABSENT should be thrown.
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_v1_5->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_v1_5->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is absent, RadioError::SIM_ABSENT should be thrown.
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_v1_5->rspInfo.error);
}
/*
* Test IRadio.enableUiccApplications() for the response returned.
* For SIM PRESENT case.
*/
TEST_F(RadioHidlTest_v1_5, togglingUiccApplicationsSupportedSimPresent) {
serial = GetRandomSerialNumber();
radio_v1_5->canToggleUiccApplicationsEnablement(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// No error should happen.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Not supported case will be tested by disablingUiccApplicationsNotSupported test case.
if (!radioRsp_v1_5->canToggleUiccApplicationsEnablement) return;
// This test case only test SIM ABSENT case.
if (cardStatus.base.base.cardState != CardState::PRESENT) return;
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_v1_5->enableUiccApplications(serial, false);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_v1_5->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
ASSERT_FALSE(radioRsp_v1_5->areUiccApplicationsEnabled);
// Enable Uicc applications.
serial = GetRandomSerialNumber();
radio_v1_5->enableUiccApplications(serial, true);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Query Uicc application enablement.
serial = GetRandomSerialNumber();
radio_v1_5->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// As SIM is present, there shouldn't be error.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
ASSERT_TRUE(radioRsp_v1_5->areUiccApplicationsEnabled);
}
/*
* Test IRadio.areUiccApplicationsEnabled() for the response returned.
*/
TEST_F(RadioHidlTest_v1_5, areUiccApplicationsEnabled) {
serial = GetRandomSerialNumber();
radio_v1_5->canToggleUiccApplicationsEnablement(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// No error should happen.
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
// Not supported case will be tested by togglingUiccApplicationsNotSupported test case.
if (!radioRsp_v1_5->canToggleUiccApplicationsEnablement) return;
// Disable Uicc applications.
serial = GetRandomSerialNumber();
radio_v1_5->areUiccApplicationsEnabled(serial);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
// If SIM is absent, RadioError::SIM_ABSENT should be thrown. Otherwise there shouldn't be any
// error.
if (cardStatus.base.base.cardState == CardState::ABSENT) {
EXPECT_EQ(RadioError::SIM_ABSENT, radioRsp_v1_5->rspInfo.error);
} else if (cardStatus.base.base.cardState == CardState::PRESENT) {
EXPECT_EQ(RadioError::NONE, radioRsp_v1_5->rspInfo.error);
}
}

View file

@ -80,6 +80,12 @@ class RadioResponse_v1_5 : public ::android::hardware::radio::V1_5::IRadioRespon
::android::hardware::radio::V1_4::CarrierRestrictionsWithPriority carrierRestrictionsResp;
::android::hardware::radio::V1_4::SimLockMultiSimPolicy multiSimPolicyResp;
// Whether toggling uicc applications operation is supported.
bool canToggleUiccApplicationsEnablement;
// Whether Uicc applications are enabled or not.
bool areUiccApplicationsEnabled;
RadioResponse_v1_5(RadioHidlTest_v1_5& parent_v1_5);
virtual ~RadioResponse_v1_5() = default;
@ -524,6 +530,10 @@ class RadioResponse_v1_5 : public ::android::hardware::radio::V1_5::IRadioRespon
/* 1.5 Api */
Return<void> setSignalStrengthReportingCriteriaResponse_1_5(const RadioResponseInfo& info);
Return<void> enableUiccApplicationsResponse(const RadioResponseInfo& info);
Return<void> areUiccApplicationsEnabledResponse(const RadioResponseInfo& info, bool enabled);
Return<void> canToggleUiccApplicationsEnablementResponse(const RadioResponseInfo& info,
bool canToggle);
};
/* Callback class for radio indication */
@ -535,6 +545,9 @@ class RadioIndication_v1_5 : public ::android::hardware::radio::V1_5::IRadioIndi
RadioIndication_v1_5(RadioHidlTest_v1_5& parent_v1_5);
virtual ~RadioIndication_v1_5() = default;
/* 1.5 Api */
Return<void> uiccApplicationsEnablementChanged(RadioIndicationType type, bool enabled);
/* 1.4 Api */
Return<void> currentEmergencyNumberList(
RadioIndicationType type,

View file

@ -328,3 +328,8 @@ Return<void> RadioIndication_v1_5::modemReset(RadioIndicationType /*type*/,
const ::android::hardware::hidl_string& /*reason*/) {
return Void();
}
Return<void> RadioIndication_v1_5::uiccApplicationsEnablementChanged(RadioIndicationType /*type*/,
bool /*enabled*/) {
return Void();
}

View file

@ -892,4 +892,26 @@ Return<void> RadioResponse_v1_5::setSignalStrengthReportingCriteriaResponse_1_5(
rspInfo = info;
parent_v1_5.notify(info.serial);
return Void();
}
}
Return<void> RadioResponse_v1_5::enableUiccApplicationsResponse(const RadioResponseInfo& info) {
rspInfo = info;
parent_v1_5.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_5::areUiccApplicationsEnabledResponse(const RadioResponseInfo& info,
bool enabled) {
rspInfo = info;
areUiccApplicationsEnabled = enabled;
parent_v1_5.notify(info.serial);
return Void();
}
Return<void> RadioResponse_v1_5::canToggleUiccApplicationsEnablementResponse(
const RadioResponseInfo& info, bool canToggle) {
rspInfo = info;
canToggleUiccApplicationsEnablement = canToggle;
parent_v1_5.notify(info.serial);
return Void();
}