Create separate interface for oem hook.

Test: Basic telephony sanity
Bug: 32020264
Bug: 34344851
Change-Id: I8908ce0c6b380c8f4260703fa43125dc03d24dbc
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index bda7d65..baa4df6 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -726,26 +726,6 @@
     oneway getDataCallList(int32_t serial);
 
     /*
-     * This request is reserved for OEM-specific uses. It passes raw byte arrays back and forth.
-     *
-     * @param serial Serial number of request.
-     * @param data data passed as raw bytes to oem
-     *
-     * Response function is IRadioResponse.sendOemRadioRequestRawResponse()
-     */
-    oneway sendOemRadioRequestRaw(int32_t serial, vec<uint8_t> data);
-
-    /*
-     * This request is reserved for OEM-specific uses. It passes strings back and forth.
-     *
-     * @param serial Serial number of request.
-     * @param data data passed as strings to oem
-     *
-     * Response function is IRadioResponse.sendOemRadioRequestStringsResponse()
-     */
-    oneway sendOemRadioRequestStrings(int32_t serial, vec<string> data);
-
-    /*
      * Indicates the current state of the screen. When the screen is off, the
      * Radio must notify the baseband to suppress certain notifications (eg,
      * signal strength and changes in LAC/CID or BID/SID/NID/latitude/longitude)
diff --git a/radio/1.0/IRadioIndication.hal b/radio/1.0/IRadioIndication.hal
index 81ac13a..0b95821 100644
--- a/radio/1.0/IRadioIndication.hal
+++ b/radio/1.0/IRadioIndication.hal
@@ -293,14 +293,6 @@
    oneway cdmaInfoRec(RadioIndicationType type, CdmaInformationRecords records);
 
    /*
-    * This is for OEM specific use.
-    *
-    * @param type Type of radio indication
-    * @param data data passed as raw bytes
-    */
-   oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
-
-   /*
     * Indicates that nework doesn't have in-band information, need to
     * play out-band tone.
     *
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 637f697..11a1d03 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -923,30 +923,6 @@
 
     /*
      * @param info Response info struct containing response type, serial no. and error
-     * @param data data returned by oem
-     *
-     * Valid errors returned:
-     *   RadioError:NONE
-     *   RadioError:RADIO_NOT_AVAILABLE
-     *   RadioError:INVALID_ARGUMENTS
-     *   RadioError:OEM_ERROR_X
-     */
-    oneway sendOemRilRequestRawResponse(RadioResponseInfo info, vec<uint8_t> data);
-
-    /*
-     * @param info Response info struct containing response type, serial no. and error
-     * @param data data returned by oem
-     *
-     * Valid errors returned:
-     *   RadioError:NONE
-     *   RadioError:RADIO_NOT_AVAILABLE
-     *   RadioError:INVALID_ARGUMENTS
-     *   RadioError:OEM_ERROR_X
-     */
-    oneway sendOemRilRequestStringsResponse(RadioResponseInfo info, vec<string> data);
-
-    /*
-     * @param info Response info struct containing response type, serial no. and error
      *
      * Valid errors returned:
      *   RadioError:NONE
diff --git a/radio/Android.bp b/radio/Android.bp
index 33f70eb..8bda000 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -2,4 +2,5 @@
 subdirs = [
     "1.0",
     "1.0/vts/functional",
+    "deprecated/1.0",
 ]
diff --git a/radio/deprecated/1.0/Android.bp b/radio/deprecated/1.0/Android.bp
new file mode 100644
index 0000000..f8a9c64
--- /dev/null
+++ b/radio/deprecated/1.0/Android.bp
@@ -0,0 +1,75 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.radio.deprecated@1.0_hal",
+    srcs: [
+        "IOemHook.hal",
+        "IOemHookIndication.hal",
+        "IOemHookResponse.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio.deprecated@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio.deprecated@1.0",
+    srcs: [
+        ":android.hardware.radio.deprecated@1.0_hal",
+    ],
+    out: [
+        "android/hardware/radio/deprecated/1.0/OemHookAll.cpp",
+        "android/hardware/radio/deprecated/1.0/OemHookIndicationAll.cpp",
+        "android/hardware/radio/deprecated/1.0/OemHookResponseAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio.deprecated@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio.deprecated@1.0",
+    srcs: [
+        ":android.hardware.radio.deprecated@1.0_hal",
+    ],
+    out: [
+        "android/hardware/radio/deprecated/1.0/IOemHook.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHook.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHook.h",
+        "android/hardware/radio/deprecated/1.0/IOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHookIndication.h",
+        "android/hardware/radio/deprecated/1.0/IOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/IHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BnHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BpHwOemHookResponse.h",
+        "android/hardware/radio/deprecated/1.0/BsOemHookResponse.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.radio.deprecated@1.0",
+    generated_sources: ["android.hardware.radio.deprecated@1.0_genc++"],
+    generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio.deprecated@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.radio@1.0",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/radio/deprecated/1.0/Android.mk b/radio/deprecated/1.0/Android.mk
new file mode 100644
index 0000000..4cce633
--- /dev/null
+++ b/radio/deprecated/1.0/Android.mk
@@ -0,0 +1,162 @@
+# This file is autogenerated by hidl-gen. Do not edit manually.
+
+LOCAL_PATH := $(call my-dir)
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_JAVA_LIBRARIES := \
+    android.hardware.radio@1.0-java \
+    android.hidl.base@1.0-java \
+
+
+#
+# Build IOemHook.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHook.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHook.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHook
+
+$(GEN): $(LOCAL_PATH)/IOemHook.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookIndication.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookIndication.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookIndication
+
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookResponse.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookResponse.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookResponse
+
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_JAVA_LIBRARY)
+
+
+################################################################################
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.radio.deprecated@1.0-java-static
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir, COMMON)
+
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android.hardware.radio@1.0-java-static \
+    android.hidl.base@1.0-java-static \
+
+
+#
+# Build IOemHook.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHook.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHook.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHook
+
+$(GEN): $(LOCAL_PATH)/IOemHook.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookIndication.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookIndication.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookIndication.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookIndication
+
+$(GEN): $(LOCAL_PATH)/IOemHookIndication.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IOemHookResponse.hal
+#
+GEN := $(intermediates)/android/hardware/radio/deprecated/V1_0/IOemHookResponse.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOemHookResponse.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio.deprecated@1.0::IOemHookResponse
+
+$(GEN): $(LOCAL_PATH)/IOemHookResponse.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/radio/deprecated/1.0/IOemHook.hal b/radio/deprecated/1.0/IOemHook.hal
new file mode 100644
index 0000000..2b6db65
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHook.hal
@@ -0,0 +1,57 @@
+/**
+ * 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.radio.deprecated@1.0;
+
+import IOemHookResponse;
+import IOemHookIndication;
+
+/**
+ * This interface has APIs for OEM-specific use-cases.
+ * USE OF THIS INTERFACE IS DISCOURATED. IT IS PRESENT ONLY FOR BACKWARD COMPATIBILITY AND WILL BE
+ * REMOVED IN O (ATTEMPTING TO REMOVE IT IN O, BUT IF NOT IN O WILL BE REMOVED IN P).
+ * ALSO NOTE THAT FRAMEWORK EXPECTS THE SERVICE IMPLEMENTING THIS INTERFACE TO RESIDE
+ * IN THE SAME PROCESS AS IRADIO SERVICE.
+ */
+interface IOemHook {
+    /**
+     * Set response functions for oem hook requests & oem hook indications.
+     *
+     * @param oemHookResponse Object containing response functions
+     * @param oemHookIndication Object containing oem hook indications
+     */
+    setResponseFunctions(IOemHookResponse oemHookResponse, IOemHookIndication oemHookIndication);
+
+    /**
+     * This request passes raw byte arrays between framework and vendor code.
+     *
+     * @param serial Serial number of request.
+     * @param data data passed as raw bytes
+     *
+     * Response function is IOemHookResponse.sendRequestRawResponse()
+     */
+    oneway sendRequestRaw(int32_t serial, vec<uint8_t> data);
+
+    /**
+     * This request passes strings between framework and vendor code.
+     *
+     * @param serial Serial number of request.
+     * @param data data passed as strings
+     *
+     * Response function is IOemHookResponse.sendRequestStringsResponse()
+     */
+    oneway sendRequestStrings(int32_t serial, vec<string> data);
+};
\ No newline at end of file
diff --git a/radio/deprecated/1.0/IOemHookIndication.hal b/radio/deprecated/1.0/IOemHookIndication.hal
new file mode 100644
index 0000000..936779f
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHookIndication.hal
@@ -0,0 +1,32 @@
+/*
+ * 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.radio.deprecated@1.0;
+
+import android.hardware.radio@1.0::types;
+
+/*
+ * Interface declaring unsolicited oem hook indications.
+ */
+interface IOemHookIndication {
+   /*
+    * This is for OEM specific use.
+    *
+    * @param type Type of radio indication
+    * @param data data passed as raw bytes
+    */
+   oneway oemHookRaw(RadioIndicationType type, vec<uint8_t> data);
+};
\ No newline at end of file
diff --git a/radio/deprecated/1.0/IOemHookResponse.hal b/radio/deprecated/1.0/IOemHookResponse.hal
new file mode 100644
index 0000000..4e49acc
--- /dev/null
+++ b/radio/deprecated/1.0/IOemHookResponse.hal
@@ -0,0 +1,50 @@
+/*
+ * 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.radio.deprecated@1.0;
+
+import android.hardware.radio@1.0::types;
+
+/*
+ * Interface declaring response functions to solicited oem hook requests.
+ * Response functions defined in this interface are as per following convention:
+ * <xyz>Response is response to IOemHook.<xyz>
+ */
+interface IOemHookResponse {
+    /*
+     * @param info Response info struct containing response type, serial no. and error
+     * @param data data returned by oem
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:OEM_ERROR_X
+     */
+    oneway sendRequestRawResponse(RadioResponseInfo info, vec<uint8_t> data);
+
+    /*
+     * @param info Response info struct containing response type, serial no. and error
+     * @param data data returned by oem
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:OEM_ERROR_X
+     */
+    oneway sendRequestStringsResponse(RadioResponseInfo info, vec<string> data);
+};
\ No newline at end of file