Merge "wifi: Add capabilitiy flag for ND offload"
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index cad655c..fbec8d1 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -5,13 +5,19 @@
     tools: ["hidl-gen"],
     cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.bar@1.0",
     srcs: [
+        "types.hal",
         "IBar.hal",
         "IComplicated.hal",
+        "IFooCallback.hal",
+        "IImportRules.hal",
         "IImportTypes.hal",
     ],
     out: [
+        "android/hardware/tests/bar/1.0/types.cpp",
         "android/hardware/tests/bar/1.0/BarAll.cpp",
         "android/hardware/tests/bar/1.0/ComplicatedAll.cpp",
+        "android/hardware/tests/bar/1.0/FooCallbackAll.cpp",
+        "android/hardware/tests/bar/1.0/ImportRulesAll.cpp",
         "android/hardware/tests/bar/1.0/ImportTypesAll.cpp",
     ],
 }
@@ -21,11 +27,15 @@
     tools: ["hidl-gen"],
     cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tests.bar@1.0",
     srcs: [
+        "types.hal",
         "IBar.hal",
         "IComplicated.hal",
+        "IFooCallback.hal",
+        "IImportRules.hal",
         "IImportTypes.hal",
     ],
     out: [
+        "android/hardware/tests/bar/1.0/types.h",
         "android/hardware/tests/bar/1.0/IBar.h",
         "android/hardware/tests/bar/1.0/IHwBar.h",
         "android/hardware/tests/bar/1.0/BnHwBar.h",
@@ -36,6 +46,16 @@
         "android/hardware/tests/bar/1.0/BnHwComplicated.h",
         "android/hardware/tests/bar/1.0/BpHwComplicated.h",
         "android/hardware/tests/bar/1.0/BsComplicated.h",
+        "android/hardware/tests/bar/1.0/IFooCallback.h",
+        "android/hardware/tests/bar/1.0/IHwFooCallback.h",
+        "android/hardware/tests/bar/1.0/BnHwFooCallback.h",
+        "android/hardware/tests/bar/1.0/BpHwFooCallback.h",
+        "android/hardware/tests/bar/1.0/BsFooCallback.h",
+        "android/hardware/tests/bar/1.0/IImportRules.h",
+        "android/hardware/tests/bar/1.0/IHwImportRules.h",
+        "android/hardware/tests/bar/1.0/BnHwImportRules.h",
+        "android/hardware/tests/bar/1.0/BpHwImportRules.h",
+        "android/hardware/tests/bar/1.0/BsImportRules.h",
         "android/hardware/tests/bar/1.0/IImportTypes.h",
         "android/hardware/tests/bar/1.0/IHwImportTypes.h",
         "android/hardware/tests/bar/1.0/BnHwImportTypes.h",
diff --git a/tests/bar/1.0/IFooCallback.hal b/tests/bar/1.0/IFooCallback.hal
new file mode 100644
index 0000000..f42ce85
--- /dev/null
+++ b/tests/bar/1.0/IFooCallback.hal
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ * 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.tests.bar@1.0;
+
+interface IFooCallback {
+};
diff --git a/tests/bar/1.0/IImportRules.hal b/tests/bar/1.0/IImportRules.hal
new file mode 100644
index 0000000..db454b0
--- /dev/null
+++ b/tests/bar/1.0/IImportRules.hal
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ * 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.tests.bar@1.0;
+
+import android.hardware.tests.foo@1.0;
+
+interface IImportRules {
+    // Note that there is a android.hardware.tests.foo@1.0::Outer in types.hal
+    struct Outer {
+        struct Inner {
+            int32_t data;
+        };
+        string data;
+    };
+
+    rule0a(Outer o); // should be resolved to Outer above
+    rule0a1(IImportRules.Outer o); // should be resolved to Outer above
+    rule0b(@1.0::IImportRules.Outer o);
+    rule0c(android.hardware.tests.foo@1.0::Outer o);
+    rule0d(@1.0::Outer o); // android.hardware.tests.foo@1.0::Outer
+    rule0e(Outer.Inner o); // should be resolved to Outer above
+    rule0f(@1.0::IImportRules.Outer.Inner o);
+    rule0g(android.hardware.tests.foo@1.0::Outer.Inner o);
+    rule0h(@1.0::Outer.Inner o); // android.hardware.tests.foo@1.0::Outer.Inner
+
+    rule1a(Def abc); // should be resolved to Def in types.hal in this package
+    rule1b(android.hardware.tests.foo@1.0::Def abc);
+
+    rule2a(Unrelated related);
+
+    // android.hardware.tests.foo@1.0::IFooCallback, since bar@1.0::IFooCallback is not imported.
+    rule2b(IFooCallback fooCallback);
+};
diff --git a/tests/bar/1.0/types.hal b/tests/bar/1.0/types.hal
new file mode 100644
index 0000000..30022ad
--- /dev/null
+++ b/tests/bar/1.0/types.hal
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ * 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.tests.bar@1.0;
+
+struct Def {
+    vec<string> vs;
+};
diff --git a/tests/foo/1.0/types.hal b/tests/foo/1.0/types.hal
index a01fc2d..6b4b697 100644
--- a/tests/foo/1.0/types.hal
+++ b/tests/foo/1.0/types.hal
@@ -22,6 +22,10 @@
     handle z;
 };
 
+struct Def {
+    string g;
+};
+
 struct Outer {
     struct Inner {
         struct Deep {
diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
index 35985fc..ddf05cc 100644
--- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal
@@ -537,4 +537,57 @@
    */
   setMiracastMode(MiracastMode mode)
       generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Push Button setup.
+   * The PBC operation requires that a button is also pressed at the
+   * AP/Registrar at about the same time (2 minute window).
+   *
+   * @param groupIfName Group interface name to use.
+   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  startWpsPbc(string groupIfName, Bssid bssid)
+      generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Pin Keypad setup.
+   *
+   * @param groupIfName Group interface name to use.
+   * @param pin 8 digit pin to be used.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  startWpsPinKeypad(string groupIfName, string pin)
+      generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Pin Display setup.
+   *
+   * @param groupIfName Group interface name to use.
+   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   * @return generatedPin 8 digit pin generated.
+   */
+  startWpsPinDisplay(string groupIfName, Bssid bssid)
+      generates (SupplicantStatus status, string generatedPin);
+
+  /**
+   * Cancel any ongoing WPS operations.
+   *
+   * @param groupIfName Group interface name to use.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  cancelWps(string groupIfName) generates (SupplicantStatus status);
 };
diff --git a/wifi/supplicant/1.0/ISupplicantStaIface.hal b/wifi/supplicant/1.0/ISupplicantStaIface.hal
index 2fc4d0f..0f0d41b 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIface.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIface.hal
@@ -319,4 +319,64 @@
    */
   setCountryCode(int8_t[2] code)
       generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS setup in registrar role to learn the current AP configuration.
+   *
+   * @param bssid BSSID of the AP.
+   * @param pin Pin of the AP.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  startWpsRegistrar(Bssid bssid, string pin)
+      generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Push Button setup.
+   * The PBC operation requires that a button is also pressed at the
+   * AP/Registrar at about the same time (2 minute window).
+   *
+   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  startWpsPbc(Bssid bssid) generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Pin Keypad setup.
+   *
+   * @param pin 8 digit pin to be used.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  startWpsPinKeypad(string pin) generates (SupplicantStatus status);
+
+  /**
+   * Initiate WPS Pin Display setup.
+   *
+   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   * @return generatedPin 8 digit pin generated.
+   */
+  startWpsPinDisplay(Bssid bssid)
+      generates (SupplicantStatus status, string generatedPin);
+
+  /**
+   * Cancel any ongoing WPS operations.
+   *
+   * @return status Status of the operation.
+   *         Possible status codes:
+   *         |SupplicantStatusCode.SUCCESS|,
+   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+   */
+  cancelWps() generates (SupplicantStatus status);
 };
diff --git a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
index 8a894a0..55ff9a8 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
@@ -139,6 +139,43 @@
   };
 
   /**
+   * WPS Configuration Error.
+   */
+  enum WpsConfigError : uint16_t {
+    NO_ERROR = 0,
+    OOB_IFACE_READ_ERROR = 1,
+    DECRYPTION_CRC_FAILURE = 2,
+    CHAN_24_NOT_SUPPORTED = 3,
+    CHAN_50_NOT_SUPPORTED = 4,
+    SIGNAL_TOO_WEAK = 5,
+    NETWORK_AUTH_FAILURE = 6,
+    NETWORK_ASSOC_FAILURE = 7,
+    NO_DHCP_RESPONSE = 8,
+    FAILED_DHCP_CONFIG = 9,
+    IP_ADDR_CONFLICT = 10,
+    NO_CONN_TO_REGISTRAR = 11,
+    MULTIPLE_PBC_DETECTED = 12,
+    ROGUE_SUSPECTED = 13,
+    DEVICE_BUSY = 14,
+    SETUP_LOCKED = 15,
+    MSG_TIMEOUT = 16,
+    REG_SESS_TIMEOUT = 17,
+    DEV_PASSWORD_AUTH_FAILURE = 18,
+    CHAN_60G_NOT_SUPPORTED = 19,
+    PUBLIC_KEY_HASH_MISMATCH = 20
+  };
+
+  /**
+   * Vendor specific Error Indication for WPS event messages.
+   */
+  enum WpsErrorIndication : uint16_t {
+    NO_ERROR = 0,
+    SECURITY_TKIP_ONLY_PROHIBITED = 1,
+    SECURITY_WEP_PROHIBITED = 2,
+    AUTH_FAILURE = 3
+  };
+
+  /**
    * Used to indicate that a new network has been added.
    *
    * @param id Network ID allocated to the corresponding network.
@@ -242,4 +279,25 @@
    *        Refer to section 8.4.1.9 of IEEE 802.11 spec.
    */
   oneway onAssociationRejected(Bssid bssid, uint32_t statusCode);
+
+  /**
+   * Used to indicate the success of a WPS connection attempt.
+   */
+  oneway onWpsEventSuccess();
+
+  /**
+   * Used to indicate the failure of a WPS connection attempt.
+   *
+   * @param bssid BSSID of the AP to which we initiated WPS
+   *        connection.
+   * @param configError Configuration error code.
+   * @param errorInd Error indication code.
+   */
+  oneway onWpsEventFail(
+      Bssid bssid, WpsConfigError configError, WpsErrorIndication errorInd);
+
+  /**
+   * Used to indicate the overlap of a WPS PBC connection attempt.
+   */
+  oneway onWpsEventPbcOverlap();
 };