Add cuttlefish impl for disabling subscription RIL APIs.
Bug: 141018421
Test: vts on cuttlefish
Change-Id: Ieba37f022e508947207429d35f697739073d8a2d
Merged-In: Ieba37f022e508947207429d35f697739073d8a2d
diff --git a/guest/hals/ril/cuttlefish_ril.cpp b/guest/hals/ril/cuttlefish_ril.cpp
index cf791b9..cb7446f 100644
--- a/guest/hals/ril/cuttlefish_ril.cpp
+++ b/guest/hals/ril/cuttlefish_ril.cpp
@@ -102,6 +102,7 @@
static int gSimPINAttempts = 0;
static const int gSimPINAttemptsMax = 3;
static SIM_Status gSimStatus = SIM_NOT_READY;
+static bool areUiccApplicationsEnabled = true;
// SetUpNetworkInterface configures IP and Broadcast addresses on a RIL
// controlled network interface.
@@ -1213,6 +1214,40 @@
sizeof(gCdmaSubscriptionType));
}
+static void request_enable_uicc_applications(int /*request*/, void* data,
+ size_t datalen,
+ RIL_Token t) {
+ ALOGV("Enable uicc applications.");
+
+ if (data == NULL || datalen != sizeof(int)) {
+ gce_ril_env->OnRequestComplete(t, RIL_E_INTERNAL_ERR, NULL, 0);
+ return;
+ }
+
+ bool enable = *(int *)(data) != 0;
+
+ ALOGV("areUiccApplicationsEnabled change from %d to %d", areUiccApplicationsEnabled, enable);
+
+ areUiccApplicationsEnabled = enable;
+
+ gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+}
+
+static void request_are_uicc_applications_enabled(int /*request*/, void* /*data*/,
+ size_t /*datalen*/,
+ RIL_Token t) {
+ ALOGV("Getting whether uicc applications are enabled.");
+
+ gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, &areUiccApplicationsEnabled, sizeof(bool));
+}
+
+static void request_can_toggle_uicc_applications_enablement(int /*request*/, void* /*data*/,
+ size_t /*datalen*/, RIL_Token t) {
+ ALOGV("Getting can toggle uicc applications enablement.");
+
+ gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+}
+
static void request_cdma_set_subscription_source(int /*request*/, void* data,
size_t /*datalen*/,
RIL_Token t) {
@@ -2534,6 +2569,15 @@
case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE:
request_exit_emergency_mode(data, datalen, t);
break;
+ case RIL_REQUEST_ENABLE_UICC_APPLICATIONS:
+ request_enable_uicc_applications(request, data, datalen, t);
+ break;
+ case RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED:
+ request_are_uicc_applications_enabled(request, data, datalen, t);
+ break;
+ case RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT:
+ request_can_toggle_uicc_applications_enablement(request, data, datalen, t);
+ break;
default:
ALOGE("Request %d not supported.", request);
gce_ril_env->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0);
diff --git a/guest/hals/ril/libril/ril.h b/guest/hals/ril/libril/ril.h
index caf6939..addf66b 100644
--- a/guest/hals/ril/libril/ril.h
+++ b/guest/hals/ril/libril/ril.h
@@ -94,6 +94,9 @@
* RIL_REQUEST_ENABLE_MODEM
* RIL_REQUEST_EMERGENCY_DIAL
* RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS
+ * RIL_REQUEST_ENABLE_UICC_APPLICATIONS
+ * RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED
+ * RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT
*/
#define RIL_VERSION 12
#define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name
@@ -6596,6 +6599,50 @@
*/
#define RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5 155
+/**
+ * RIL_REQUEST_ENABLE_UICC_APPLICATIONS
+ *
+ * Enable or disable uicc applications.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * SIM_ABSENT
+ * INTERNAL_ERR
+ * REQUEST_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_ENABLE_UICC_APPLICATIONS 156
+
+/**
+ * RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED
+ *
+ * Whether uicc applications are enabled.
+ *
+ * Response: a boolean of enable or not.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * SIM_ABSENT
+ * INTERNAL_ERR
+ * REQUEST_NOT_SUPPORTED
+ */
+#define RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED 157
+
+/**
+ * RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT
+ *
+ * Whether disabling / enabling uicc applications is supported
+ *
+ * Response: a boolean of whether it's supported.
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * INTERNAL_ERR
+ */
+#define RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT 158
+
/***********************************************************************/
/**
diff --git a/guest/hals/ril/libril/ril_commands.h b/guest/hals/ril/libril/ril_commands.h
index 3f45151..97183fd 100644
--- a/guest/hals/ril/libril/ril_commands.h
+++ b/guest/hals/ril/libril/ril_commands.h
@@ -170,3 +170,6 @@
{RIL_REQUEST_SET_CARRIER_RESTRICTIONS_1_4, radio_1_5::setAllowedCarriersResponse4},
{RIL_REQUEST_GET_CARRIER_RESTRICTIONS_1_4, radio_1_5::getAllowedCarriersResponse4},
{RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA_1_5, radio_1_5::setSignalStrengthReportingCriteriaResponse_1_5},
+ {RIL_REQUEST_ENABLE_UICC_APPLICATIONS, radio_1_5::enableUiccApplicationsResponse},
+ {RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED, radio_1_5::areUiccApplicationsEnabledResponse},
+ {RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT, radio_1_5::canToggleUiccApplicationsEnablementResponse},
diff --git a/guest/hals/ril/libril/ril_service.cpp b/guest/hals/ril/libril/ril_service.cpp
index 9e009a5..f7bb895 100755
--- a/guest/hals/ril/libril/ril_service.cpp
+++ b/guest/hals/ril/libril/ril_service.cpp
@@ -536,6 +536,9 @@
Return<void> setSignalStrengthReportingCriteria_1_5(int32_t serial,
const ::android::hardware::radio::V1_5::SignalThresholdInfo& signalThresholdInfo,
const ::android::hardware::radio::V1_5::AccessNetwork accessNetwork);
+ Return<void> enableUiccApplications(int32_t serial, bool detach);
+ Return<void> areUiccApplicationsEnabled(int32_t serial);
+ Return<void> canToggleUiccApplicationsEnablement(int32_t serial);
};
struct OemHookImpl : public IOemHook {
@@ -3492,6 +3495,32 @@
return Void();
}
+// radio::V1_5::IRadio methods:
+Return<void> RadioImpl_1_5::enableUiccApplications(int32_t serial, bool enable) {
+#if VDBG
+ RLOGD("enableUiccApplications: serial %d enable %d", serial, enable);
+#endif
+ dispatchInts(serial, mSlotId, RIL_REQUEST_ENABLE_UICC_APPLICATIONS, 1, BOOL_TO_INT(enable));
+ return Void();
+}
+
+Return<void> RadioImpl_1_5::areUiccApplicationsEnabled(int32_t serial) {
+#if VDBG
+ RLOGD("areUiccApplicationsEnabled: serial %d", serial);
+#endif
+ dispatchVoid(serial, mSlotId, RIL_REQUEST_ARE_UICC_APPLICATIONS_ENABLED);
+ return Void();
+}
+
+Return<void> RadioImpl_1_5::canToggleUiccApplicationsEnablement(int32_t serial) {
+#if VDBG
+ RLOGD("canToggleUiccApplicationsEnablement: serial %d.", serial);
+#endif
+ dispatchVoid(serial, mSlotId, RIL_REQUEST_CAN_TOGGLE_UICC_APPLICATIONS_ENABLEMENT);
+ return Void();
+}
+
+// OEM hook methods:
Return<void> OemHookImpl::setResponseFunctions(
const ::android::sp<IOemHookResponse>& oemHookResponseParam,
const ::android::sp<IOemHookIndication>& oemHookIndicationParam) {
@@ -7693,6 +7722,77 @@
return 0;
}
+int radio_1_5::enableUiccApplicationsResponse(int slotId, int responseType, int serial,
+ RIL_Errno e, void* /* response */, size_t responseLen) {
+#if VDBG
+ RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+
+ // If we don't have a radio service, there's nothing we can do
+ if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+ RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+ return 0;
+ }
+
+ Return<void> retStatus =
+ radioService[slotId]->mRadioResponseV1_5->enableUiccApplicationsResponse(
+ responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ return 0;
+}
+
+int radio_1_5::areUiccApplicationsEnabledResponse(int slotId, int responseType, int serial,
+ RIL_Errno e, void* response, size_t responseLen) {
+#if VDBG
+ RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+
+ // If we don't have a radio service, there's nothing we can do
+ if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+ RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+ return 0;
+ }
+
+ bool enable = false;
+ if (response == NULL || responseLen != sizeof(bool)) {
+ RLOGE("isSimDetachedFromNetwork Invalid response.");
+ } else {
+ enable = (*((bool *) response));
+ }
+
+ Return<void> retStatus =
+ radioService[slotId]->mRadioResponseV1_5->areUiccApplicationsEnabledResponse(
+ responseInfo, enable);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ return 0;
+}
+
+int radio_1_5::canToggleUiccApplicationsEnablementResponse(int slotId, int responseType,
+ int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+#if VDBG
+ RLOGD("%s(): %d", __FUNCTION__, serial);
+#endif
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+
+ // If we don't have a radio service, there's nothing we can do
+ if (radioService[slotId]->mRadioResponseV1_5 == NULL) {
+ RLOGE("%s: radioService[%d]->mRadioResponseV1_5 == NULL", __FUNCTION__, slotId);
+ return 0;
+ }
+
+ Return<void> retStatus =
+ radioService[slotId]->mRadioResponseV1_5->canToggleUiccApplicationsEnablementResponse(
+ responseInfo, true);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ return 0;
+}
+
/***************************************************************************************************
* INDICATION FUNCTIONS
* The below function handle unsolicited messages coming from the Radio
diff --git a/guest/hals/ril/libril/ril_service.h b/guest/hals/ril/libril/ril_service.h
index b6ba3e4..8caaaee 100644
--- a/guest/hals/ril/libril/ril_service.h
+++ b/guest/hals/ril/libril/ril_service.h
@@ -782,6 +782,18 @@
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
+int enableUiccApplicationsResponse(int slotId,
+ int responseType, int serial, RIL_Errno e,
+ void *response, size_t responselen);
+
+int areUiccApplicationsEnabledResponse(int slotId,
+ int responseType, int serial, RIL_Errno e,
+ void *response, size_t responselen);
+
+int canToggleUiccApplicationsEnablementResponse(int slotId,
+ int responseType, int serial, RIL_Errno e,
+ void *response, size_t responselen);
+
pthread_rwlock_t * getRadioServiceRwlock(int slotId);
void setNitzTimeReceived(int slotId, long timeReceived);