From 7fd46a30f30c8a4ada30777e94e80e788e45dd0b Mon Sep 17 00:00:00 2001 From: yinxu Date: Wed, 3 Jan 2018 16:36:59 -0800 Subject: [PATCH] Migrate the slot related APIs SIM slot related APIs are not related to any radio/modem, so they need to be migrate to a different HAL which is not related to any radio/modem. Bug: 64131518 Test: Basic telephony sanity Change-Id: I626f13c5f6fb39091f6bddd5b6d373f09561af90 --- radio/1.2/Android.bp | 2 - radio/1.2/IRadio.hal | 42 -------- radio/1.2/IRadioIndication.hal | 9 -- radio/1.2/IRadioResponse.hal | 29 ----- radio/1.2/types.hal | 39 ------- radio/config/1.0/Android.bp | 25 +++++ radio/config/1.0/IRadioConfig.hal | 82 ++++++++++++++ radio/config/1.0/IRadioConfigIndication.hal | 38 +++++++ radio/config/1.0/IRadioConfigResponse.hal | 52 +++++++++ radio/config/1.0/types.hal | 58 ++++++++++ radio/config/1.0/vts/functional/Android.bp | 31 ++++++ .../functional/radio_config_hidl_hal_api.cpp | 54 ++++++++++ .../functional/radio_config_hidl_hal_test.cpp | 65 +++++++++++ .../functional/radio_config_hidl_hal_utils.h | 102 ++++++++++++++++++ .../functional/radio_config_indication.cpp | 25 +++++ .../vts/functional/radio_config_response.cpp | 31 ++++++ 16 files changed, 563 insertions(+), 121 deletions(-) create mode 100644 radio/config/1.0/Android.bp create mode 100644 radio/config/1.0/IRadioConfig.hal create mode 100644 radio/config/1.0/IRadioConfigIndication.hal create mode 100644 radio/config/1.0/IRadioConfigResponse.hal create mode 100644 radio/config/1.0/types.hal create mode 100644 radio/config/1.0/vts/functional/Android.bp create mode 100644 radio/config/1.0/vts/functional/radio_config_hidl_hal_api.cpp create mode 100644 radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp create mode 100644 radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h create mode 100644 radio/config/1.0/vts/functional/radio_config_indication.cpp create mode 100644 radio/config/1.0/vts/functional/radio_config_response.cpp diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp index 3e678bbe8f..56e4afd73c 100644 --- a/radio/1.2/Android.bp +++ b/radio/1.2/Android.bp @@ -36,8 +36,6 @@ hidl_interface { "NetworkScanResult", "RadioConst", "ScanIntervalRange", - "SimSlotStatus", - "SlotState", ], gen_java: true, } diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal index 73f1024ce7..6ae78a0bfb 100644 --- a/radio/1.2/IRadio.hal +++ b/radio/1.2/IRadio.hal @@ -37,46 +37,4 @@ interface IRadio extends @1.1::IRadio { * Response function is IRadioResponse.startNetworkScanResponse() */ oneway startNetworkScan_1_2(int32_t serial, NetworkScanRequest request); - - /** - * Get SIM Slot status. - * - * Request provides the slot status of all active and inactive SIM slots and whether card is - * present in the slots or not. - * - * @param serial Serial number of request. - * - * Response callback is IRadioResponse.getSimSlotsStatusResponse() - */ - oneway getSimSlotsStatus(int32_t serial); - - /** - * Set SIM Slot mapping. - - * Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem. - * Physical slot is the actual physical slot. Request maps the physical slot to logical slot. - * Logical slots that are already mapped to the requested physical slot are not impacted. - * - * Example no. of logical slots 1 and physical slots 2: - * The only logical slot (index 0) can be mapped to first physical slot (value 0) or second - * physical slot(value 1), while the other physical slot remains unmapped and inactive. - * slotMap[0] = 1 or slotMap[0] = 0 - * - * Example no. of logical slots 2 and physical slots 2: - * First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot - * can be mapped to other physical slot. Each logical slot must be mapped to a physical slot. - * slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0 - * - * @param serial Serial number of request - * @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is - * mapping to logical slot and value to physical slot, need to provide all the slots - * mapping when sending request in case of multi slot device. - * EX: uint32_t slotMap[logical slot] = physical slot - * index 0 is the first logical_slot number of logical slots is equal to number of Radio - * instances and number of physical slots is equal to size of slotStatus in - * getSimSlotsStatusResponse - * - * Response callback is IRadioResponse.setSimSlotsMappingResponse() - */ - oneway setSimSlotsMapping(int32_t serial, vec slotMap); }; diff --git a/radio/1.2/IRadioIndication.hal b/radio/1.2/IRadioIndication.hal index e87bb5b307..22f655c625 100644 --- a/radio/1.2/IRadioIndication.hal +++ b/radio/1.2/IRadioIndication.hal @@ -29,15 +29,6 @@ interface IRadioIndication extends @1.1::IRadioIndication { */ oneway networkScanResult_1_2(RadioIndicationType type, NetworkScanResult result); - /** - * Indicates SIM slot status change. - * - * @param type Type of radio indication - * @param slotStatus new slot status info with size equals to the number of physical slots on - * the device - */ - oneway simSlotsStatusChanged(RadioIndicationType type, vec slotStatus); - /** * Request all of the current cell information known to the radio. * Same information as returned by getCellInfoList() in 1.0::IRadio. diff --git a/radio/1.2/IRadioResponse.hal b/radio/1.2/IRadioResponse.hal index cf6bc00299..a7ad30c129 100644 --- a/radio/1.2/IRadioResponse.hal +++ b/radio/1.2/IRadioResponse.hal @@ -50,33 +50,4 @@ interface IRadioResponse extends @1.1::IRadioResponse { * RadioError:NONE */ oneway getIccCardStatusResponse_1_2(RadioResponseInfo info, CardStatus cardStatus); - - /** - * @param info Response info struct containing response type, serial no. and error - * @param slotStatus Sim slot struct containing all the physical SIM slots info with size - * equals to the number of physical slots on the device - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:NO_MEMORY - * RadioError:INTERNAL_ERR - * RadioError:MODEM_ERR - * RadioError:INVALID_ARGUMENTS - */ - oneway getSimSlotsStatusResponse(RadioResponseInfo info, vec slotStatus); - - /** - * @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:NO_MEMORY - * RadioError:INTERNAL_ERR - * RadioError:MODEM_ERR - */ - oneway setSimSlotsMappingResponse(RadioResponseInfo info); }; diff --git a/radio/1.2/types.hal b/radio/1.2/types.hal index 1e28d3b350..3aa24460de 100644 --- a/radio/1.2/types.hal +++ b/radio/1.2/types.hal @@ -224,17 +224,6 @@ struct CellInfo { vec tdscdma; }; -enum SlotState : int32_t { - /** - * Physical slot is inactive - */ - INACTIVE = 0x00, - /** - * Physical slot is active - */ - ACTIVE = 0x01, -}; - struct CardStatus { @1.0::CardStatus base; uint32_t physicalSlotId; @@ -255,31 +244,3 @@ struct CardStatus { */ string iccid; }; - -struct SimSlotStatus { - /** - * Card state in the physical slot - */ - CardState cardState; - /** - * Slot state Active/Inactive - */ - SlotState slotState; - /** - * An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816 - * standards, following electrical reset of the card's chip. The ATR conveys information about - * the communication parameters proposed by the card, and the card's nature and state. - * - * This data is applicable only when cardState is CardState:PRESENT. - */ - string atr; - uint32_t logicalSlotId; - /** - * Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is - * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by - * the ITU-T recommendation E.118 ISO/IEC 7816. - * - * This data is applicable only when cardState is CardState:PRESENT. - */ - string iccid; -}; diff --git a/radio/config/1.0/Android.bp b/radio/config/1.0/Android.bp new file mode 100644 index 0000000000..c50e71ca09 --- /dev/null +++ b/radio/config/1.0/Android.bp @@ -0,0 +1,25 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.radio.config@1.0", + root: "android.hardware", + vndk: { + enabled: true, + }, + srcs: [ + "types.hal", + "IRadioConfig.hal", + "IRadioConfigIndication.hal", + "IRadioConfigResponse.hal", + ], + interfaces: [ + "android.hardware.radio@1.0", + "android.hidl.base@1.0", + ], + types: [ + "SimSlotStatus", + "SlotState", + ], + gen_java: true, +} + diff --git a/radio/config/1.0/IRadioConfig.hal b/radio/config/1.0/IRadioConfig.hal new file mode 100644 index 0000000000..9b5d4a85ba --- /dev/null +++ b/radio/config/1.0/IRadioConfig.hal @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.config@1.0; + +import IRadioConfigResponse; +import IRadioConfigIndication; + +/** + * This interface is used by telephony and telecom to talk to cellular radio for the purpose of + * radio configuration, and it is not associated with any specific modem or slot. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + */ +interface IRadioConfig { + + /** + * Set response functions for radio config requests & radio config indications. + * + * @param radioConfigResponse Object containing radio config response functions + * @param radioConfigIndication Object containing radio config indications + */ + setResponseFunctions(IRadioConfigResponse radioConfigResponse, + IRadioConfigIndication radioConfigIndication); + + /** + * Get SIM Slot status. + * + * Request provides the slot status of all active and inactive SIM slots and whether card is + * present in the slots or not. + * + * @param serial Serial number of request. + * + * Response callback is IRadioConfigResponse.getSimSlotsStatusResponse() + */ + oneway getSimSlotsStatus(int32_t serial); + + /** + * Set SIM Slot mapping. + + * Maps the logical slots to the physical slots. Logical slot is the slot that is seen by modem. + * Physical slot is the actual physical slot. Request maps the physical slot to logical slot. + * Logical slots that are already mapped to the requested physical slot are not impacted. + * + * Example no. of logical slots 1 and physical slots 2: + * The only logical slot (index 0) can be mapped to first physical slot (value 0) or second + * physical slot(value 1), while the other physical slot remains unmapped and inactive. + * slotMap[0] = 1 or slotMap[0] = 0 + * + * Example no. of logical slots 2 and physical slots 2: + * First logical slot (index 0) can be mapped to physical slot 1 or 2 and other logical slot + * can be mapped to other physical slot. Each logical slot must be mapped to a physical slot. + * slotMap[0] = 0 and slotMap[1] = 1 or slotMap[0] = 1 and slotMap[1] = 0 + * + * @param serial Serial number of request + * @param slotMap Logical to physical slot mapping, size == no. of radio instances. Index is + * mapping to logical slot and value to physical slot, need to provide all the slots + * mapping when sending request in case of multi slot device. + * EX: uint32_t slotMap[logical slot] = physical slot + * index 0 is the first logical_slot number of logical slots is equal to number of Radio + * instances and number of physical slots is equal to size of slotStatus in + * getSimSlotsStatusResponse + * + * Response callback is IRadioConfigResponse.setSimSlotsMappingResponse() + */ + oneway setSimSlotsMapping(int32_t serial, vec slotMap); +}; diff --git a/radio/config/1.0/IRadioConfigIndication.hal b/radio/config/1.0/IRadioConfigIndication.hal new file mode 100644 index 0000000000..1800c3ca1a --- /dev/null +++ b/radio/config/1.0/IRadioConfigIndication.hal @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.config@1.0; + +import android.hardware.radio@1.0::RadioIndicationType; + +/** + * Interface declaring unsolicited radio config indications. + */ +interface IRadioConfigIndication { + + /** + * Indicates SIM slot status change. + + * This indication must be sent by the modem whenever there is any slot status change, even the + * slot is inactive. For example, this indication must be triggered if a SIM card is inserted + * into an inactive slot. + * + * @param type Type of radio indication + * @param slotStatus new slot status info with size equals to the number of physical slots on + * the device + */ + oneway simSlotsStatusChanged(RadioIndicationType type, vec slotStatus); +}; diff --git a/radio/config/1.0/IRadioConfigResponse.hal b/radio/config/1.0/IRadioConfigResponse.hal new file mode 100644 index 0000000000..917fda1496 --- /dev/null +++ b/radio/config/1.0/IRadioConfigResponse.hal @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.config@1.0; + +import android.hardware.radio@1.0::RadioResponseInfo; + +/** + * Interface declaring response functions to solicited radio config requests. + */ +interface IRadioConfigResponse { + + /** + * @param info Response info struct containing response type, serial no. and error + * @param slotStatus Sim slot struct containing all the physical SIM slots info with size + * equals to the number of physical slots on the device + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:NO_MEMORY + * RadioError:INTERNAL_ERR + * RadioError:MODEM_ERR + */ + oneway getSimSlotsStatusResponse(RadioResponseInfo info, vec slotStatus); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:NO_MEMORY + * RadioError:INTERNAL_ERR + * RadioError:MODEM_ERR + * RadioError:INVALID_ARGUMENTS + */ + oneway setSimSlotsMappingResponse(RadioResponseInfo info); +}; diff --git a/radio/config/1.0/types.hal b/radio/config/1.0/types.hal new file mode 100644 index 0000000000..a493679ac0 --- /dev/null +++ b/radio/config/1.0/types.hal @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.radio.config@1.0; + +import android.hardware.radio@1.0::CardState; + +enum SlotState : int32_t { + /** + * Physical slot is inactive + */ + INACTIVE = 0x00, + /** + * Physical slot is active + */ + ACTIVE = 0x01, +}; + +struct SimSlotStatus { + /** + * Card state in the physical slot + */ + CardState cardState; + /** + * Slot state Active/Inactive + */ + SlotState slotState; + /** + * An Answer To Reset (ATR) is a message output by a Smart Card conforming to ISO/IEC 7816 + * standards, following electrical reset of the card's chip. The ATR conveys information about + * the communication parameters proposed by the card, and the card's nature and state. + * + * This data is applicable only when cardState is CardState:PRESENT. + */ + string atr; + uint32_t logicalSlotId; + /** + * Integrated Circuit Card IDentifier (ICCID) is Unique Identifier of the SIM CARD. File is + * located in the SIM card at EFiccid (0x2FE2) as per ETSI 102.221. The ICCID is defined by + * the ITU-T recommendation E.118 ISO/IEC 7816. + * + * This data is applicable only when cardState is CardState:PRESENT. + */ + string iccid; +}; diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp new file mode 100644 index 0000000000..66bfd92285 --- /dev/null +++ b/radio/config/1.0/vts/functional/Android.bp @@ -0,0 +1,31 @@ +// +// Copyright (C) 2018 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +cc_test { + name: "VtsHalRadioConfigV1_0TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "radio_config_hidl_hal_api.cpp", + "radio_config_hidl_hal_test.cpp", + "radio_config_response.cpp", + "radio_config_indication.cpp", + ], + static_libs: [ + "RadioVtsTestUtilBase", + "android.hardware.radio.config@1.0", + ], + header_libs: ["radio.util.header@1.0"], +} diff --git a/radio/config/1.0/vts/functional/radio_config_hidl_hal_api.cpp b/radio/config/1.0/vts/functional/radio_config_hidl_hal_api.cpp new file mode 100644 index 0000000000..67823143e8 --- /dev/null +++ b/radio/config/1.0/vts/functional/radio_config_hidl_hal_api.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) + +/* + * Test IRadioConfig.getSimSlotsStatus() + */ +TEST_F(RadioConfigHidlTest, getSimSlotsStatus) { + const int serial = GetRandomSerialNumber(); + Return res = radioConfig->getSimSlotsStatus(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type); + EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial); + ALOGI("getIccSlotsStatus, rspInfo.error = %s\n", + toString(radioConfigRsp->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); +} + +/* + * Test IRadioConfig.setSimSlotsMapping() + */ +TEST_F(RadioConfigHidlTest, setSimSlotsMapping) { + const int serial = GetRandomSerialNumber(); + android::hardware::hidl_vec mapping = {0}; + Return res = radioConfig->setSimSlotsMapping(serial, mapping); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type); + EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial); + ALOGI("setSimSlotsMapping, rspInfo.error = %s\n", + toString(radioConfigRsp->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(radioConfigRsp->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); +} diff --git a/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp b/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp new file mode 100644 index 0000000000..8df68427ce --- /dev/null +++ b/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +void RadioConfigHidlTest::SetUp() { + radioConfig = ::testing::VtsHalHidlTargetTestBase::getService( + hidl_string(RADIO_SERVICE_NAME)); + if (radioConfig == NULL) { + sleep(60); + radioConfig = ::testing::VtsHalHidlTargetTestBase::getService( + hidl_string(RADIO_SERVICE_NAME)); + } + ASSERT_NE(nullptr, radioConfig.get()); + + radioConfigRsp = new (std::nothrow) RadioConfigResponse(*this); + ASSERT_NE(nullptr, radioConfigRsp.get()); + + count_ = 0; + + radioConfigInd = new (std::nothrow) RadioConfigIndication(*this); + ASSERT_NE(nullptr, radioConfigInd.get()); + + radioConfig->setResponseFunctions(radioConfigRsp, radioConfigInd); +} + +/* + * Notify that the response message is received. + */ +void RadioConfigHidlTest::notify() { + std::unique_lock lock(mtx_); + count_++; + cv_.notify_one(); +} + +/* + * Wait till the response message is notified or till TIMEOUT_PERIOD. + */ +std::cv_status RadioConfigHidlTest::wait() { + std::unique_lock lock(mtx_); + + std::cv_status status = std::cv_status::no_timeout; + auto now = std::chrono::system_clock::now(); + while (count_ == 0) { + status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + if (status == std::cv_status::timeout) { + return status; + } + } + count_--; + return status; +} diff --git a/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h b/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h new file mode 100644 index 0000000000..762cc9800d --- /dev/null +++ b/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "vts_test_util.h" + +using namespace ::android::hardware::radio::config::V1_0; + +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::radio::V1_0::RadioIndicationType; +using ::android::hardware::radio::V1_0::RadioResponseInfo; +using ::android::hardware::radio::V1_0::RadioResponseType; +using ::android::sp; + +#define TIMEOUT_PERIOD 75 +#define RADIO_SERVICE_NAME "slot1" + +class RadioConfigHidlTest; + +/* Callback class for radio config response */ +class RadioConfigResponse : public IRadioConfigResponse { + protected: + RadioConfigHidlTest& parent; + + public: + RadioResponseInfo rspInfo; + + RadioConfigResponse(RadioConfigHidlTest& parent); + virtual ~RadioConfigResponse() = default; + + Return getSimSlotsStatusResponse( + const RadioResponseInfo& info, + const ::android::hardware::hidl_vec& slotStatus); + + Return setSimSlotsMappingResponse(const RadioResponseInfo& info); +}; + +/* Callback class for radio config indication */ +class RadioConfigIndication : public IRadioConfigIndication { + protected: + RadioConfigHidlTest& parent; + + public: + RadioConfigIndication(RadioConfigHidlTest& parent); + virtual ~RadioConfigIndication() = default; + + Return simSlotsStatusChanged( + RadioIndicationType type, const ::android::hardware::hidl_vec& slotStatus); +}; + +// The main test class for Radio config HIDL. +class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase { + protected: + std::mutex mtx_; + std::condition_variable cv_; + int count_; + + public: + virtual void SetUp() override; + + /* Used as a mechanism to inform the test about data/event callback */ + void notify(); + + /* Test code calls this function to wait for response */ + std::cv_status wait(); + + /* radio config service handle */ + sp radioConfig; + + /* radio config response handle */ + sp radioConfigRsp; + + /* radio config indication handle */ + sp radioConfigInd; +}; diff --git a/radio/config/1.0/vts/functional/radio_config_indication.cpp b/radio/config/1.0/vts/functional/radio_config_indication.cpp new file mode 100644 index 0000000000..b3a58431e4 --- /dev/null +++ b/radio/config/1.0/vts/functional/radio_config_indication.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +RadioConfigIndication::RadioConfigIndication(RadioConfigHidlTest& parent) : parent(parent) {} + +Return RadioConfigIndication::simSlotsStatusChanged( + RadioIndicationType /*type*/, + const ::android::hardware::hidl_vec& /*slotStatus*/) { + return Void(); +} diff --git a/radio/config/1.0/vts/functional/radio_config_response.cpp b/radio/config/1.0/vts/functional/radio_config_response.cpp new file mode 100644 index 0000000000..97e8dca7e9 --- /dev/null +++ b/radio/config/1.0/vts/functional/radio_config_response.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +SimSlotStatus slotStatus; + +RadioConfigResponse::RadioConfigResponse(RadioConfigHidlTest& parent) : parent(parent) {} + +Return RadioConfigResponse::getSimSlotsStatusResponse( + const RadioResponseInfo& /* info */, + const ::android::hardware::hidl_vec& /* slotStatus */) { + return Void(); +} + +Return RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& /* info */) { + return Void(); +} \ No newline at end of file