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

Commit aa1add7b authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

wifi: Set the mode at native layer

 * Set normal/AP mode so that the HAL can specify correct module
   arguments when loading the driver.

Change-Id: I6eee2cc53b5f1e70306e252e52c909833f220515
parent fa8af946
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -190,7 +190,10 @@ static jstring android_net_wifi_doStringCommand(JNIEnv* env, jobject, jstring jI
    return doStringCommand(env, ifname.c_str(), "%s", command.c_str());
}


static jboolean android_net_wifi_setMode(JNIEnv* env, jobject, jint type)
{
    return (jboolean)(::wifi_set_mode(type) == 0);
}

// ----------------------------------------------------------------------------

@@ -217,6 +220,7 @@ static JNINativeMethod gWifiMethods[] = {
            (void*) android_net_wifi_doIntCommand },
    { "doStringCommand", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",
            (void*) android_net_wifi_doStringCommand },
    { "setMode", "(I)Z", (void*) android_net_wifi_setMode},
};

int register_android_net_wifi_WifiManager(JNIEnv* env)
+2 −0
Original line number Diff line number Diff line
@@ -798,4 +798,6 @@ public class WifiNative {
    public boolean p2pServDiscCancelReq(String id) {
        return doBooleanCommand("P2P_SERV_DISC_CANCEL_REQ " + id);
    }

    public native static boolean setMode(int mode);
}
+2 −0
Original line number Diff line number Diff line
@@ -761,6 +761,7 @@ public class WifiStateMachine extends StateMachine {
    public void setWifiEnabled(boolean enable) {
        mLastEnableUid.set(Binder.getCallingUid());
        if (enable) {
            WifiNative.setMode(0);
            /* Argument is the state that is entered prior to load */
            sendMessage(obtainMessage(CMD_LOAD_DRIVER, WIFI_STATE_ENABLING, 0));
            sendMessage(CMD_START_SUPPLICANT);
@@ -777,6 +778,7 @@ public class WifiStateMachine extends StateMachine {
    public void setWifiApEnabled(WifiConfiguration wifiConfig, boolean enable) {
        mLastApEnableUid.set(Binder.getCallingUid());
        if (enable) {
            WifiNative.setMode(1);
            /* Argument is the state that is entered prior to load */
            sendMessage(obtainMessage(CMD_LOAD_DRIVER, WIFI_AP_STATE_ENABLING, 0));
            sendMessage(obtainMessage(CMD_START_AP, wifiConfig));