Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b3a2c7a authored by Irfan Sheriff's avatar Irfan Sheriff Committed by Android (Google) Code Review
Browse files

Merge "Add new states to support wpa_supplicant 0.8"

parents 2e605387 319da8c4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11596,12 +11596,14 @@ package android.net.wifi {
    method public void writeToParcel(android.os.Parcel, int);
    enum_constant public static final android.net.wifi.SupplicantState ASSOCIATED;
    enum_constant public static final android.net.wifi.SupplicantState ASSOCIATING;
    enum_constant public static final android.net.wifi.SupplicantState AUTHENTICATING;
    enum_constant public static final android.net.wifi.SupplicantState COMPLETED;
    enum_constant public static final android.net.wifi.SupplicantState DISCONNECTED;
    enum_constant public static final android.net.wifi.SupplicantState DORMANT;
    enum_constant public static final android.net.wifi.SupplicantState FOUR_WAY_HANDSHAKE;
    enum_constant public static final android.net.wifi.SupplicantState GROUP_HANDSHAKE;
    enum_constant public static final android.net.wifi.SupplicantState INACTIVE;
    enum_constant public static final android.net.wifi.SupplicantState INTERFACE_DISABLED;
    enum_constant public static final android.net.wifi.SupplicantState INVALID;
    enum_constant public static final android.net.wifi.SupplicantState SCANNING;
    enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;
+44 −0
Original line number Diff line number Diff line
@@ -38,6 +38,15 @@ public enum SupplicantState implements Parcelable {
     */
    DISCONNECTED,

    /**
     * Interface is disabled
     * <p/>
     * This state is entered if the network interface is disabled.
     * wpa_supplicant refuses any new operations that would
     * use the radio until the interface has been enabled.
     */
    INTERFACE_DISABLED,

    /**
     * Inactive state (wpa_supplicant disabled).
     * <p/>
@@ -56,6 +65,15 @@ public enum SupplicantState implements Parcelable {
     */
    SCANNING,

    /**
     * Trying to authenticate with a BSS/SSID
     * <p/>
     * 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.
     */
    AUTHENTICATING,

    /**
     * Trying to associate with a BSS/SSID.
     * <p/>
@@ -152,8 +170,33 @@ public enum SupplicantState implements Parcelable {
        return state != UNINITIALIZED && state != INVALID;
    }


    /* Supplicant associating or authenticating is considered a handshake state */
    static boolean isHandshakeState(SupplicantState state) {
        switch(state) {
            case AUTHENTICATING:
            case ASSOCIATING:
            case ASSOCIATED:
            case FOUR_WAY_HANDSHAKE:
            case GROUP_HANDSHAKE:
                return true;
            case COMPLETED:
            case DISCONNECTED:
            case INTERFACE_DISABLED:
            case INACTIVE:
            case SCANNING:
            case DORMANT:
            case UNINITIALIZED:
            case INVALID:
                return false;
            default:
                throw new IllegalArgumentException("Unknown supplicant state");
        }
    }

    static boolean isConnecting(SupplicantState state) {
        switch(state) {
            case AUTHENTICATING:
            case ASSOCIATING:
            case ASSOCIATED:
            case FOUR_WAY_HANDSHAKE:
@@ -161,6 +204,7 @@ public enum SupplicantState implements Parcelable {
            case COMPLETED:
                return true;
            case DISCONNECTED:
            case INTERFACE_DISABLED:
            case INACTIVE:
            case SCANNING:
            case DORMANT:
+11 −11
Original line number Diff line number Diff line
@@ -101,9 +101,13 @@ class SupplicantStateTracker extends StateMachine {
           case DISCONNECTED:
                transitionTo(mDisconnectState);
                break;
            case INTERFACE_DISABLED:
                //we should have received a disconnection already, do nothing
                break;
            case SCANNING:
                transitionTo(mScanState);
                break;
            case AUTHENTICATING:
            case ASSOCIATING:
            case ASSOCIATED:
            case FOUR_WAY_HANDSHAKE:
@@ -250,10 +254,7 @@ class SupplicantStateTracker extends StateMachine {
                case WifiStateMachine.SUPPLICANT_STATE_CHANGE_EVENT:
                    StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
                    SupplicantState state = stateChangeResult.state;
                    if (state == SupplicantState.ASSOCIATING ||
                            state == SupplicantState.ASSOCIATED ||
                            state == SupplicantState.FOUR_WAY_HANDSHAKE ||
                            state == SupplicantState.GROUP_HANDSHAKE) {
                    if (SupplicantState.isHandshakeState(state)) {
                        if (mLoopDetectIndex > state.ordinal()) {
                            mLoopDetectCount++;
                        }
@@ -296,12 +297,11 @@ class SupplicantStateTracker extends StateMachine {
                    StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
                    SupplicantState state = stateChangeResult.state;
                    sendSupplicantStateChangedBroadcast(state, mAuthFailureInSupplicantBroadcast);
                    /* Ignore a re-auth in completed state */
                    if (state == SupplicantState.ASSOCIATING ||
                            state == SupplicantState.ASSOCIATED ||
                            state == SupplicantState.FOUR_WAY_HANDSHAKE ||
                            state == SupplicantState.GROUP_HANDSHAKE ||
                            state == SupplicantState.COMPLETED) {
                    /* Ignore any connecting state in completed state. Group re-keying
                     * events and other auth events that do not affect connectivity are
                     * ignored
                     */
                    if (SupplicantState.isConnecting(state)) {
                        break;
                    }
                    transitionOnSupplicantStateChange(stateChangeResult);
+2 −0
Original line number Diff line number Diff line
@@ -41,8 +41,10 @@ public class WifiInfo implements Parcelable {

    static {
        stateMap.put(SupplicantState.DISCONNECTED, DetailedState.DISCONNECTED);
        stateMap.put(SupplicantState.INTERFACE_DISABLED, DetailedState.DISCONNECTED);
        stateMap.put(SupplicantState.INACTIVE, DetailedState.IDLE);
        stateMap.put(SupplicantState.SCANNING, DetailedState.SCANNING);
        stateMap.put(SupplicantState.AUTHENTICATING, DetailedState.CONNECTING);
        stateMap.put(SupplicantState.ASSOCIATING, DetailedState.CONNECTING);
        stateMap.put(SupplicantState.ASSOCIATED, DetailedState.CONNECTING);
        stateMap.put(SupplicantState.FOUR_WAY_HANDSHAKE, DetailedState.AUTHENTICATING);