summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/WifiMonitor.java
diff options
context:
space:
mode:
authorSravanthi Palakonda <srapal@codeaurora.org>2015-07-29 12:11:01 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:20:27 -0600
commit337b1756e1cb9c0cbd8d9566253de1a46a7952b9 (patch)
tree8396a319d8465791c05216d0ec25f06e629ad3e8 /service/java/com/android/server/wifi/WifiMonitor.java
parentf5d3abcd33ee0039e4a1be69563ce14c6d4a8a00 (diff)
downloadframeworks_opt_net_wifi-337b1756e1cb9c0cbd8d9566253de1a46a7952b9.tar.gz
frameworks_opt_net_wifi-337b1756e1cb9c0cbd8d9566253de1a46a7952b9.tar.bz2
frameworks_opt_net_wifi-337b1756e1cb9c0cbd8d9566253de1a46a7952b9.zip
WiFi: Check for the status of startMonitoring before enabling p2p interface
Framework shall initialize wlan0 interface followed by p2p0, once the connection to the supplicant is successful after the completion of wlan0 initialization. This connection to the supplicant is done by invoking startMonitoring function during both the wlan0 and p2p0 initialization. If supplicant is terminated before the p2p0 start is triggered (after wlan0 initialization), the control socket's with the supplicant shall be closed. This shall not trigger the stop of the p2p initialization and any communication to the supplicant as part of p2p start shall result in to a fatal exception, for the sockets getting closed. However, the startMonitoring API as part the p2p0 interface initialization shall know if the supplicant is terminated/ sockets have got closed. Thus, check if the status of startMonitoring is success to proceed with further p2p initializations. Change-Id: I9da4fefaa0c108b9d634fae2923698c6b76db101
Diffstat (limited to 'service/java/com/android/server/wifi/WifiMonitor.java')
-rw-r--r--service/java/com/android/server/wifi/WifiMonitor.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiMonitor.java b/service/java/com/android/server/wifi/WifiMonitor.java
index db76b08..e9fbf7c 100644
--- a/service/java/com/android/server/wifi/WifiMonitor.java
+++ b/service/java/com/android/server/wifi/WifiMonitor.java
@@ -561,8 +561,8 @@ public class WifiMonitor {
mStateMachine2 = stateMachine;
}
- public void startMonitoring() {
- WifiMonitorSingleton.sInstance.startMonitoring(mInterfaceName);
+ public boolean startMonitoring() {
+ return WifiMonitorSingleton.sInstance.startMonitoring(mInterfaceName);
}
public void stopMonitoring() {
@@ -587,11 +587,11 @@ public class WifiMonitor {
private WifiMonitorSingleton() {
}
- public synchronized void startMonitoring(String iface) {
+ public synchronized boolean startMonitoring(String iface) {
WifiMonitor m = mIfaceMap.get(iface);
if (m == null) {
Log.e(TAG, "startMonitor called with unknown iface=" + iface);
- return;
+ return false;
}
Log.d(TAG, "startMonitoring(" + iface + ") with mConnected = " + mConnected);
@@ -599,7 +599,12 @@ public class WifiMonitor {
if (mConnected) {
m.mMonitoring = true;
m.mStateMachine.sendMessage(SUP_CONNECTION_EVENT);
+ return true;
} else {
+ if (iface.equals("p2p0")) {
+ Log.e(TAG, "Monitoring(" + iface +") failed!, wlan0 interface restarted");
+ return false;
+ }
if (DBG) Log.d(TAG, "connecting to supplicant");
int connectTries = 0;
while (true) {
@@ -608,7 +613,7 @@ public class WifiMonitor {
m.mStateMachine.sendMessage(SUP_CONNECTION_EVENT);
mConnected = true;
new MonitorThread(mWifiNative, this).start();
- break;
+ return true;
}
if (connectTries++ < 5) {
try {
@@ -622,6 +627,7 @@ public class WifiMonitor {
}
}
}
+ return false;
}
public synchronized void stopMonitoring(String iface) {