Skip to content

Commit f0f1693

Browse files
Merge pull request #1698 from smartdevicelink/bugfix/issue_1697
Add onClose callbacks after LCM clean() calls
2 parents 611d350 + 3ba1159 commit f0f1693

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ public void onReceived(RPCMessage message) {
390390
msg.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
391391
sendRPCMessagePrivate(msg, true);
392392
clean();
393+
onClose("RPC spec version not supported: " + rpcSpecVersion.toString(), null, SdlDisconnectedReason.MINIMUM_RPC_VERSION_HIGHER_THAN_SUPPORTED);
393394
return;
394395
}
395396
if (!didCheckSystemInfo && lifecycleListener != null) {
@@ -405,6 +406,7 @@ public void onReceived(RPCMessage message) {
405406
msg.setCorrelationID(UNREGISTER_APP_INTERFACE_CORRELATION_ID);
406407
sendRPCMessagePrivate(msg, true);
407408
clean();
409+
onClose("System not supported", null, SdlDisconnectedReason.DEFAULT);
408410
return;
409411
}
410412
}
@@ -491,6 +493,7 @@ public void run() {
491493
if (!onAppInterfaceUnregistered.getReason().equals(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE)) {
492494
DebugTool.logInfo(TAG, "on app interface unregistered");
493495
clean();
496+
onClose("OnAppInterfaceUnregistered received from head unit", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
494497
} else {
495498
DebugTool.logInfo(TAG, "re-registering for language change");
496499
cycle(SdlDisconnectedReason.LANGUAGE_CHANGE);
@@ -499,6 +502,7 @@ public void run() {
499502
case UNREGISTER_APP_INTERFACE:
500503
DebugTool.logInfo(TAG, "unregister app interface");
501504
clean();
505+
onClose("UnregisterAppInterface response received from head unit", null, SdlDisconnectedReason.APP_INTERFACE_UNREG);
502506
break;
503507
}
504508
}
@@ -936,6 +940,7 @@ public void onSessionStarted(int sessionID, Version version, SystemInfo systemIn
936940
DebugTool.logWarning(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
937941
session.endService(SessionType.RPC);
938942
clean();
943+
onClose("Protocol version not supported: " + version, null, SdlDisconnectedReason.MINIMUM_PROTOCOL_VERSION_HIGHER_THAN_SUPPORTED);
939944
return;
940945
}
941946

@@ -946,6 +951,7 @@ public void onSessionStarted(int sessionID, Version version, SystemInfo systemIn
946951
DebugTool.logWarning(TAG, "Disconnecting from head unit, the system info was not accepted.");
947952
session.endService(SessionType.RPC);
948953
clean();
954+
onClose("System not supported", null, SdlDisconnectedReason.DEFAULT);
949955
return;
950956
}
951957
//If the vehicle is acceptable, init security lib

0 commit comments

Comments
 (0)