summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2019-04-11 17:32:05 -0400
committerJoey Grover <joeygrover@gmail.com>2019-04-11 17:32:05 -0400
commitf5342369f3b4973df6a83676e72903b1012ce1dd (patch)
tree9df58e1ff84d9ae3e06aee2632f40a003154c554
parent1e07d7b3a435cda73de14702169001758ed9427d (diff)
downloadsdl_android-f5342369f3b4973df6a83676e72903b1012ce1dd.tar.gz
Handle corner case during transport d/cbugfix/handle_old_rs_tr
There is an issue in the first gen of multi transport router services that will remove certain extras from messages to the TransportBroker if older apps are connected that do not support the multi transport messages. Because of /that, we check the records we have and if the transport matches we assume it was the original transport that was received regardless of the address.
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java29
2 files changed, 32 insertions, 1 deletions
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
index 95dab5a62..0ab335bf9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
@@ -535,6 +535,10 @@ public class TransportBroker {
}
+ protected int getRouterServiceVersion(){
+ return routerServiceVersion;
+ }
+
/**
* We want to check to see if the Router service is already up and running
*
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
index 75094a4b0..ad4b41b84 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -295,8 +295,35 @@ public class TransportManager extends TransportManagerBase{
}
synchronized (TRANSPORT_STATUS_LOCK){
- TransportManager.this.transportStatus.remove(record);
+ boolean wasRemoved = TransportManager.this.transportStatus.remove(record);
//Might check connectedTransports vs transportStatus to ensure they are equal
+
+ //If the transport wasn't removed, check RS version for corner case
+ if(!wasRemoved && getRouterServiceVersion() == 8){
+ boolean foundMatch = false;
+ //There is an issue in the first gen of multi transport router services that
+ //will remove certain extras from messages to the TransportBroker if older apps
+ //are connected that do not support the multi transport messages. Because of
+ //that, we check the records we have and if the transport matches we assume it
+ //was the original transport that was received regardless of the address.
+ TransportType disconnectedTransportType = record.getType();
+ if(disconnectedTransportType != null) {
+ for (TransportRecord transportRecord : TransportManager.this.transportStatus) {
+ if (disconnectedTransportType.equals(transportRecord.getType())) {
+ //The record stored in the TM will contain the actual record the
+ //protocol layer used during the transport connection event
+ record = transportRecord;
+ foundMatch = true;
+ break;
+ }
+ }
+
+ if (foundMatch) { //Remove item after the loop to avoid concurrent modifications
+ TransportManager.this.transportStatus.remove(record);
+ Log.d(TAG, "Handling corner case of transport disconnect mismatch");
+ }
+ }
+ }
}
if(isLegacyModeEnabled()