Ril reconciliation

Test: Local build
Change-Id: Ibc06e91d5f966cf96bead919a6dcbbc243f69712
Merged-In: Ibc06e91d5f966cf96bead919a6dcbbc243f69712
(cherry picked from commit 7274a18a2949de6aade63ed0d67a12bbd093ee8d)
diff --git a/guest/hals/ril/Android.mk b/guest/hals/ril/Android.mk
index 9110c16..e677b1d 100644
--- a/guest/hals/ril/Android.mk
+++ b/guest/hals/ril/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2017 The Android Open Source Project
+# Copyright (C) 2016 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.
@@ -12,8 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# RIL (Radio Interface Layer) and basic modem emulator for GCE.
-
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
@@ -31,11 +29,16 @@
   cuttlefish_auto_resources \
   libbase
 
-LOCAL_C_INCLUDES := bionic device/google/cuttlefish_common
+LOCAL_C_INCLUDES := device/google/cuttlefish_common
+
+LOCAL_CFLAGS += \
+  -Wall \
+  -Werror \
+  $(VSOC_VERSION_CFLAGS)
+
 LOCAL_MODULE:= libvsoc-ril
 LOCAL_MODULE_TAGS := optional
 LOCAL_VENDOR_MODULE := true
-LOCAL_CFLAGS += $(VSOC_VERSION_CFLAGS)
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/guest/hals/ril/vsoc_ril.cpp b/guest/hals/ril/vsoc_ril.cpp
index 0e9a898..60956eb 100644
--- a/guest/hals/ril/vsoc_ril.cpp
+++ b/guest/hals/ril/vsoc_ril.cpp
@@ -31,7 +31,7 @@
 #include "common/libs/net/network_interface_manager.h"
 #include "guest/libs/platform_support/api_level_fixes.h"
 
-#define GCE_RIL_VERSION_STRING "Android VSoC RIL 1.0"
+#define VSOC_RIL_VERSION_STRING "Android VSoC RIL 1.0"
 
 /* Modem Technology bits */
 #define MDM_GSM 0x01
@@ -107,7 +107,8 @@
 // SetUpNetworkInterface configures IP and Broadcast addresses on a RIL
 // controlled network interface.
 // This call returns true, if operation was successful.
-bool SetUpNetworkInterface(const char* ipaddr, int prefixlen, const char* bcaddr) {
+bool SetUpNetworkInterface(const char* ipaddr, int prefixlen,
+                           const char* bcaddr) {
   auto factory = cvd::NetlinkClientFactory::Default();
   std::unique_ptr<cvd::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
   std::unique_ptr<cvd::NetworkInterfaceManager> nm(
@@ -236,19 +237,12 @@
   gce_ril_env->OnRequestComplete(t, RIL_E_SUCCESS, &fail, sizeof(fail));
 };
 
-static void on_data_calllist_changed(void* /*param*/) {
-  request_or_send_data_calllist(NULL);
-}
-
 static void request_data_calllist(void* /*data*/, size_t /*datalen*/,
                                   RIL_Token t) {
   request_or_send_data_calllist(&t);
 }
 
 static void request_setup_data_call(void* data, size_t datalen, RIL_Token t) {
-  const char* apn;
-  char* cmd;
-  int err;
   char** details = static_cast<char**>(data);
   const size_t fields = datalen / sizeof(details[0]);
 
@@ -303,7 +297,7 @@
   }
 
   if (call.connection_type_ != DataCall::kConnTypeIPv4) {
-    ALOGE("Non-IPv4 connections are not supported by GCE RIL.");
+    ALOGE("Non-IPv4 connections are not supported by VSOC RIL.");
     gce_ril_env->OnRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
     return;
   }
@@ -355,12 +349,9 @@
   // lists emptied.
   gDataCalls.clear();
 
-  RIL_RadioState old_state;
-
-  old_state = gRadioPowerState;
-  gRadioPowerState = new_state;
   gSimStatus = SIM_NOT_READY;
-  ALOGV("RIL_RadioState change %d to %d", old_state, new_state);
+  ALOGV("RIL_RadioState change %d to %d", gRadioPowerState, new_state);
+  gRadioPowerState = new_state;
 
   if (new_state == RADIO_STATE_OFF) {
     TearDownNetworkInterface();
@@ -377,24 +368,11 @@
 }
 
 // returns 1 if on, 0 if off, and -1 on error
-static char is_radio_on() {
-  RIL_RadioState state;
-
-  state = gRadioPowerState;
-
-  return state == RADIO_STATE_ON;
-}
-
 static void request_radio_power(void* data, size_t /*datalen*/, RIL_Token t) {
   int on = ((int*)data)[0];
   set_radio_state(on ? RADIO_STATE_ON : RADIO_STATE_OFF, t);
 }
 
-static void send_call_state_changed(void* /*param*/) {
-  gce_ril_env->OnUnsolicitedResponse(RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED,
-                                     NULL, 0);
-}
-
 // TODO(ender): this should be a class member. Move where it belongs.
 struct CallState {
   RIL_CallState state;  // e.g. RIL_CALL_HOLDING;
@@ -919,7 +897,6 @@
 static const RIL_PreferredNetworkType gModemDefaultType =
     PREF_NET_TYPE_LTE_GSM_WCDMA;
 static RIL_PreferredNetworkType gModemCurrentType = gModemDefaultType;
-static RIL_RadioTechnology gModemTechnology = RADIO_TECH_LTE;
 static RIL_RadioTechnology gModemVoiceTechnology = RADIO_TECH_LTE;
 
 // Report technology change.
@@ -1406,8 +1383,8 @@
 }
 
 static const char* gce_ril_get_version(void) {
-  ALOGV("Reporting GCE version " GCE_RIL_VERSION_STRING);
-  return GCE_RIL_VERSION_STRING;
+  ALOGV("Reporting VSOC version " VSOC_RIL_VERSION_STRING);
+  return VSOC_RIL_VERSION_STRING;
 }
 
 static int s_cell_info_rate_ms = INT_MAX;
@@ -1626,10 +1603,6 @@
   const char* smsc = ((const char**)data)[0];
   if (smsc == NULL) smsc = &kDefaultSMSC[0];
 
-  // PDU in hex-encoded string.
-  const char* pdu = ((const char**)data)[1];
-  int pdu_length = strlen(pdu) / 2;
-
   response.messageRef = gNextSmsMessageId++;
   response.ackPDU = NULL;
   response.errorCode = 0;
@@ -2136,9 +2109,6 @@
 static void request_facility_lock(void* data, size_t /*datalen*/, RIL_Token t) {
   char** data_vec = (char**)data;
 
-  int data_vec_len = atoi(data_vec[1]);
-  char* result_vec;
-
   // TODO(ender): implement this; essentially: AT+CLCK
   // See http://www.activexperts.com/sms-component/at/commands/?at=%2BCLCK
   // and
@@ -2213,8 +2183,6 @@
 
 static void gce_ril_on_request(int request, void* data, size_t datalen,
                                RIL_Token t) {
-  int err;
-
   // Ignore all requests except RIL_REQUEST_GET_SIM_STATUS
   // when RADIO_STATE_UNAVAILABLE.
   if (gRadioPowerState == RADIO_STATE_UNAVAILABLE &&
@@ -2469,10 +2437,10 @@
   }
 }
 
-#define GCE_RIL_VERSION 6
+#define VSOC_RIL_VERSION 6
 
 static const RIL_RadioFunctions ril_callbacks = {
-    GCE_RIL_VERSION,     gce_ril_on_request, gce_ril_current_state,
+    VSOC_RIL_VERSION,     gce_ril_on_request, gce_ril_current_state,
     gce_ril_on_supports, gce_ril_on_cancel,  gce_ril_get_version};
 
 extern "C" {
diff --git a/guest/hals/ril/vsoc_ril.h b/guest/hals/ril/vsoc_ril.h
index 44000e7..e7d03d8 100644
--- a/guest/hals/ril/vsoc_ril.h
+++ b/guest/hals/ril/vsoc_ril.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2006 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.
@@ -14,18 +14,15 @@
  * limitations under the License.
  */
 
-#ifndef GUEST_RIL_VSOC_RIL_H_
-#define GUEST_RIL_VSOC_RIL_H_
+#pragma once
 
 #define RIL_SHLIB
 
 #define LOG_TAG "VSoCRil"
 
-#include <stdlib.h>
-#include <stdint.h>
 #include <cutils/log.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/time.h>
 #include <telephony/ril.h>
 #include <telephony/ril_cdma_sms.h>
-#include <sys/time.h>
-
-#endif  // GUEST_RIL_VSOC_RIL_H_