From c279cafa2883f8cccbfd756cb187f48760f6eea6 Mon Sep 17 00:00:00 2001 From: Jordan Liu Date: Wed, 21 Oct 2020 16:28:40 -0700 Subject: [PATCH] Update CardState HAL and make setSimPower synchronous Bug: 171433370 Test: make; make vts Change-Id: I0d298209a00f5f194547b0d6e368baa44b0c18ec --- current.txt | 2 +- radio/1.0/types.hal | 8 +++- radio/1.6/IRadio.hal | 37 +++++++++++++++++++ radio/1.6/IRadioResponse.hal | 16 ++++++++ .../functional/radio_hidl_hal_utils_v1_6.h | 3 ++ radio/1.6/vts/functional/radio_response.cpp | 7 ++++ 6 files changed, 70 insertions(+), 3 deletions(-) diff --git a/current.txt b/current.txt index 27b2310d43..7ef176bab0 100644 --- a/current.txt +++ b/current.txt @@ -773,7 +773,7 @@ a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardwar cd84ab19c590e0e73dd2307b591a3093ee18147ef95e6d5418644463a6620076 android.hardware.neuralnetworks@1.2::IDevice 9625e85f56515ad2cf87b6a1847906db669f746ea4ab02cd3d4ca25abc9b0109 android.hardware.neuralnetworks@1.2::types 9e758e208d14f7256e0885d6d8ad0b61121b21d8c313864f981727ae55bffd16 android.hardware.neuralnetworks@1.3::types -7da2707d4cf93818eaf8038eb65e2180116a399c310e594a00935c5c981aa340 android.hardware.radio@1.0::types +0f53d70e1eadf8d987766db4bf6ae2048004682168f4cab118da576787def3fa android.hardware.radio@1.0::types 38d65fb20c60a5b823298560fc0825457ecdc49603a4b4e94bf81511790737da android.hardware.radio@1.4::types 954c334efd80e8869b66d1ce5fe2755712d96ba4b3c38d415739c330af5fb4cb android.hardware.radio@1.5::types diff --git a/radio/1.0/types.hal b/radio/1.0/types.hal index 025aa7ccca..cafa5a62d1 100644 --- a/radio/1.0/types.hal +++ b/radio/1.0/types.hal @@ -166,11 +166,15 @@ enum RestrictedState : int32_t { }; enum CardState : int32_t { + /* card is physically absent from device. (Some old modems use CardState.ABSENT when the SIM + is powered off. This is no longer correct, however the platform will still support this + legacy behavior.) */ ABSENT, + /* card is inserted in the device */ PRESENT, ERROR, - RESTRICTED, // card is present but not usable due to carrier - // restrictions + /* card is present but not usable due to carrier restrictions */ + RESTRICTED, }; enum PinState : int32_t { diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal index ca40a17b24..66007b48ac 100644 --- a/radio/1.6/IRadio.hal +++ b/radio/1.6/IRadio.hal @@ -19,6 +19,7 @@ package android.hardware.radio@1.6; import @1.0::CdmaSmsMessage; import @1.0::GsmSmsMessage; +import @1.1::CardPowerState; import @1.2::DataRequestReason; import @1.5::IRadio; import @1.5::AccessNetwork; @@ -182,6 +183,42 @@ interface IRadio extends @1.5::IRadio { */ oneway sendCdmaSmsExpectMore_1_6(int32_t serial, CdmaSmsMessage sms); + /** + * Set SIM card power state. + * Request is used to power off or power on the card. It should not generate + * a CardState.CARDSTATE_ABSENT indication, since the SIM is still physically + * inserted. + * + * @param serial Serial number of request + * @param powerUp POWER_DOWN if powering down the SIM card, + * POWER_UP if powering up the SIM card, + * POWER_UP_PASS_THROUGH if powering up the SIM card in + * pass through mode. + * + * When SIM card is in POWER_UP_PASS_THROUGH, the modem does not send + * any command to it (for example SELECT of MF, or TERMINAL + * CAPABILITY), and the SIM card is controlled completely by Telephony + * sending APDUs directly. The SIM card state must be + * RIL_CARDSTATE_PRESENT and the number of card apps will be 0. + * No new error code is generated. Emergency calls are supported in + * the same way as if the SIM card is absent. + * Pass-through mode is valid only for the specific card session where + * it is activated, and normal behavior occurs at the next SIM + * initialization, unless POWER_UP_PASS_THROUGH is requested again. + * + * The device is required to power down the SIM card before it can + * switch the mode between POWER_UP and POWER_UP_PASS_THROUGH. + * At device power up, the SIM interface is powered up automatically. + * Each subsequent request to this method is processed only after the + * completion of the previous one. + * + * Response callback is IRadioResponse.setSimCardPowerResponse_1_6(). + * Note that this differs from setSimCardPower_1_1 in that the response + * callback should only be sent once the device has finished executing + * the request (the SIM has finished powering on or off). + */ + oneway setSimCardPower_1_6(int32_t serial, CardPowerState powerUp); + /** * Enable or disable E-UTRA-NR dual connectivity. If disabled then UE will not connect * to secondary carrier. diff --git a/radio/1.6/IRadioResponse.hal b/radio/1.6/IRadioResponse.hal index 4ff7e47f12..bc6db11d56 100644 --- a/radio/1.6/IRadioResponse.hal +++ b/radio/1.6/IRadioResponse.hal @@ -201,6 +201,22 @@ interface IRadioResponse extends @1.5::IRadioResponse { */ oneway sendCdmaSmsExpectMoreResponse_1_6(RadioResponseInfo info, SendSmsResult sms); + /** + * @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:SIM_ERR (indicates a timeout or other issue making the SIM unresponsive) + * + * Note that this differs from setSimCardPowerResponse_1_1 in that the response + * should only be sent once the request from setSimCardPower_1_6 is complete + * (the SIM has finished powering on or off). + */ + oneway setSimCardPowerResponse_1_6(RadioResponseInfo info); + /** * @param info Response info struct containing response type, serial no. and error * diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h index 784bcd91e8..553e5b7daa 100644 --- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h +++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h @@ -763,6 +763,9 @@ class RadioResponse_v1_6 : public ::android::hardware::radio::V1_6::IRadioRespon const ::android::hardware::radio::V1_6::RadioResponseInfo& info, const SendSmsResult& sms); + Return setSimCardPowerResponse_1_6( + const ::android::hardware::radio::V1_6::RadioResponseInfo& info); + Return sendCdmaSmsExpectMoreResponse_1_6( const ::android::hardware::radio::V1_6::RadioResponseInfo& info, const SendSmsResult& sms); diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp index ffa384ed9b..c684584370 100644 --- a/radio/1.6/vts/functional/radio_response.cpp +++ b/radio/1.6/vts/functional/radio_response.cpp @@ -1097,6 +1097,13 @@ Return RadioResponse_v1_6::sendCdmaSmsResponse_1_6( return Void(); } +Return RadioResponse_v1_6::setSimCardPowerResponse_1_6( + const ::android::hardware::radio::V1_6::RadioResponseInfo& info) { + rspInfo = info; + parent_v1_6.notify(info.serial); + return Void(); +} + Return RadioResponse_v1_6::sendCdmaSmsExpectMoreResponse_1_6( const ::android::hardware::radio::V1_6::RadioResponseInfo& info, const SendSmsResult& sms) {