Merge "Remove unnecessary group from blank_screen."
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp
index 3a4bc9c..9217a82 100644
--- a/camera/common/1.0/default/CameraModule.cpp
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -425,6 +425,13 @@
return -ENODEV;
}
+void CameraModule::removeCamera(int cameraId) {
+ free_camera_metadata(
+ const_cast<camera_metadata_t*>(mCameraInfoMap[cameraId].static_camera_characteristics));
+ mCameraInfoMap.removeItem(cameraId);
+ mDeviceVersionMap.removeItem(cameraId);
+}
+
uint16_t CameraModule::getModuleApiVersion() const {
return mModule->common.module_api_version;
}
diff --git a/camera/common/1.0/default/OWNERS b/camera/common/1.0/default/OWNERS
new file mode 100644
index 0000000..18acfee
--- /dev/null
+++ b/camera/common/1.0/default/OWNERS
@@ -0,0 +1,6 @@
+cychen@google.com
+epeev@google.com
+etalvala@google.com
+shuzhenwang@google.com
+yinchiayeh@google.com
+zhijunhe@google.com
diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/1.0/default/include/CameraModule.h
index 9fbfbd5..deebd09 100644
--- a/camera/common/1.0/default/include/CameraModule.h
+++ b/camera/common/1.0/default/include/CameraModule.h
@@ -63,6 +63,8 @@
const char* getModuleAuthor() const;
// Only used by CameraModuleFixture native test. Do NOT use elsewhere.
void *getDso();
+ // Only used by CameraProvider
+ void removeCamera(int cameraId);
private:
// Derive camera characteristics keys defined after HAL device version
diff --git a/camera/provider/2.4/default/CameraProvider.cpp b/camera/provider/2.4/default/CameraProvider.cpp
index 3a113de..8c5af8e 100644
--- a/camera/provider/2.4/default/CameraProvider.cpp
+++ b/camera/provider/2.4/default/CameraProvider.cpp
@@ -104,6 +104,30 @@
}
}
+void CameraProvider::removeDeviceNames(int camera_id)
+{
+ std::string cameraIdStr = std::to_string(camera_id);
+
+ mCameraIds.remove(cameraIdStr);
+
+ int deviceVersion = mModule->getDeviceVersion(camera_id);
+ auto deviceNamePair = std::make_pair(cameraIdStr,
+ getHidlDeviceName(cameraIdStr, deviceVersion));
+ mCameraDeviceNames.remove(deviceNamePair);
+ mCallbacks->cameraDeviceStatusChange(deviceNamePair.second, CameraDeviceStatus::NOT_PRESENT);
+ if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_2 &&
+ mModule->isOpenLegacyDefined() && mOpenLegacySupported[cameraIdStr]) {
+
+ deviceNamePair = std::make_pair(cameraIdStr,
+ getHidlDeviceName(cameraIdStr, CAMERA_DEVICE_API_VERSION_1_0));
+ mCameraDeviceNames.remove(deviceNamePair);
+ mCallbacks->cameraDeviceStatusChange(deviceNamePair.second,
+ CameraDeviceStatus::NOT_PRESENT);
+ }
+
+ mModule->removeCamera(camera_id);
+}
+
/**
* static callback forwarding methods from HAL to instance
*/
@@ -135,8 +159,17 @@
}
}
- if (!found) {
- cp->addDeviceNames(camera_id, status, true);
+ switch (status) {
+ case CameraDeviceStatus::PRESENT:
+ case CameraDeviceStatus::ENUMERATING:
+ if (!found) {
+ cp->addDeviceNames(camera_id, status, true);
+ }
+ break;
+ case CameraDeviceStatus::NOT_PRESENT:
+ if (found) {
+ cp->removeDeviceNames(camera_id);
+ }
}
}
}
diff --git a/camera/provider/2.4/default/CameraProvider.h b/camera/provider/2.4/default/CameraProvider.h
index 2cf251e..0f0959f 100644
--- a/camera/provider/2.4/default/CameraProvider.h
+++ b/camera/provider/2.4/default/CameraProvider.h
@@ -115,6 +115,7 @@
void addDeviceNames(int camera_id, CameraDeviceStatus status = CameraDeviceStatus::PRESENT,
bool cam_new = false);
+ void removeDeviceNames(int camera_id);
};
extern "C" ICameraProvider* HIDL_FETCH_ICameraProvider(const char* name);
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
index 3e678bb..56e4afd 100644
--- a/radio/1.2/Android.bp
+++ b/radio/1.2/Android.bp
@@ -36,8 +36,6 @@
"NetworkScanResult",
"RadioConst",
"ScanIntervalRange",
- "SimSlotStatus",
- "SlotState",
],
gen_java: true,
}
diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal
index 73f1024..6ae78a0 100644
--- a/radio/1.2/IRadio.hal
+++ b/radio/1.2/IRadio.hal
@@ -37,46 +37,4 @@
* 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<uint32_t> slotMap);
};
diff --git a/radio/1.2/IRadioIndication.hal b/radio/1.2/IRadioIndication.hal
index e87bb5b..22f655c 100644
--- a/radio/1.2/IRadioIndication.hal
+++ b/radio/1.2/IRadioIndication.hal
@@ -30,15 +30,6 @@
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<SimSlotStatus> 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 cf6bc00..a7ad30c 100644
--- a/radio/1.2/IRadioResponse.hal
+++ b/radio/1.2/IRadioResponse.hal
@@ -50,33 +50,4 @@
* 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<SimSlotStatus> 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 1e28d3b..3aa2446 100644
--- a/radio/1.2/types.hal
+++ b/radio/1.2/types.hal
@@ -224,17 +224,6 @@
vec<CellInfoTdscdma> 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 @@
*/
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 0000000..c50e71c
--- /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 0000000..9b5d4a8
--- /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<uint32_t> slotMap);
+};
diff --git a/radio/config/1.0/IRadioConfigIndication.hal b/radio/config/1.0/IRadioConfigIndication.hal
new file mode 100644
index 0000000..1800c3c
--- /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<SimSlotStatus> slotStatus);
+};
diff --git a/radio/config/1.0/IRadioConfigResponse.hal b/radio/config/1.0/IRadioConfigResponse.hal
new file mode 100644
index 0000000..917fda1
--- /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<SimSlotStatus> 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 0000000..a493679
--- /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 0000000..66bfd92
--- /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 0000000..6782314
--- /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 <radio_config_hidl_hal_utils.h>
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+/*
+ * Test IRadioConfig.getSimSlotsStatus()
+ */
+TEST_F(RadioConfigHidlTest, getSimSlotsStatus) {
+ const int serial = GetRandomSerialNumber();
+ Return<void> 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<uint32_t> mapping = {0};
+ Return<void> 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 0000000..8df6842
--- /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 <radio_config_hidl_hal_utils.h>
+
+void RadioConfigHidlTest::SetUp() {
+ radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
+ hidl_string(RADIO_SERVICE_NAME));
+ if (radioConfig == NULL) {
+ sleep(60);
+ radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
+ 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<std::mutex> 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<std::mutex> 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 0000000..762cc98
--- /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 <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#include <android/hardware/radio/config/1.0/IRadioConfig.h>
+#include <android/hardware/radio/config/1.0/IRadioConfigIndication.h>
+#include <android/hardware/radio/config/1.0/IRadioConfigResponse.h>
+#include <android/hardware/radio/config/1.0/types.h>
+
+#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<void> getSimSlotsStatusResponse(
+ const RadioResponseInfo& info,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
+
+ Return<void> 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<void> simSlotsStatusChanged(
+ RadioIndicationType type, const ::android::hardware::hidl_vec<SimSlotStatus>& 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<IRadioConfig> radioConfig;
+
+ /* radio config response handle */
+ sp<RadioConfigResponse> radioConfigRsp;
+
+ /* radio config indication handle */
+ sp<RadioConfigIndication> 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 0000000..b3a5843
--- /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 <radio_config_hidl_hal_utils.h>
+
+RadioConfigIndication::RadioConfigIndication(RadioConfigHidlTest& parent) : parent(parent) {}
+
+Return<void> RadioConfigIndication::simSlotsStatusChanged(
+ RadioIndicationType /*type*/,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& /*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 0000000..97e8dca
--- /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 <radio_config_hidl_hal_utils.h>
+
+SimSlotStatus slotStatus;
+
+RadioConfigResponse::RadioConfigResponse(RadioConfigHidlTest& parent) : parent(parent) {}
+
+Return<void> RadioConfigResponse::getSimSlotsStatusResponse(
+ const RadioResponseInfo& /* info */,
+ const ::android::hardware::hidl_vec<SimSlotStatus>& /* slotStatus */) {
+ return Void();
+}
+
+Return<void> RadioConfigResponse::setSimSlotsMappingResponse(const RadioResponseInfo& /* info */) {
+ return Void();
+}
\ No newline at end of file
diff --git a/usb/gadget/1.0/Android.bp b/usb/gadget/1.0/Android.bp
new file mode 100644
index 0000000..f38002f
--- /dev/null
+++ b/usb/gadget/1.0/Android.bp
@@ -0,0 +1,23 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.usb.gadget@1.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "types.hal",
+ "IUsbGadget.hal",
+ "IUsbGadgetCallback.hal",
+ ],
+ interfaces: [
+ "android.hidl.base@1.0",
+ ],
+ types: [
+ "GadgetFunction",
+ "Status",
+ ],
+ gen_java: true,
+}
+
diff --git a/usb/gadget/1.0/IUsbGadget.hal b/usb/gadget/1.0/IUsbGadget.hal
new file mode 100644
index 0000000..41be401
--- /dev/null
+++ b/usb/gadget/1.0/IUsbGadget.hal
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 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.usb.gadget@1.0;
+
+import IUsbGadgetCallback;
+
+interface IUsbGadget {
+ /**
+ * This function is used to set the current USB gadget configuration.
+ * Usb gadget needs to teared down if an USB configuration is already
+ * active.
+ *
+ * @param functions list of functions defined by GadgetFunction to be
+ * included in the gadget composition.
+ * @param callback IUsbGadgetCallback::setCurrentUsbFunctionsCb used to
+ * propagate back the status.
+ * @param timeout The maximum time (in milliseconds) within which the
+ * IUsbGadgetCallback needs to be returned.
+ */
+ oneway setCurrentUsbFunctions(bitfield<GadgetFunction> functions,
+ IUsbGadgetCallback callback,
+ uint64_t timeout);
+
+ /**
+ * This function is used to query the USB functions included in the
+ * current USB configuration.
+ *
+ * @param callback IUsbGadgetCallback::getCurrentUsbFunctionsCb used to
+ * propagate the current functions list.
+ */
+ oneway getCurrentUsbFunctions(IUsbGadgetCallback callback);
+
+};
diff --git a/usb/gadget/1.0/IUsbGadgetCallback.hal b/usb/gadget/1.0/IUsbGadgetCallback.hal
new file mode 100644
index 0000000..8876abb
--- /dev/null
+++ b/usb/gadget/1.0/IUsbGadgetCallback.hal
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 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.usb.gadget@1.0;
+
+interface IUsbGadgetCallback {
+ /**
+ * Callback function used to propagate the status of configuration
+ * switch to the caller.
+ *
+ * @param functions list of functions defined by GadgetFunction
+ * included in the current USB gadget composition.
+ * @param status SUCCESS when the functions are applied.
+ * FUNCTIONS_NOT_SUPPORTED when the configuration is
+ * not supported.
+ * ERROR otherwise.
+ */
+ oneway setCurrentUsbFunctionsCb(bitfield<GadgetFunction> functions,
+ Status status);
+
+ /**
+ * Callback function used to propagate the current USB gadget
+ * configuration.
+ * @param functions list of functions defined by GadgetFunction
+ * included in the current USB gadget composition.
+ * @param status FUNCTIONS_APPLIED when list of functions have been
+ * applied.
+ * FUNCTIONS_NOT_APPLIED when the functions have not
+ * been applied.
+ * ERROR otherwise.
+ */
+ oneway getCurrentUsbFunctionsCb(bitfield<GadgetFunction> functions,
+ Status status);
+};
diff --git a/usb/gadget/1.0/types.hal b/usb/gadget/1.0/types.hal
new file mode 100644
index 0000000..3793fe2
--- /dev/null
+++ b/usb/gadget/1.0/types.hal
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2017 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.usb.gadget@1.0;
+
+enum GadgetFunction : uint64_t {
+ /**
+ * Removes all the functions and pulls down the gadget.
+ */
+ NONE = 0,
+
+ /**
+ * Android Debug Bridge function.
+ */
+ ADB = 1 << 0,
+
+ /**
+ * Android open accessory protocol function.
+ */
+ ACCESSORY = 1 << 1,
+
+ /**
+ * Media Transfer protocol function.
+ */
+ MTP = 1 << 2,
+
+ /**
+ * Peripheral mode USB Midi function.
+ */
+ MIDI = 1 << 3,
+
+ /**
+ * Picture transfer protocol function.
+ */
+ PTP = 1 << 4,
+
+ /**
+ * Tethering function.
+ */
+ RNDIS = 1 << 5,
+
+ /**
+ * AOAv2.0 - Audio Source function.
+ */
+ AUDIO_SOURCE = 1 << 6,
+};
+
+enum Status : uint32_t {
+ SUCCESS = 0,
+
+ /**
+ * Error value when the HAL operation fails for reasons not listed here.
+ */
+ ERROR = 1,
+
+ /**
+ * USB configuration applied successfully.
+ */
+ FUNCTIONS_APPLIED = 2,
+
+ /**
+ * USB confgiuration failed to apply.
+ */
+ FUNCTIONS_NOT_APPLIED = 3,
+
+ /**
+ * USB configuration not supported.
+ */
+ CONFIGURATION_NOT_SUPPORTED = 4,
+};