Add VTS for emergencyDial
Modify the document for 'hasKnownUserIntentEmergency'.
In the scenarios that the 'address' in the 'dialInfo' field has other
functions besides the emergency number function, if the
'hasKnownUserIntentEmergency' field is true, the user's intent for this
dial request is emergency call, and the modem must treat this as an
actual emergency dial; if the 'hasKnownUserIntentEmergency' field is
false, Android does not know user's intent for this call.
Test: compile
Bug: 121345950
Change-Id: I3457e7519be564ac5043e06380e9450a1b12425f
(cherry picked from commit 7208840ec0148ad5a01bdf419170282cd1b32437)
diff --git a/current.txt b/current.txt
index cf558e8..60241f9 100644
--- a/current.txt
+++ b/current.txt
@@ -429,7 +429,7 @@
e9d0f11a52715f5a29d89e2d8e2e21db1e16a43174af6b9d51a62d705cda1455 android.hardware.radio@1.3::IRadioIndication
d233f0da44f55fdef0a95db5229231412787bb67695cd1ea197ce89a3c2908b9 android.hardware.radio@1.3::IRadioResponse
750a363c8cec70baa1aac19e275c15233c5898e93c6bb5155fa2ca7f365490dc android.hardware.radio@1.3::types
-b2dfa12706a1633c387f2ae0a911021b98fe0ecacf5e14a3776053a27d606050 android.hardware.radio@1.4::IRadio
+21e6ce53f1759f6a213ca05bac3c0325ed911f74764d1c1f6fa5ed8068ade65b android.hardware.radio@1.4::IRadio
33d9e6895cca98aa56296bb01720d18b8acd0e4de4960beb712e63ad147438a5 android.hardware.radio@1.4::IRadioIndication
0cc0dd87c634aad36d7df22b2832839ef7ded71909dbcde11cfdd69dc0dc52b8 android.hardware.radio@1.4::IRadioResponse
29d34232cc3974626b08759e039fe788bded7695cdeb098458e3e11e4c7d3603 android.hardware.radio@1.4::types
diff --git a/radio/1.4/IRadio.hal b/radio/1.4/IRadio.hal
index 8ef1f96..f7ae39f 100644
--- a/radio/1.4/IRadio.hal
+++ b/radio/1.4/IRadio.hal
@@ -128,9 +128,11 @@
* does not support the emergency service category or emergency uniform resource names, the
* field 'categories' or 'urns' may be ignored.
*
- * 'fromEmergencyDialer' indicates if this request originated from emergency dialer/shortcut,
- * which means an explicit intent from the user to dial an emergency number. The modem must
- * treat this as an actual emergency dial and not try to disambiguate.
+ * In the scenarios that the 'address' in the 'dialInfo' field has other functions besides the
+ * emergency number function, if the 'hasKnownUserIntentEmergency' field is true, the user's
+ * intent for this dial request is emergency call, and the modem must treat this as an actual
+ * emergency dial; if the 'hasKnownUserIntentEmergency' field is false, Android does not know
+ * user's intent for this call.
*
* If 'isTesting' is true, this request is for testing purpose, and must not be sent to a real
* emergency service; otherwise it's for a real emergency call request.
@@ -146,14 +148,15 @@
* of the call.
* @param urns the emergency Uniform Resource Names (URN)
* @param routing @1.4::EmergencyCallRouting the emergency call routing information.
- * @param fromEmergencyDialer Flag indicating if this request originated from emergency dialer.
+ * @param hasKnownUserIntentEmergency Flag indicating if user's intent for the emergency call
+ * is known.
* @param isTesting Flag indicating if this request is for testing purpose.
*
* Response function is IRadioResponse.emergencyDialResponse()
*/
oneway emergencyDial(int32_t serial, Dial dialInfo,
bitfield<EmergencyServiceCategory> categories, vec<string> urns,
- EmergencyCallRouting routing, bool fromEmergencyDialer, bool isTesting);
+ EmergencyCallRouting routing, bool hasKnownUserIntentEmergency, bool isTesting);
/**
* Starts a network scan
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
index 6b1f85e..9237799 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
@@ -16,4 +16,81 @@
#include <radio_hidl_hal_utils_v1_4.h>
-#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
\ No newline at end of file
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+/*
+ * Test IRadio.emergencyDial() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, emergencyDial) {
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories = static_cast<int>(
+ ::android::hardware::radio::V1_4::EmergencyServiceCategory::UNSPECIFIED);
+ std::vector<hidl_string> urns = {""};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::UNKNOWN;
+
+ Return<void> res =
+ radio_v1_4->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ALOGI("emergencyDial, rspInfo.error = %s\n", toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+}
+
+/*
+ * Test IRadio.emergencyDial() with specified service and its response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, emergencyDial_withServices) {
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories =
+ static_cast<int>(::android::hardware::radio::V1_4::EmergencyServiceCategory::AMBULANCE);
+ std::vector<hidl_string> urns = {"urn:service:sos.ambulance"};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::UNKNOWN;
+
+ Return<void> res =
+ radio_v1_4->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ALOGI("emergencyDial_withServices, rspInfo.error = %s\n",
+ toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+}
+
+/*
+ * Test IRadio.emergencyDial() with known emergency call routing and its response returned.
+ */
+TEST_F(RadioHidlTest_v1_4, emergencyDial_withEmergencyRouting) {
+ serial = GetRandomSerialNumber();
+
+ ::android::hardware::radio::V1_0::Dial dialInfo;
+ dialInfo.address = hidl_string("911");
+ int categories = static_cast<int>(
+ ::android::hardware::radio::V1_4::EmergencyServiceCategory::UNSPECIFIED);
+ std::vector<hidl_string> urns = {""};
+ ::android::hardware::radio::V1_4::EmergencyCallRouting routing =
+ ::android::hardware::radio::V1_4::EmergencyCallRouting::EMERGENCY;
+
+ Return<void> res =
+ radio_v1_4->emergencyDial(serial, dialInfo, categories, urns, routing, true, true);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_4->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_4->rspInfo.serial);
+
+ ALOGI("emergencyDial_withEmergencyRouting, rspInfo.error = %s\n",
+ toString(radioRsp_v1_4->rspInfo.error).c_str());
+ EXPECT_EQ(RadioError::NONE, radioRsp_v1_4->rspInfo.error);
+}
\ No newline at end of file