Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83385ed0 authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "Fix dead lock in Tethering state machine" am: 355dbae6

am: 0703f039

Change-Id: I233d796cf67a71ebc43970f949930de46a0ddb3f
parents 02310829 0703f039
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -950,6 +950,8 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
        // Events from NetworkCallbacks that we process on the master state
        // Events from NetworkCallbacks that we process on the master state
        // machine thread on behalf of the UpstreamNetworkMonitor.
        // machine thread on behalf of the UpstreamNetworkMonitor.
        static final int EVENT_UPSTREAM_CALLBACK                = BASE_MASTER + 5;
        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 mInitialState;
        private State mTetherModeAliveState;
        private State mTetherModeAliveState;
@@ -1491,6 +1493,10 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
                        TetherInterfaceStateMachine who = (TetherInterfaceStateMachine)message.obj;
                        TetherInterfaceStateMachine who = (TetherInterfaceStateMachine)message.obj;
                        who.sendMessage(mErrorNotification);
                        who.sendMessage(mErrorNotification);
                        break;
                        break;
                    case CMD_CLEAR_ERROR:
                        mErrorNotification = ConnectivityManager.TETHER_ERROR_NO_ERROR;
                        transitionTo(mInitialState);
                        break;
                    default:
                    default:
                       retValue = false;
                       retValue = false;
                }
                }
@@ -1635,6 +1641,12 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
            // Not really very much we can do here.
            // 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) {
        switch (state) {
            case IControlsTethering.STATE_UNAVAILABLE:
            case IControlsTethering.STATE_UNAVAILABLE:
            case IControlsTethering.STATE_AVAILABLE:
            case IControlsTethering.STATE_AVAILABLE:
+2 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,8 @@ public class TetherInterfaceStateMachine extends StateMachine {
    private void maybeLogMessage(State state, int what) {
    private void maybeLogMessage(State state, int what) {
        if (DBG) {
        if (DBG) {
            Log.d(TAG, state.getName() + " got " +
            Log.d(TAG, state.getName() + " got " +
                    sMagicDecoderRing.get(what, Integer.toString(what)));
                    sMagicDecoderRing.get(what, Integer.toString(what)) + ", Iface = " +
                    mIfaceName);
        }
        }
    }
    }