@@ -411,11 +411,14 @@ public void onReceived(RPCMessage message) {
411411 VehicleType vehicleType = raiResponse .getVehicleType ();
412412 String systemSoftwareVersion = raiResponse .getSystemSoftwareVersion ();
413413 if (vehicleType != null || systemSoftwareVersion != null ) {
414+
415+ List <TransportRecord > activeTransports = null ;
414416 synchronized (session ) {
415417 if (session != null ) {
416- saveVehicleType ( session .getActiveTransports (), vehicleType );
418+ activeTransports = session .getActiveTransports ();
417419 }
418420 }
421+ saveVehicleType (activeTransports , vehicleType );
419422 SystemInfo systemInfo = new SystemInfo (vehicleType , systemSoftwareVersion , null );
420423 boolean validSystemInfo = lifecycleListener .onSystemInfoReceived (systemInfo );
421424 if (!validSystemInfo ) {
@@ -974,17 +977,23 @@ public void onSessionStarted(int sessionID, Version version, SystemInfo systemIn
974977
975978 if (systemInfo != null && lifecycleListener != null ) {
976979 didCheckSystemInfo = true ;
980+ List <TransportRecord > activeTransports = null ;
977981 synchronized (session ) {
978982 if (session != null ) {
979- saveVehicleType (session .getActiveTransports (), systemInfo .getVehicleType ());
980- boolean validSystemInfo = lifecycleListener .onSystemInfoReceived (systemInfo );
981- if (!validSystemInfo ) {
982- DebugTool .logWarning (TAG , "Disconnecting from head unit, the system info was not accepted." );
983+ activeTransports = session .getActiveTransports ();
984+ }
985+ }
986+ saveVehicleType (activeTransports , systemInfo .getVehicleType ());
987+ boolean validSystemInfo = lifecycleListener .onSystemInfoReceived (systemInfo );
988+ if (!validSystemInfo ) {
989+ DebugTool .logWarning (TAG , "Disconnecting from head unit, the system info was not accepted." );
990+ synchronized (session ) {
991+ if (session != null ) {
983992 session .endService (SessionType .RPC );
984- clean ();
985- onClose ("System not supported" , null , SdlDisconnectedReason .DEFAULT );
986- return ;
987993 }
994+ clean ();
995+ onClose ("System not supported" , null , SdlDisconnectedReason .DEFAULT );
996+ return ;
988997 }
989998 }
990999 //If the vehicle is acceptable, init security lib
0 commit comments