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

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

Merge "Use clear names for native API"

parents 96eb20f0 5d001ea0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -121,6 +121,11 @@ static jboolean android_net_wifi_startSupplicant(JNIEnv* env, jobject clazz)
    return (jboolean)(::wifi_start_supplicant() == 0);
}

static jboolean android_net_wifi_stopSupplicant(JNIEnv* env, jobject clazz)
{
    return doBooleanCommand("TERMINATE", "OK");
}

static jboolean android_net_wifi_killSupplicant(JNIEnv* env, jobject clazz)
{
    return (jboolean)(::wifi_stop_supplicant() == 0);
@@ -533,11 +538,6 @@ static jboolean android_net_wifi_reloadConfigCommand(JNIEnv* env, jobject clazz)
    return doBooleanCommand("RECONFIGURE", "OK");
}

static jboolean android_net_wifi_terminateCommand(JNIEnv* env, jobject clazz)
{
    return doBooleanCommand("TERMINATE", "OK");
}

static jboolean android_net_wifi_setScanResultHandlingCommand(JNIEnv* env, jobject clazz, jint mode)
{
    char cmdstr[BUF_SIZE];
@@ -610,6 +610,7 @@ static JNINativeMethod gWifiMethods[] = {
    { "isDriverLoaded", "()Z",  (void *)android_net_wifi_isDriverLoaded},
    { "unloadDriver", "()Z",  (void *)android_net_wifi_unloadDriver },
    { "startSupplicant", "()Z",  (void *)android_net_wifi_startSupplicant },
    { "stopSupplicant", "()Z", (void*) android_net_wifi_stopSupplicant },
    { "killSupplicant", "()Z",  (void *)android_net_wifi_killSupplicant },
    { "connectToSupplicant", "()Z",  (void *)android_net_wifi_connectToSupplicant },
    { "closeSupplicantConnection", "()V",  (void *)android_net_wifi_closeSupplicantConnection },
@@ -652,7 +653,6 @@ static JNINativeMethod gWifiMethods[] = {
    { "getMacAddressCommand", "()Ljava/lang/String;", (void*) android_net_wifi_getMacAddressCommand },
    { "saveConfigCommand", "()Z", (void*) android_net_wifi_saveConfigCommand },
    { "reloadConfigCommand", "()Z", (void*) android_net_wifi_reloadConfigCommand },
    { "terminateCommand", "()Z", (void*) android_net_wifi_terminateCommand },
    { "setScanResultHandlingCommand", "(I)Z", (void*) android_net_wifi_setScanResultHandlingCommand },
    { "addToBlacklistCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_addToBlacklistCommand },
    { "clearBlacklistCommand", "()Z", (void*) android_net_wifi_clearBlacklistCommand },
+17 −9
Original line number Diff line number Diff line
@@ -48,6 +48,16 @@ public class WifiNative {

    public native static boolean startSupplicant();

    /* Does a graceful shutdown of supplicant.
     *
     * Note that underneath we use a harsh-sounding "terminate" supplicant command
     * for a graceful stop and a mild-sounding "stop" interface
     * to kill the process
     */
    public native static boolean stopSupplicant();

    /* Sends a kill signal to supplicant. To be used when we have lost connection
       or when the supplicant is hung */
    public native static boolean killSupplicant();

    public native static boolean connectToSupplicant();
@@ -80,8 +90,6 @@ public class WifiNative {

    public native static boolean disconnectCommand();

    public native static boolean terminateCommand();

    public native static String statusCommand();

    public native static int getRssiCommand();
+3 −3
Original line number Diff line number Diff line
@@ -1989,9 +1989,9 @@ public class WifiStateMachine extends HierarchicalStateMachine {
            switch(message.what) {
                case CMD_STOP_SUPPLICANT:   /* Supplicant stopped by user */
                    EventLog.writeEvent(EVENTLOG_WIFI_EVENT_HANDLED, message.what);
                    Log.d(TAG, "send terminate command to supplicant");
                    if (!WifiNative.terminateCommand()) {
                        Log.e(TAG, "Failed to terminate cleanly, issue kill");
                    Log.d(TAG, "stopping supplicant");
                    if (!WifiNative.stopSupplicant()) {
                        Log.e(TAG, "Failed to stop supplicant, issue kill");
                        WifiNative.killSupplicant();
                    }
                    handleNetworkDisconnect();