summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-02-12 09:30:30 -0800
committerRoshan Pius <rpius@google.com>2018-07-20 09:44:56 -0700
commitf67983967623524bc785cac8ac3e294fb9183746 (patch)
tree3f0929957ec538cf44cf29134cda306861857226 /service
parent08783ed499bd657dcf9f3d952a0f51515a86527d (diff)
WificondControl: Remove supplicant/hostapd start/stop
This is no longer needed since we'll be using the lazy HAL startup mechanism provided by HIDL to start/stop supplicant. Created a new method for registering the softap callbacks (previously was a part of startHostapd. The callback will be removed when we teardown the interface. Bug: 72394251 Test: Unit tests Test: Softap & WifiManager integration tests Change-Id: I462c005299ae0c8ee183091e2a5d02353b646a59
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java17
-rw-r--r--service/java/com/android/server/wifi/WificondControl.java71
2 files changed, 9 insertions, 79 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 9145baa81..31b8b30df 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1374,6 +1374,10 @@ public class WifiNative {
*/
public boolean startSoftAp(
@NonNull String ifaceName, WifiConfiguration config, SoftApListener listener) {
+ if (!mWificondControl.registerApListener(ifaceName, listener)) {
+ Log.e(TAG, "Failed to register ap listener");
+ return false;
+ }
if (!mHostapdHal.addAccessPoint(ifaceName, config)) {
Log.e(TAG, "Failed to add acccess point");
mWifiMetrics.incrementNumSetupSoftApInterfaceFailureDueToHostapd();
@@ -1383,19 +1387,6 @@ public class WifiNative {
}
/**
- * Stop the ongoing Soft AP operation.
- *
- * @param ifaceName Name of the interface.
- * @return true on success, false otherwise.
- */
- public boolean stopSoftAp(@NonNull String ifaceName) {
- if (!mHostapdHal.removeAccessPoint(ifaceName)) {
- Log.e(TAG, "Failed to remove access point");
- }
- return mWificondControl.stopHostapd(ifaceName);
- }
-
- /**
* Set MAC address of the given interface
* @param interfaceName Name of the interface
* @param mac Mac address to change into
diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java
index ca3fc1d5c..dce6443aa 100644
--- a/service/java/com/android/server/wifi/WificondControl.java
+++ b/service/java/com/android/server/wifi/WificondControl.java
@@ -403,38 +403,6 @@ public class WificondControl implements IBinder.DeathRecipient {
}
/**
- * Disable wpa_supplicant via wificond.
- * @return Returns true on success.
- */
- public boolean disableSupplicant() {
- if (!retrieveWificondAndRegisterForDeath()) {
- return false;
- }
- try {
- return mWificond.disableSupplicant();
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to disable supplicant due to remote exception");
- }
- return false;
- }
-
- /**
- * Enable wpa_supplicant via wificond.
- * @return Returns true on success.
- */
- public boolean enableSupplicant() {
- if (!retrieveWificondAndRegisterForDeath()) {
- return false;
- }
- try {
- return mWificond.enableSupplicant();
- } catch (RemoteException e) {
- Log.e(TAG, "Failed to enable supplicant due to remote exception");
- }
- return false;
- }
-
- /**
* Request signal polling to wificond.
* @param ifaceName Name of the interface.
* Returns an SignalPollResult object.
@@ -777,15 +745,13 @@ public class WificondControl implements IBinder.DeathRecipient {
}
/**
- * Start hostapd
- * TODO(b/71513606): Move this to a global operation.
+ * Register the provided listener for SoftAp events.
*
* @param ifaceName Name of the interface.
* @param listener Callback for AP events.
* @return true on success, false otherwise.
*/
- public boolean startHostapd(@NonNull String ifaceName,
- SoftApListener listener) {
+ public boolean registerApListener(@NonNull String ifaceName, SoftApListener listener) {
IApInterface iface = getApInterface(ifaceName);
if (iface == null) {
Log.e(TAG, "No valid ap interface handler");
@@ -794,42 +760,15 @@ public class WificondControl implements IBinder.DeathRecipient {
try {
IApInterfaceEventCallback callback = new ApInterfaceEventCallback(listener);
mApInterfaceListeners.put(ifaceName, callback);
- boolean success = iface.startHostapd(callback);
- if (!success) {
- Log.e(TAG, "Failed to start hostapd.");
- return false;
- }
- } catch (RemoteException e) {
- Log.e(TAG, "Exception in starting soft AP: " + e);
- return false;
- }
- return true;
- }
-
- /**
- * Stop hostapd
- * TODO(b/71513606): Move this to a global operation.
- *
- * @param ifaceName Name of the interface.
- * @return true on success, false otherwise.
- */
- public boolean stopHostapd(@NonNull String ifaceName) {
- IApInterface iface = getApInterface(ifaceName);
- if (iface == null) {
- Log.e(TAG, "No valid ap interface handler");
- return false;
- }
- try {
- boolean success = iface.stopHostapd();
+ boolean success = iface.registerCallback(callback);
if (!success) {
- Log.e(TAG, "Failed to stop hostapd.");
+ Log.e(TAG, "Failed to register ap callback.");
return false;
}
} catch (RemoteException e) {
- Log.e(TAG, "Exception in stopping soft AP: " + e);
+ Log.e(TAG, "Exception in registering AP callback: " + e);
return false;
}
- mApInterfaceListeners.remove(ifaceName);
return true;
}