diff options
author | Austin Kirk <askirk@umich.edu> | 2017-06-07 16:25:04 -0400 |
---|---|---|
committer | Austin Kirk <askirk@umich.edu> | 2017-06-07 16:25:04 -0400 |
commit | c30dd431c8767bd772ad3139386c623846c5ba9a (patch) | |
tree | ac55e0e30d74aa797d696a7ad6130bf32194dc71 | |
parent | b6c2062ba9699f0f407f5598583c1e39cedd80db (diff) | |
download | sdl_android-c30dd431c8767bd772ad3139386c623846c5ba9a.tar.gz |
Clear static instance on ERROR statebugfix/issue_427
-rw-r--r-- | sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java index b4fea0e71..2d3725e76 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java +++ b/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java @@ -146,6 +146,8 @@ public class MultiplexBluetoothTransport { protected synchronized void setStateManually(int state){ //Log.d(TAG, "Setting state from: " +mState + " to: " +state); mState = state; + + clearInstanceOnError(state); } /** * Set the current state of the chat connection @@ -159,6 +161,14 @@ public class MultiplexBluetoothTransport { // Give the new state to the Handler so the UI Activity can update //Also sending the previous state so we know if we lost a connection mHandler.obtainMessage(SdlRouterService.MESSAGE_STATE_CHANGE, state, previousState).sendToTarget(); + + clearInstanceOnError(state); + } + + private void clearInstanceOnError(int state){ + if(state == STATE_ERROR){ + serverInstance = null; + } } /** |