wifi(interface): Add Iface objects

Create a child object under IWifiChip to represent each interface
within the chip. Each iface object has a |type| & |ifname| which should
help us uniquely identify them. This should help us expose methods that
are applicable only to a specific interface type.

While there,
Assign a unique id to every chip on the device.
Add IWifi.listChipIds() to retrieve the list of chip Id's avaiable on the
device. IWifi.getChip() will now use the provided Id to retrieve the
corresponding IWifiChip object(because HIDL language doesn't support
vec<HIDL objects>).

Bug: 31943042
Bug: 32003988
Test: Interface compiles (not implementation)
Change-Id: I723007566ca4220362c02d0f452753fee4e31fce
diff --git a/wifi/1.0/Android.bp b/wifi/1.0/Android.bp
index 07e17ef..e562d89 100644
--- a/wifi/1.0/Android.bp
+++ b/wifi/1.0/Android.bp
@@ -7,16 +7,26 @@
     srcs: [
         "types.hal",
         "IWifi.hal",
+        "IWifiApIface.hal",
         "IWifiChip.hal",
         "IWifiChipEventCallback.hal",
         "IWifiEventCallback.hal",
+        "IWifiIface.hal",
+        "IWifiNanIface.hal",
+        "IWifiP2pIface.hal",
+        "IWifiStaIface.hal",
     ],
     out: [
         "android/hardware/wifi/1.0/types.cpp",
         "android/hardware/wifi/1.0/WifiAll.cpp",
+        "android/hardware/wifi/1.0/WifiApIfaceAll.cpp",
         "android/hardware/wifi/1.0/WifiChipAll.cpp",
         "android/hardware/wifi/1.0/WifiChipEventCallbackAll.cpp",
         "android/hardware/wifi/1.0/WifiEventCallbackAll.cpp",
+        "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/WifiStaIfaceAll.cpp",
     ],
 }
 
@@ -27,9 +37,14 @@
     srcs: [
         "types.hal",
         "IWifi.hal",
+        "IWifiApIface.hal",
         "IWifiChip.hal",
         "IWifiChipEventCallback.hal",
         "IWifiEventCallback.hal",
+        "IWifiIface.hal",
+        "IWifiNanIface.hal",
+        "IWifiP2pIface.hal",
+        "IWifiStaIface.hal",
     ],
     out: [
         "android/hardware/wifi/1.0/types.h",
@@ -38,6 +53,11 @@
         "android/hardware/wifi/1.0/BnWifi.h",
         "android/hardware/wifi/1.0/BpWifi.h",
         "android/hardware/wifi/1.0/BsWifi.h",
+        "android/hardware/wifi/1.0/IWifiApIface.h",
+        "android/hardware/wifi/1.0/IHwWifiApIface.h",
+        "android/hardware/wifi/1.0/BnWifiApIface.h",
+        "android/hardware/wifi/1.0/BpWifiApIface.h",
+        "android/hardware/wifi/1.0/BsWifiApIface.h",
         "android/hardware/wifi/1.0/IWifiChip.h",
         "android/hardware/wifi/1.0/IHwWifiChip.h",
         "android/hardware/wifi/1.0/BnWifiChip.h",
@@ -53,6 +73,26 @@
         "android/hardware/wifi/1.0/BnWifiEventCallback.h",
         "android/hardware/wifi/1.0/BpWifiEventCallback.h",
         "android/hardware/wifi/1.0/BsWifiEventCallback.h",
+        "android/hardware/wifi/1.0/IWifiIface.h",
+        "android/hardware/wifi/1.0/IHwWifiIface.h",
+        "android/hardware/wifi/1.0/BnWifiIface.h",
+        "android/hardware/wifi/1.0/BpWifiIface.h",
+        "android/hardware/wifi/1.0/BsWifiIface.h",
+        "android/hardware/wifi/1.0/IWifiNanIface.h",
+        "android/hardware/wifi/1.0/IHwWifiNanIface.h",
+        "android/hardware/wifi/1.0/BnWifiNanIface.h",
+        "android/hardware/wifi/1.0/BpWifiNanIface.h",
+        "android/hardware/wifi/1.0/BsWifiNanIface.h",
+        "android/hardware/wifi/1.0/IWifiP2pIface.h",
+        "android/hardware/wifi/1.0/IHwWifiP2pIface.h",
+        "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/IWifiStaIface.h",
+        "android/hardware/wifi/1.0/IHwWifiStaIface.h",
+        "android/hardware/wifi/1.0/BnWifiStaIface.h",
+        "android/hardware/wifi/1.0/BpWifiStaIface.h",
+        "android/hardware/wifi/1.0/BsWifiStaIface.h",
     ],
 }
 
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index e211ca8..b171a6d 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -47,6 +47,23 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.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::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifi.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -57,6 +74,8 @@
 $(GEN): $(LOCAL_PATH)/IWifiChip.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
 $(GEN): PRIVATE_CUSTOM_TOOL = \
         $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -68,14 +87,41 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.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::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifiChip.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.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)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
 $(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -125,6 +171,82 @@
 $(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.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::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.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::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.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::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.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::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_JAVA_LIBRARY)
 
 
@@ -173,6 +295,23 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (IfaceType)
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IfaceType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.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::types.IfaceType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifi.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifi.java
@@ -183,6 +322,8 @@
 $(GEN): $(LOCAL_PATH)/IWifiChip.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
 $(GEN): PRIVATE_CUSTOM_TOOL = \
         $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -194,14 +335,41 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build IWifiApIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiApIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiApIface.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::IWifiApIface
+
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build IWifiChip.hal
 #
 GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiChip.java
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiApIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiApIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/IWifiChipEventCallback.hal
 $(GEN): $(LOCAL_PATH)/IWifiChipEventCallback.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)/IWifiStaIface.hal
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
 $(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
 $(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
@@ -251,6 +419,82 @@
 $(GEN): $(LOCAL_PATH)/IWifiEventCallback.hal
 	$(transform-generated-source)
 LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiIface.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.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::IWifiIface
+
+$(GEN): $(LOCAL_PATH)/IWifiIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiNanIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiNanIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiNanIface.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::IWifiNanIface
+
+$(GEN): $(LOCAL_PATH)/IWifiNanIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiP2pIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiP2pIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiP2pIface.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::IWifiP2pIface
+
+$(GEN): $(LOCAL_PATH)/IWifiP2pIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build IWifiStaIface.hal
+#
+GEN := $(intermediates)/android/hardware/wifi/1.0/IWifiStaIface.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiStaIface.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::IWifiStaIface
+
+$(GEN): $(LOCAL_PATH)/IWifiStaIface.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
 
diff --git a/wifi/1.0/IWifi.hal b/wifi/1.0/IWifi.hal
index d1311f5..9e09348 100644
--- a/wifi/1.0/IWifi.hal
+++ b/wifi/1.0/IWifi.hal
@@ -70,10 +70,22 @@
   @callflow(next={"registerEventCallback", "start", "stop"})
   oneway stop();
 
-  // TODO(b/30570663) return vec<IWifiChip> instead
   /**
-   * Get the configurable chip on the device.
+   * Retrieve the list of all chip Id's on the device.
+   * The corresponding |IWifiChip| object for any chip can be
+   * retrieved using |getChip| method.
+   *
+   * @return chipIds List of all chip Id's on the device.
    */
   @callflow(next={"*"})
-  getChip() generates (IWifiChip chip);
+  getChipIds() generates (vec<ChipId> chipIds);
+
+  /**
+   * Gets a HIDL interface object for the chip corresponding to the
+   * provided chipId.
+   *
+   * @return chip HIDL interface object representing the chip.
+   */
+  @callflow(next={"*"})
+  getChip(ChipId chipId) generates (IWifiChip chip);
 };
diff --git a/wifi/1.0/IWifiApIface.hal b/wifi/1.0/IWifiApIface.hal
new file mode 100644
index 0000000..6bc3580
--- /dev/null
+++ b/wifi/1.0/IWifiApIface.hal
@@ -0,0 +1,26 @@
+/*
+ * 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 represent a single AP iface.
+ */
+interface IWifiApIface extends IWifiIface {
+  /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 7a41ddf..2ee133a 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -17,6 +17,10 @@
 package android.hardware.wifi@1.0;
 
 import IWifiChipEventCallback;
+import IWifiApIface;
+import IWifiNanIface;
+import IWifiP2pIface;
+import IWifiStaIface;
 
 /**
  * Interface that represents a chip that must be configured as a single unit.
@@ -24,15 +28,6 @@
  * to perform operations like NAN, RTT, etc.
  */
 interface IWifiChip {
-  enum IfaceType : uint32_t {
-    STA, AP, P2P,
-    /**
-     * NAN control interface. Datapath support may be queried and created
-     * through this interface.
-     */
-    NAN,
-  };
-
   /**
    * Set of interface types with the maximum number of interfaces that can have
    * one of the specified type for a given ChipIfaceCombination. See
@@ -122,6 +117,13 @@
   };
 
   /**
+   * Get the id assigned to this chip.
+   *
+   * @return id Assigned chip Id.
+   */
+  getId() generates (ChipId id);
+
+  /**
    * Requests notifications of significant events on this chip. Multiple calls
    * to this will register multiple callbacks each of which will receive all
    * events.
@@ -176,4 +178,128 @@
    * success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure.
    */
   oneway requestFirmwareDebugDump();
+
+  /**
+   * Create an AP iface on the chip.
+   *
+   * Depending on the mode the chip is configured in, the interface creation
+   * may fail if we've already reached the maximum allowed
+   * (specified in |ChipIfaceCombination|) number of ifaces of the AP type.
+   *
+   * @return iface HIDL interface object representing the iface if
+   *         successful, null otherwise.
+   */
+  createApIface() generates (IWifiApIface iface);
+
+  /**
+   * List all the AP iface names configured on the chip.
+   * The corresponding |IWifiApIface| object for any iface are
+   * retrieved using |getApIface| method.
+   *
+   * @return ifnames List of all AP iface names on the chip.
+   */
+  getApIfaceNames() generates (vec<string> ifnames);
+
+  /**
+   * Gets a HIDL interface object for the AP Iface corresponding
+   * to the provided ifname.
+   *
+   * @param ifname Name of the iface.
+   * @return iface HIDL interface object representing the iface if
+   *         it exists, null otherwise.
+   */
+  getApIface(string ifname) generates (IWifiApIface iface);
+
+  /**
+   * Create a NAN iface on the chip.
+   *
+   * Depending on the mode the chip is configured in, the interface creation
+   * may fail if we've already reached the maximum allowed
+   * (specified in |ChipIfaceCombination|) number of ifaces of the NAN type.
+   *
+   * @return iface HIDL interface object representing the iface if
+   *         successful, null otherwise.
+   */
+  createNanIface() generates (IWifiNanIface iface);
+
+  /**
+   * List all the NAN iface names configured on the chip.
+   * The corresponding |IWifiNanIface| object for any iface are
+   * retrieved using |getNanIface| method.
+   *
+   * @return ifnames List of all NAN iface names on the chip.
+   */
+  getNanIfaceNames() generates (vec<string> ifnames);
+
+  /**
+   * Gets a HIDL interface object for the NAN Iface corresponding
+   * to the provided ifname.
+   *
+   * @param ifname Name of the iface.
+   * @return iface HIDL interface object representing the iface if
+   *         it exists, null otherwise.
+   */
+  getNanIface(string ifname) generates (IWifiNanIface iface);
+
+  /**
+   * Create a P2P iface on the chip.
+   *
+   * Depending on the mode the chip is configured in, the interface creation
+   * may fail if we've already reached the maximum allowed
+   * (specified in |ChipIfaceCombination|) number of ifaces of the P2P type.
+   *
+   * @return iface HIDL interface object representing the iface if
+   *         successful, null otherwise.
+   */
+  createP2pIface() generates (IWifiP2pIface iface);
+
+  /**
+   * List all the P2P iface names configured on the chip.
+   * The corresponding |IWifiP2pIface| object for any iface are
+   * retrieved using |getP2pIface| method.
+   *
+   * @return ifnames List of all P2P iface names on the chip.
+   */
+  getP2pIfaceNames() generates (vec<string> ifnames);
+
+  /**
+   * Gets a HIDL interface object for the P2P Iface corresponding
+   * to the provided ifname.
+   *
+   * @param ifname Name of the iface.
+   * @return iface HIDL interface object representing the iface if
+   *         it exists, null otherwise.
+   */
+  getP2pIface(string ifname) generates (IWifiP2pIface iface);
+
+  /**
+   * Create an STA iface on the chip.
+   *
+   * Depending on the mode the chip is configured in, the interface creation
+   * may fail if we've already reached the maximum allowed
+   * (specified in |ChipIfaceCombination|) number of ifaces of the STA type.
+   *
+   * @return iface HIDL interface object representing the iface if
+   *         successful, null otherwise.
+   */
+  createStaIface() generates (IWifiStaIface iface);
+
+  /**
+   * List all the STA iface names configured on the chip.
+   * The corresponding |IWifiStaIface| object for any iface are
+   * retrieved using |getStaIface| method.
+   *
+   * @return ifnames List of all STA iface names on the chip.
+   */
+  getStaIfaceNames() generates (vec<string> ifnames);
+
+  /**
+   * Gets a HIDL interface object for the STA Iface corresponding
+   * to the provided ifname.
+   *
+   * @param ifname Name of the iface.
+   * @return iface HIDL interface object representing the iface if
+   *         it exists, null otherwise.
+   */
+  getStaIface(string ifname) generates (IWifiStaIface iface);
 };
diff --git a/wifi/1.0/IWifiIface.hal b/wifi/1.0/IWifiIface.hal
new file mode 100644
index 0000000..f4150e7
--- /dev/null
+++ b/wifi/1.0/IWifiIface.hal
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+/**
+ * Interface used to represent a single iface.
+ */
+interface IWifiIface {
+  /**
+   * Get the type of this iface.
+   *
+   * @return type One of the supported iface types.
+   */
+  getType() generates (IfaceType type);
+
+  /**
+   * Get the name of this iface.
+   *
+   * @return name Name of the iface.
+   */
+  getName() generates (string name);
+};
diff --git a/wifi/1.0/IWifiNanIface.hal b/wifi/1.0/IWifiNanIface.hal
new file mode 100644
index 0000000..dade94c
--- /dev/null
+++ b/wifi/1.0/IWifiNanIface.hal
@@ -0,0 +1,26 @@
+/*
+ * 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 represent a single NAN iface.
+ */
+interface IWifiNanIface extends IWifiIface {
+  /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiP2pIface.hal b/wifi/1.0/IWifiP2pIface.hal
new file mode 100644
index 0000000..243748f
--- /dev/null
+++ b/wifi/1.0/IWifiP2pIface.hal
@@ -0,0 +1,26 @@
+/*
+ * 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 represent a single NAN iface.
+ */
+interface IWifiP2pIface extends IWifiIface {
+  /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal
new file mode 100644
index 0000000..5234c71
--- /dev/null
+++ b/wifi/1.0/IWifiStaIface.hal
@@ -0,0 +1,26 @@
+/*
+ * 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 represent a single STA iface.
+ */
+interface IWifiStaIface extends IWifiIface {
+  /** TODO(rpius): Add methods to the interface. */
+};
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 49849ea..d9abaef 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -16,6 +16,9 @@
 
 package android.hardware.wifi@1.0;
 
+/**
+ * List of failure reasons returned.
+ */
 enum CommandFailureReason : uint32_t {
   UNKNOWN,
   DUPLICATE_COMMAND_ID,
@@ -41,6 +44,25 @@
 };
 
 /**
+ * List of Iface types supported.
+ */
+enum IfaceType : uint32_t {
+  STA,
+  AP,
+  P2P,
+  /**
+   * NAN control interface. Datapath support may be queried and created
+   * through this interface.
+   */
+  NAN,
+};
+
+/**
+ * An identifier assigned to every chip on the device.
+ */
+typedef uint32_t ChipId;
+
+/**
  * An identifier for a mode that the chip can be put in.
  */
 typedef uint32_t ChipModeId;