wifi(interface): Add RTT Controller object

Create a RTT controller object to use for initiating all the RTT related
HAL opertations.
Since we don't want to fix the iface on which to initiate RTT operations,
these methods will be rooted in a new standalone object |RttController|.
Framework can decide to intiate an instance of |RttController| on a
specified iface or let the implementation pick one.

Bug: 31991232
Test: Interface compiles.
Change-Id: I65f7a7babd72db26ce6549f572abd9ef73700c82
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index e562d89..59ad2c5 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -14,6 +14,7 @@
         "IWifiIface.hal",
         "IWifiNanIface.hal",
         "IWifiP2pIface.hal",
+        "IWifiRttController.hal",
         "IWifiStaIface.hal",
     ],
     out: [
@@ -26,6 +27,7 @@
         "android/hardware/wifi/1.0/WifiIfaceAll.cpp",
         "android/hardware/wifi/1.0/WifiNanIfaceAll.cpp",
         "android/hardware/wifi/1.0/WifiP2pIfaceAll.cpp",
+        "android/hardware/wifi/1.0/WifiRttControllerAll.cpp",
         "android/hardware/wifi/1.0/WifiStaIfaceAll.cpp",
     ],
 }
@@ -44,6 +46,7 @@
         "IWifiIface.hal",
         "IWifiNanIface.hal",
         "IWifiP2pIface.hal",
+        "IWifiRttController.hal",
         "IWifiStaIface.hal",
     ],
     out: [
@@ -88,6 +91,11 @@
         "android/hardware/wifi/1.0/BnWifiP2pIface.h",
         "android/hardware/wifi/1.0/BpWifiP2pIface.h",
         "android/hardware/wifi/1.0/BsWifiP2pIface.h",
+        "android/hardware/wifi/1.0/IWifiRttController.h",
+        "android/hardware/wifi/1.0/IHwWifiRttController.h",
+        "android/hardware/wifi/1.0/BnWifiRttController.h",
+        "android/hardware/wifi/1.0/BpWifiRttController.h",
+        "android/hardware/wifi/1.0/BsWifiRttController.h",
         "android/hardware/wifi/1.0/IWifiStaIface.h",
         "android/hardware/wifi/1.0/IHwWifiStaIface.h",
         "android/hardware/wifi/1.0/BnWifiStaIface.h",
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index b171a6d..58c487b 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -116,10 +116,14 @@
 $(GEN): $(LOCAL_PATH)/IWifiApIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
@@ -230,6 +234,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifiStaIface.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
@@ -364,10 +387,14 @@
 $(GEN): $(LOCAL_PATH)/IWifiApIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiNanIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiP2pIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
@@ -478,6 +505,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IWifiRttController.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiRttController.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiRttController.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava -randroid.hardware:hardware/interfaces \
+        android.hardware.wifi@1.0::IWifiRttController
+
+$(GEN): $(LOCAL_PATH)/IWifiRttController.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifiStaIface.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 2ee133a..cd4b219 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -17,10 +17,12 @@
 package android.hardware.wifi@1.0;
 
 import IWifiChipEventCallback;
+import IWifiIface;
 import IWifiApIface;
 import IWifiNanIface;
 import IWifiP2pIface;
 import IWifiStaIface;
+import IWifiRttController;
 
 /**
  * Interface that represents a chip that must be configured as a single unit.
@@ -302,4 +304,18 @@
    *         it exists, null otherwise.
    */
   getStaIface(string ifname) generates (IWifiStaIface iface);
+
+  /**
+   * Create a RTTController instance.
+   *
+   * RTT controller can be either:
+   * a) Bound to a specific iface by passing in the corresponding |IWifiIface|
+   * object in |iface| param, OR
+   * b) Let the implementation decide the iface to use for RTT operations by
+   * passing null in |iface| param.
+   *
+   * @param boundIface HIDL interface object representing the iface if
+   *        the responder must be bound to a specific iface, null otherwise.
+   */
+  createRttController(IWifiIface boundIface) generates (IWifiRttController rtt);
 };
diff --git a/wifi/1.0/IWifiRttController.hal b/wifi/1.0/IWifiRttController.hal
new file mode 100644
index 0000000..d735da7
--- /dev/null
+++ b/wifi/1.0/IWifiRttController.hal
@@ -0,0 +1,32 @@
+/*
+ * Copyright 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.
+ * 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.wifi@1.0;
+
+import IWifiIface;
+
+/**
+ * Interface used to perform RTT operations.
+ */
+interface IWifiRttController {
+  /**
+   * Get the iface on which the RTT operations will be performed.
+   *
+   * @return boundIface HIDL interface object representing the iface if bound
+   *         to a specific iface, null otherwise
+   */
+  getBoundIface() generates (IWifiIface boundIface);
+};