From 3e240b2bfb6fefe8b91ad68e8a12b652b4136c69 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 15 Mar 2017 16:39:19 -0700 Subject: SupplicantStaIfaceHal: Stop wpa_supplicant auto connect Bug: 36282386 Test: Compiles & manual tests. Change-Id: I90a7b56de1b6f3315bd71c94df45abe8aa9dc155 --- .../com/android/server/wifi/SupplicantStaIfaceHal.java | 15 +++++++++++++++ service/java/com/android/server/wifi/WifiNative.java | 10 ++++++++++ .../java/com/android/server/wifi/WifiStateMachine.java | 3 +++ 3 files changed, 28 insertions(+) diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java index 9d063d247..8f141e6a2 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java @@ -1446,6 +1446,21 @@ public class SupplicantStaIfaceHal { } } + /** See ISupplicant.hal for documentation */ + public boolean enableAutoReconnect(boolean enable) { + synchronized (mLock) { + final String methodStr = "enableAutoReconnect"; + if (!checkSupplicantAndLogFailure(methodStr)) return false; + try { + SupplicantStatus status = mISupplicantStaIface.enableAutoReconnect(enable); + return checkStatusAndLogFailure(status, methodStr); + } catch (RemoteException e) { + handleRemoteException(e, methodStr); + return false; + } + } + } + public static final int LOG_LEVEL_EXCESSIVE = ISupplicant.DebugLevel.EXCESSIVE; public static final int LOG_LEVEL_MSGDUMP = ISupplicant.DebugLevel.MSGDUMP; public static final int LOG_LEVEL_DEBUG = ISupplicant.DebugLevel.DEBUG; diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index d8df0da72..87ace7839 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -670,6 +670,16 @@ public class WifiNative { return mSupplicantStaIfaceHal.setConcurrencyPriority(isStaHigherPriority); } + /** + * Enable/Disable auto reconnect functionality in wpa_supplicant. + * + * @param enable true to enable auto reconnecting, false to disable. + * @return true if request is sent successfully, false otherwise. + */ + public boolean enableStaAutoReconnect(boolean enable) { + return mSupplicantStaIfaceHal.enableAutoReconnect(enable); + } + /** * Migrate all the configured networks from wpa_supplicant. * diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 2f86743f2..58b4ff639 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -4204,6 +4204,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss // Enable link layer stats gathering mWifiNative.setWifiLinkLayerStats("wlan0", 1); + + // Disable wpa_supplicant from auto reconnecting. + mWifiNative.enableStaAutoReconnect(false); } @Override -- cgit v1.2.3