wifi(hidl): Add supplicant HIDL interface

Convert the existing AIDL binder interface of wpa_supplicant to HIDL.

Summary of changes:
1. Every HIDL method returns an instance of |SupplicantStatus|
along with any others params (for getters). This is needed to return the
equivalent of |Binder::Status| to indicate errors in the args passed,
stale proxy, etc.
2. All constants are changed to enums. There were some constants which
should have been enums in the first place, but wasn't because AIDL did
not support enums. But, there are others which should be standalone
constants, but are enums now because constants are not supported in HIDL.
3. Conform to HIDL style guide.

Bug: 31365276
Test: `mmm -j32 hardware/interfaces/wifi/1.0/`
Change-Id: Iba753e279fd260788d8628ea2f5c2281b5844095
diff --git a/wifi/1.0/ISupplicantIfaceCallback.hal b/wifi/1.0/ISupplicantIfaceCallback.hal
new file mode 100644
index 0000000..2ab540d
--- /dev/null
+++ b/wifi/1.0/ISupplicantIfaceCallback.hal
@@ -0,0 +1,141 @@
+/*
+ * 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;
+
+/**
+ * Callback Interface exposed by the wpa_supplicant service
+ * for each interface (ISupplicantIface).
+ *
+ * Clients need to host an instance of this HIDL interface object and
+ * pass a reference of the object to wpa_supplicant via the
+ * corresponding |ISupplicantIface.registerCallback| method.
+ */
+interface ISupplicantIfaceCallback {
+  /** Various states of the interface reported by |onStateChanged|.*/
+  enum State : uint32_t {
+    /**
+     * This state indicates that client is not associated, but is likely to
+     * start looking for an access point. This state is entered when a
+     * connection is lost.
+     */
+    DISCONNECTED = 0,
+    /**
+     * This state is entered if the network interface is disabled, e.g.,
+     * due to rfkill. wpa_supplicant refuses any new operations that would
+     * use the radio until the interface has been enabled.
+     */
+    INTERFACE_DISABLED = 1,
+    /**
+     * This state is entered if there are no enabled networks in the
+     * configuration. wpa_supplicant is not trying to associate with a new
+     * network and external interaction (e.g., ctrl_iface call to add or
+     * enable a network) is needed to start association.
+     */
+    INACTIVE = 2,
+    /**
+     * This state is entered when wpa_supplicant starts scanning for a
+     * network.
+     */
+    SCANNING = 3,
+    /**
+     * This state is entered when wpa_supplicant has found a suitable BSS
+     * to authenticate with and the driver is configured to try to
+     * authenticate with this BSS. This state is used only with drivers
+     * that use wpa_supplicant as the SME.
+     */
+    AUTHENTICATING = 4,
+    /**
+     * This state is entered when wpa_supplicant has found a suitable BSS
+     * to associate with and the driver is configured to try to associate
+     * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
+     * state is entered when the driver is configured to try to associate
+     * with a network using the configured SSID and security policy.
+     */
+    ASSOCIATING = 5,
+    /**
+     * This state is entered when the driver reports that association has
+     * been successfully completed with an AP. If IEEE 802.1X is used
+     * (with or without WPA/WPA2), wpa_supplicant remains in this state
+     * until the IEEE 802.1X/EAPOL authentication has been completed.
+     */
+    ASSOCIATED = 6,
+    /**
+     * This state is entered when WPA/WPA2 4-Way Handshake is started. In
+     * case of WPA-PSK, this happens when receiving the first EAPOL-Key
+     * frame after association. In case of WPA-EAP, this state is entered
+     * when the IEEE 802.1X/EAPOL authentication has been completed.
+     */
+    FOURWAY_HANDSHAKE = 7,
+    /**
+     * This state is entered when 4-Way Key Handshake has been completed
+     * (i.e., when the supplicant sends out message 4/4) and when Group
+     * Key rekeying is started by the AP (i.e., when supplicant receives
+     * message 1/2).
+     */
+    GROUP_HANDSHAKE = 8,
+    /**
+     * This state is entered when the full authentication process is
+     * completed. In case of WPA2, this happens when the 4-Way Handshake is
+     * successfully completed. With WPA, this state is entered after the
+     * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
+     * completed after dynamic keys are received (or if not used, after
+     * the EAP authentication has been completed). With static WEP keys and
+     * plaintext connections, this state is entered when an association
+     * has been completed.
+     *
+     * This state indicates that the supplicant has completed its
+     * processing for the association phase and that data connection is
+     * fully configured.
+     */
+    COMPLETED = 9
+  };
+
+  /**
+   * Used to indicate that a new network has been added.
+   *
+   * @param id Network ID allocated to the corresponding network.
+   */
+  oneway onNetworkAdded(SupplicantNetworkId id);
+
+  /**
+   * Used to indicate that a network has been removed.
+   *
+   * @param id Network ID allocated to the corresponding network.
+   */
+  oneway onNetworkRemoved(SupplicantNetworkId id);
+
+  /**
+   * Used to indicate a state change event on this particular iface. If this
+   * event is triggered by a particular network, the |SupplicantNetworkId|,
+   * |ssid|, |bssid| parameters must indicate the parameters of the network/AP
+   * which cased this state transition.
+   *
+   * @param newState New State of the interface. This must be one of the |State|
+   *        values above.
+   * @param bssid BSSID of the corresponding AP which caused this state
+   *        change event. This must be zero'ed if this event is not
+   *        specific to a particular network.
+   * @param id ID of the corresponding network which caused this
+   *        state change event. This must be invalid (UINT32_MAX) if this
+   *        event is not specific to a particular network.
+   * @param ssid SSID of the corresponding network which caused this state
+   *        change event. This must be empty if this event is not specific
+   *        to a particular network.
+   */
+  oneway onStateChanged(
+      State newState, Bssid bssid, SupplicantNetworkId id, Ssid ssid);
+};