Add default implementation of getModemStackStatus for cuttlefish

Bug: 125482193
Test: build
Change-Id: I87d75065f06da882b61c91925c3f4caf9b70e328
diff --git a/guest/hals/ril/cuttlefish_ril.cpp b/guest/hals/ril/cuttlefish_ril.cpp
index 8afe3b6..9940c8a 100644
--- a/guest/hals/ril/cuttlefish_ril.cpp
+++ b/guest/hals/ril/cuttlefish_ril.cpp
@@ -2302,6 +2302,13 @@
   gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
   return;
 }
+
+static void request_get_modem_stack_status(int /*request*/, RIL_Token t) {
+  ALOGV("Getting modem stack status - void");
+  gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, NULL, 0);
+  return;
+}
+
 #endif
 
 static void gce_ril_on_request(int request, void* data, size_t datalen,
@@ -2544,6 +2551,9 @@
     case RIL_REQUEST_START_NETWORK_SCAN4:
       request_start_network_scan4(t);
       break;
+    case RIL_REQUEST_GET_MODEM_STACK_STATUS:
+      request_get_modem_stack_status(request, t);
+      break;
     case RIL_REQUEST_EMERGENCY_DIAL:
       request_emergency_dial(request, data, datalen, t);
       break;
diff --git a/guest/hals/ril/libril/ril.h b/guest/hals/ril/libril/ril.h
index f30a265..289e590 100644
--- a/guest/hals/ril/libril/ril.h
+++ b/guest/hals/ril/libril/ril.h
@@ -90,6 +90,7 @@
  *                    RIL_REQUEST_START_NETWORK_SCAN
  *                    RIL_REQUEST_STOP_NETWORK_SCAN
  *                    RIL_UNSOL_NETWORK_SCAN_RESULT
+ *                    RIL_REQUEST_GET_MODEM_STACK_STATUS
  */
 #define RIL_VERSION 12
 #define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name
@@ -6360,6 +6361,20 @@
  */
 #define RIL_REQUEST_START_NETWORK_SCAN4 146
 
+/**
+ * RIL_REQUEST_GET_MODEM_STACK_STATUS
+ *
+ * Request status of a logical modem
+ *
+ * Valid errors:
+ *  SUCCESS
+ *  RADIO_NOT_AVAILABLE
+ *  MODEM_ERR
+ *
+ */
+#define RIL_REQUEST_GET_MODEM_STACK_STATUS 147
+
+
 /** FIXME: define value based on the s_commands or unsol_response index when implement.
  * RIL_REQUEST_EMERGENCY_DIAL
  *
diff --git a/guest/hals/ril/libril/ril_commands.h b/guest/hals/ril/libril/ril_commands.h
index 95f8c51..f4b66a3 100644
--- a/guest/hals/ril/libril/ril_commands.h
+++ b/guest/hals/ril/libril/ril_commands.h
@@ -161,3 +161,4 @@
     {RIL_REQUEST_START_KEEPALIVE, radio_1_4::startKeepaliveResponse},
     {RIL_REQUEST_STOP_KEEPALIVE, radio_1_4::stopKeepaliveResponse},
     {RIL_REQUEST_START_NETWORK_SCAN4, radio_1_4::startNetworkScanResponse4},
+    {RIL_REQUEST_GET_MODEM_STACK_STATUS, radio_1_4::getModemStackStatusResponse},
diff --git a/guest/hals/ril/libril/ril_service.cpp b/guest/hals/ril/libril/ril_service.cpp
index ce14d17..aa18e57 100755
--- a/guest/hals/ril/libril/ril_service.cpp
+++ b/guest/hals/ril/libril/ril_service.cpp
@@ -3151,11 +3151,11 @@
     return Void();
 }
 
-Return<void> RadioImpl_1_4::getModemStackStatus(int32_t /* serial */) {
-    // TODO implement
+Return<void> RadioImpl_1_4::getModemStackStatus(int32_t serial) {
 #if VDBG
-    RLOGE("[%04d]< %s", serial, "Method is not implemented");
+    RLOGD("getModemStackStatus: serial %d", serial);
 #endif
+    dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_MODEM_STACK_STATUS);
     return Void();
 }
 
@@ -7158,6 +7158,27 @@
     return 0;
 }
 
+int radio_1_4::getModemStackStatusResponse(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_4 == NULL) {
+        RLOGE("%s: radioService[%d]->mRadioResponseV1_4 == NULL", __FUNCTION__, slotId);
+        return 0;
+    }
+
+    Return<void> retStatus =
+            radioService[slotId]->mRadioResponseV1_4->getModemStackStatusResponse(
+            responseInfo, true);
+    radioService[slotId]->checkReturnStatus(retStatus);
+    return 1;
+}
+
 int radio_1_4::sendRequestRawResponse(int slotId,
                                   int responseType, int serial, RIL_Errno e,
                                   void *response, size_t responseLen) {
diff --git a/guest/hals/ril/libril/ril_service.h b/guest/hals/ril/libril/ril_service.h
index 6d8f379..cad4b10 100644
--- a/guest/hals/ril/libril/ril_service.h
+++ b/guest/hals/ril/libril/ril_service.h
@@ -525,6 +525,10 @@
                                 int responseType, int serial, RIL_Errno e,
                                 void *response, size_t responselen);
 
+int getModemStackStatusResponse(int slotId,
+                                int responseType, int serial, RIL_Errno e,
+                                void *response, size_t responselen);
+
 int setAllowedCarriersResponse(int slotId,
                               int responseType, int serial, RIL_Errno e,
                               void *response, size_t responselen);