Enhanced network scan request

Bug=63865942

Test: Verified by making changes in settings app to call the api
      and confirmed that the new information is delivered to verndor
      code

Change-Id: I38f5e88302268bdda7483f5bc96bf8a72b940208
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
new file mode 100644
index 0000000..d6535f5
--- /dev/null
+++ b/radio/1.2/Android.bp
@@ -0,0 +1,197 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.radio@1.2_hal",
+    srcs: [
+        "types.hal",
+        "IRadio.hal",
+        "ISap.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/types.cpp",
+        "android/hardware/radio/1.2/RadioAll.cpp",
+        "android/hardware/radio/1.2/SapAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/types.h",
+        "android/hardware/radio/1.2/hwtypes.h",
+        "android/hardware/radio/1.2/IRadio.h",
+        "android/hardware/radio/1.2/IHwRadio.h",
+        "android/hardware/radio/1.2/BnHwRadio.h",
+        "android/hardware/radio/1.2/BpHwRadio.h",
+        "android/hardware/radio/1.2/BsRadio.h",
+        "android/hardware/radio/1.2/ISap.h",
+        "android/hardware/radio/1.2/IHwSap.h",
+        "android/hardware/radio/1.2/BnHwSap.h",
+        "android/hardware/radio/1.2/BpHwSap.h",
+        "android/hardware/radio/1.2/BsSap.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.radio@1.2",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.radio@1.2_genc++"],
+    generated_headers: ["android.hardware.radio@1.2_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.2_genc++_headers"],
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio-V1.2-java_gen_java",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Ljava -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/V1_2/IncrementalResultsPeriodicityRange.java",
+        "android/hardware/radio/V1_2/MaxSearchTimeRange.java",
+        "android/hardware/radio/V1_2/NetworkScanRequest.java",
+        "android/hardware/radio/V1_2/RadioConst.java",
+        "android/hardware/radio/V1_2/ScanIntervalRange.java",
+        "android/hardware/radio/V1_2/IRadio.java",
+        "android/hardware/radio/V1_2/ISap.java",
+    ],
+}
+
+java_library {
+    name: "android.hardware.radio-V1.2-java",
+    no_framework_libs: true,
+    defaults: ["hidl-java-module-defaults"],
+    srcs: [":android.hardware.radio-V1.2-java_gen_java"],
+    libs: [
+        "hwbinder",
+        "android.hardware.radio-V1.0-java",
+        "android.hardware.radio-V1.1-java",
+        "android.hidl.base-V1.0-java",
+    ]
+}
+
+// This package does not export any types. Not creating java constants export.
+
+
+genrule {
+    name: "android.hardware.radio@1.2-adapter-helper_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/ARadio.cpp",
+        "android/hardware/radio/1.2/ASap.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2-adapter-helper_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    srcs: [
+        ":android.hardware.radio@1.2_hal",
+    ],
+    out: [
+        "android/hardware/radio/1.2/ARadio.h",
+        "android/hardware/radio/1.2/ASap.h",
+    ],
+}
+
+cc_library {
+    name: "android.hardware.radio@1.2-adapter-helper",
+    defaults: ["hidl-module-defaults"],
+    generated_sources: ["android.hardware.radio@1.2-adapter-helper_genc++"],
+    generated_headers: ["android.hardware.radio@1.2-adapter-helper_genc++_headers"],
+    export_generated_headers: ["android.hardware.radio@1.2-adapter-helper_genc++_headers"],
+    vendor_available: true,
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "libhidladapter",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.0-adapter-helper",
+        "android.hardware.radio@1.1-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "libhidladapter",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.0-adapter-helper",
+        "android.hardware.radio@1.1-adapter-helper",
+        "android.hidl.base@1.0-adapter-helper",
+    ],
+}
+
+genrule {
+    name: "android.hardware.radio@1.2-adapter_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++-adapter-main -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.radio@1.2",
+    out: ["main.cpp"]
+}
+
+cc_test {
+    name: "android.hardware.radio@1.2-adapter",
+    defaults: ["hidl-module-defaults"],
+    shared_libs: [
+        "libhidladapter",
+        "libhidlbase",
+        "libhidltransport",
+        "libutils",
+        "android.hardware.radio@1.0",
+        "android.hardware.radio@1.1",
+        "android.hardware.radio@1.2",
+        "android.hardware.radio@1.2-adapter-helper",
+    ],
+    generated_sources: ["android.hardware.radio@1.2-adapter_genc++"],
+}
diff --git a/radio/1.2/IRadio.hal b/radio/1.2/IRadio.hal
new file mode 100644
index 0000000..6ae78a0
--- /dev/null
+++ b/radio/1.2/IRadio.hal
@@ -0,0 +1,40 @@
+/*
+ * 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@1.2;
+
+import @1.1::IRadio;
+
+/**
+ * This interface is used by telephony and telecom to talk to cellular radio.
+ * All the functions have minimum one parameter:
+ * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
+ * duration of a method call. If clients provide colliding serials (including passing the same
+ * serial to different methods), multiple responses (one for each method call) must still be served.
+ * setResponseFunctions must work with @1.1::IRadioResponse and @1.1::IRadioIndication.
+ */
+interface IRadio extends @1.1::IRadio {
+
+    /**
+     * Starts a network scan
+     *
+     * @param serial Serial number of request.
+     * @param request Defines the radio networks/bands/channels which need to be scanned.
+     *
+     * Response function is IRadioResponse.startNetworkScanResponse()
+     */
+    oneway startNetworkScan_1_2(int32_t serial, NetworkScanRequest request);
+};
diff --git a/radio/1.2/ISap.hal b/radio/1.2/ISap.hal
new file mode 100644
index 0000000..757027c
--- /dev/null
+++ b/radio/1.2/ISap.hal
@@ -0,0 +1,25 @@
+/*
+ * 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@1.2;
+
+import @1.1::ISap;
+
+interface ISap extends @1.1::ISap {
+    /**
+     * Empty top level interface.
+     */
+};
diff --git a/radio/1.2/types.hal b/radio/1.2/types.hal
new file mode 100644
index 0000000..381eb85
--- /dev/null
+++ b/radio/1.2/types.hal
@@ -0,0 +1,99 @@
+/*
+ * 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@1.2;
+
+import @1.0::RadioConst;
+import @1.1::RadioAccessSpecifier;
+import @1.1::ScanType;
+
+enum RadioConst : @1.0::RadioConst {
+    RADIO_ACCESS_SPEFICIER_MAX_SIZE = 8,
+};
+
+/**
+ * values are in seconds
+ */
+enum ScanIntervalRange : int32_t {
+    MIN = 5,
+    MAX = 300,
+};
+
+/**
+ * value are in seconds
+ */
+enum MaxSearchTimeRange : int32_t {
+    MIN = 60,
+    MAX = 3600,
+};
+
+/**
+ * values are in seconds
+ */
+enum IncrementalResultsPeriodicityRange : int32_t {
+    MIN = 1,
+    MAX = 10,
+};
+
+struct NetworkScanRequest {
+    ScanType type;
+
+    /**
+     * Time interval in seconds between periodic scans, only valid when type = PERIODIC
+     * Range: ScanIntervalRange:MIN to ScanIntervalRange:MAX
+     */
+    int32_t interval;
+
+    /**
+     * Networks with bands/channels to scan
+     * Maximum length of the vector is
+     * RadioConst:RADIO_ACCESS_SPEFICIER_MAX_SIZE
+     */
+    vec<RadioAccessSpecifier> specifiers;
+
+    /**
+     * Maximum duration of the periodic search (in seconds).
+     * Expected range for the input is [MaxSearchTimeRange:MIN - MaxSearchTimeRange:MAX]
+     * If the search lasts maxSearchTime, it must be terminated.
+     */
+    int32_t maxSearchTime;
+
+    /**
+     * Indicates whether the modem must report incremental results of the network scan
+     * to the client.
+     * FALSE – Incremental results must not be reported.
+     * TRUE  – Incremental must be reported.
+     */
+    bool incrementalResults;
+
+    /**
+     * Indicates the periodicity with which the modem must report incremental results to
+     * the client (in seconds).
+     * Expected range for the input is
+     * [IncrementalResultsPeriodicityRange:MIN - IncrementalResultsPeriodicityRange:MAX]
+     * This value must be less than or equal to maxSearchTime.
+     */
+    int32_t incrementalResultsPeriodicity;
+
+    /**
+     * Describes the List of PLMN ids (MCC-MNC)
+     * If any PLMN of this list is found, search must end at that point and results with all
+     * PLMN found until that point should be sent as response.
+     * If the list is not sent, search to be completed until end and all PLMNs found to be
+     * reported.
+     */
+    vec<string> mccMncs;
+};
diff --git a/radio/Android.bp b/radio/Android.bp
index 0acb2ee..a209d9d 100644
--- a/radio/Android.bp
+++ b/radio/Android.bp
@@ -4,5 +4,6 @@
     "1.0/vts/functional",
     "1.1",
     "1.1/vts/functional",
+    "1.2",
     "deprecated/1.0",
 ]