summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-07-24 17:14:12 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-24 17:14:12 -0700
commit17b8451019543bc226e012bab09cd6da55c91cd2 (patch)
treeba4d6442d6b66117b8e9d9bef85f55f2f7a1aefd
parente432a0005180ba9ac2c1d7822c4761b475fddc51 (diff)
parente8daf2a7000e12dc0d62cb98b06ca849cf40564a (diff)
downloadframeworks_base-17b8451019543bc226e012bab09cd6da55c91cd2.zip
frameworks_base-17b8451019543bc226e012bab09cd6da55c91cd2.tar.gz
frameworks_base-17b8451019543bc226e012bab09cd6da55c91cd2.tar.bz2
Merge "Fix interface notification race"
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 54685a6..74c6b49 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1059,7 +1059,7 @@ public class WifiStateMachine extends StateMachine {
}
}
- private void startTethering(ArrayList<String> available) {
+ private boolean startTethering(ArrayList<String> available) {
boolean wifiAvailable = false;
@@ -1085,18 +1085,20 @@ public class WifiStateMachine extends StateMachine {
} catch (Exception e) {
Log.e(TAG, "Error configuring interface " + intf + ", :" + e);
setWifiApEnabled(null, false);
- return;
+ return false;
}
if(mCm.tether(intf) != ConnectivityManager.TETHER_ERROR_NO_ERROR) {
Log.e(TAG, "Error tethering on " + intf);
setWifiApEnabled(null, false);
- return;
+ return false;
}
- break;
+ return true;
}
}
}
+ // We found no interfaces to tether
+ return false;
}
private void stopTethering() {
@@ -3098,8 +3100,9 @@ public class WifiStateMachine extends StateMachine {
break;
case CMD_TETHER_INTERFACE:
ArrayList<String> available = (ArrayList<String>) message.obj;
- startTethering(available);
- transitionTo(mTetheredState);
+ if (startTethering(available)) {
+ transitionTo(mTetheredState);
+ }
break;
case WifiP2pService.P2P_ENABLE_PENDING:
// turn of soft Ap and defer to be handled in DriverUnloadedState