diff options
author | 2017-03-01 11:55:44 +0000 | |
---|---|---|
committer | 2017-03-01 11:55:44 +0000 | |
commit | 23e6ad0edab63091181f87b1b42ba931570c5496 (patch) | |
tree | aa09778d83cac9af7f56c0631c88c5569004df6c | |
parent | df71c583413329886cff98a9ef6eca80be27dd8d (diff) | |
parent | 83385ed04a141b92c5716ea2607b231a5f7cb09e (diff) |
Merge "Fix dead lock in Tethering state machine" am: 355dbae680 am: 0703f03953
am: 83385ed04a
Change-Id: I7d0974d5ec4e3cab1581e1cce0e01eeb6bf7448a
-rw-r--r-- | services/core/java/com/android/server/connectivity/Tethering.java | 12 | ||||
-rw-r--r-- | services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 6c608a28089d..1bbbededbd86 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -950,6 +950,8 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering // Events from NetworkCallbacks that we process on the master state // machine thread on behalf of the UpstreamNetworkMonitor. static final int EVENT_UPSTREAM_CALLBACK = BASE_MASTER + 5; + // we treated the error and want now to clear it + static final int CMD_CLEAR_ERROR = BASE_MASTER + 6; private State mInitialState; private State mTetherModeAliveState; @@ -1491,6 +1493,10 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering TetherInterfaceStateMachine who = (TetherInterfaceStateMachine)message.obj; who.sendMessage(mErrorNotification); break; + case CMD_CLEAR_ERROR: + mErrorNotification = ConnectivityManager.TETHER_ERROR_NO_ERROR; + transitionTo(mInitialState); + break; default: retValue = false; } @@ -1635,6 +1641,12 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering // Not really very much we can do here. } + // If TetherMasterSM is in ErrorState, TetherMasterSM stays there. + // Thus we give a chance for TetherMasterSM to recover to InitialState + // by sending CMD_CLEAR_ERROR + if (error == ConnectivityManager.TETHER_ERROR_MASTER_ERROR) { + mTetherMasterSM.sendMessage(TetherMasterSM.CMD_CLEAR_ERROR, who); + } switch (state) { case IControlsTethering.STATE_UNAVAILABLE: case IControlsTethering.STATE_AVAILABLE: diff --git a/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java b/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java index 5e5157913f20..710ab33874cd 100644 --- a/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java +++ b/services/core/java/com/android/server/connectivity/tethering/TetherInterfaceStateMachine.java @@ -167,7 +167,8 @@ public class TetherInterfaceStateMachine extends StateMachine { private void maybeLogMessage(State state, int what) { if (DBG) { Log.d(TAG, state.getName() + " got " + - sMagicDecoderRing.get(what, Integer.toString(what))); + sMagicDecoderRing.get(what, Integer.toString(what)) + ", Iface = " + + mIfaceName); } } |