summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDaisuke Niwa <daisuke.x.niwa@sonymobile.com>2017-04-06 18:57:49 +0900
committerTomonori.Nanbu <Tomonori.Nanbu@sonymobile.com>2017-04-19 13:20:13 +0000
commit75342748e40b4674fa744c8f1904793af571b0d7 (patch)
tree1d49616a68720f191446d1e631bba1f97cf37517 /service
parent8ab4881b5771ddd8ab3fa475362ac42efccff9c4 (diff)
Abort ongoing STA scan to prioritize P2P scan
When P2P scan is requested while STA scan is ongoing, it takes time to get P2P scan result. STA scan should be stopped when P2P scan is requested. Bug: 37227357 Test: Manual test Depends-On: Ifc4b81de8ec1d75467edf497abfe348c4ce1b283 Change-Id: I2fdb8307ae5b79dd205b3c2169f4e3ef579920a1
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java2
-rw-r--r--service/java/com/android/server/wifi/WificondControl.java18
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pNative.java17
3 files changed, 35 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 817385340..edf396994 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -161,7 +161,7 @@ public class WifiInjector {
mWifiP2pMonitor = new WifiP2pMonitor(this);
mSupplicantP2pIfaceHal = new SupplicantP2pIfaceHal(mWifiP2pMonitor);
mWifiP2pNative = new WifiP2pNative(SystemProperties.get("wifi.direct.interface", "p2p0"),
- mSupplicantP2pIfaceHal);
+ mSupplicantP2pIfaceHal, mWificondControl);
// Now get instances of all the objects that depend on the HandlerThreads
mTrafficPoller = new WifiTrafficPoller(mContext, mWifiServiceHandlerThread.getLooper(),
diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java
index fdd0faffe..8be747828 100644
--- a/service/java/com/android/server/wifi/WificondControl.java
+++ b/service/java/com/android/server/wifi/WificondControl.java
@@ -465,4 +465,22 @@ public class WificondControl {
return false;
}
+ /**
+ * Abort ongoing single scan triggered by wificond.
+ * @return Returns true on success.
+ */
+ public boolean abortScan() {
+ if (mWificondScanner == null) {
+ Log.e(TAG, "No valid wificond scanner interface handler");
+ return false;
+ }
+
+ try {
+ return mWificondScanner.abortScan();
+ } catch (RemoteException e1) {
+ Log.e(TAG, "Failed to request abortScan due to remote exception");
+ }
+ return false;
+ }
+
}
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pNative.java b/service/java/com/android/server/wifi/p2p/WifiP2pNative.java
index bae3faa62..5de6585f4 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pNative.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pNative.java
@@ -21,6 +21,8 @@ import android.net.wifi.p2p.WifiP2pGroup;
import android.net.wifi.p2p.WifiP2pGroupList;
import android.net.wifi.p2p.nsd.WifiP2pServiceInfo;
+import com.android.server.wifi.WificondControl;
+
/**
* Native calls for bring up/shut down of the supplicant daemon and for
* sending requests to the supplicant daemon
@@ -31,11 +33,14 @@ public class WifiP2pNative {
private final String mTAG;
private final String mInterfaceName;
private final SupplicantP2pIfaceHal mSupplicantP2pIfaceHal;
+ private final WificondControl mWificondControl;
- public WifiP2pNative(String interfaceName, SupplicantP2pIfaceHal p2pIfaceHal) {
+ public WifiP2pNative(String interfaceName, SupplicantP2pIfaceHal p2pIfaceHal,
+ WificondControl wificondcontrol) {
mTAG = "WifiP2pNative-" + interfaceName;
mInterfaceName = interfaceName;
mSupplicantP2pIfaceHal = p2pIfaceHal;
+ mWificondControl = wificondcontrol;
}
public String getInterfaceName() {
@@ -247,6 +252,7 @@ public class WifiP2pNative {
* @return boolean value indicating whether operation was successful.
*/
public boolean p2pFind(int timeout) {
+ abortScan();
return mSupplicantP2pIfaceHal.find(timeout);
}
@@ -597,4 +603,13 @@ public class WifiP2pNative {
public boolean saveConfig() {
return mSupplicantP2pIfaceHal.saveConfig();
}
+
+ /**
+ * Abort ongoing single scan triggered by wificond.
+ *
+ * @return true on success, false otherwise.
+ */
+ private boolean abortScan() {
+ return mWificondControl.abortScan();
+ }
}