Skip to content

Commit c9d7c38

Browse files
committed
Rename callbacks to better reflect events
1 parent 39d5b6e commit c9d7c38

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019 Livio, Inc.
2+
* Copyright (c) 2019-2020 Livio, Inc.
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,6 @@
6666
* The lifecycle manager creates a central point for all SDL session logic to converge. It should only be used by
6767
* the library itself. Usage outside the library is not permitted and will not be protected for in the future.
6868
*
69-
* @author Bilal Alsharifi.
7069
*/
7170
@RestrictTo(RestrictTo.Scope.LIBRARY)
7271
public class LifecycleManager extends BaseLifecycleManager {
@@ -153,8 +152,8 @@ void setSdlSecurityStaticVars() {
153152
}
154153

155154
@Override
156-
void onProtocolSessionStarted(SessionType sessionType) {
157-
super.onProtocolSessionStarted(sessionType);
155+
void onServiceStarted(SessionType sessionType) {
156+
super.onServiceStarted(sessionType);
158157
if (sessionType.eq(SessionType.NAV)) {
159158
videoServiceStartResponseReceived = true;
160159
videoServiceStartResponse = true;
@@ -174,17 +173,17 @@ void onTransportDisconnected(String info, boolean availablePrimary, BaseTranspor
174173
}
175174

176175
@Override
177-
void onProtocolSessionStartedNACKed(SessionType sessionType) {
178-
super.onProtocolSessionStartedNACKed(sessionType);
176+
void onStartServiceNACKed(SessionType sessionType) {
177+
super.onStartServiceNACKed(sessionType);
179178
if (sessionType.eq(SessionType.NAV)) {
180179
videoServiceStartResponseReceived = true;
181180
videoServiceStartResponse = false;
182181
}
183182
}
184183

185184
@Override
186-
void onProtocolSessionEnded(SessionType sessionType) {
187-
super.onProtocolSessionEnded(sessionType);
185+
void onServiceEnded(SessionType sessionType) {
186+
super.onServiceEnded(sessionType);
188187
if (sessionType.eq(SessionType.NAV)) {
189188
videoServiceEndResponseReceived = true;
190189
videoServiceEndResponse = true;
@@ -195,8 +194,8 @@ void onProtocolSessionEnded(SessionType sessionType) {
195194
}
196195

197196
@Override
198-
void onProtocolSessionEndedNACKed(SessionType sessionType) {
199-
super.onProtocolSessionEndedNACKed(sessionType);
197+
void onStopServiceNACKed(SessionType sessionType) {
198+
super.onStopServiceNACKed(sessionType);
200199
if (sessionType.eq(SessionType.NAV)) {
201200
videoServiceEndResponseReceived = true;
202201
videoServiceEndResponse = false;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -903,24 +903,24 @@ public void onProtocolMessageReceived(ProtocolMessage msg) {
903903

904904
@Override
905905
public void onProtocolSessionStartedNACKed(SessionType sessionType, byte sessionID, byte version, String correlationID, List<String> rejectedParams) {
906-
Log.w(TAG, sessionType + " onProtocolSessionStartedNACKed " + sessionID + " RejectedParams: " + rejectedParams);
907-
BaseLifecycleManager.this.onProtocolSessionStartedNACKed(sessionType);
906+
Log.w(TAG, sessionType.getName() + " onProtocolSessionStartedNACKed " + sessionID + " RejectedParams: " + rejectedParams);
907+
BaseLifecycleManager.this.onStartServiceNACKed(sessionType);
908908
}
909909

910910
@Override
911911
public void onProtocolSessionStarted(SessionType sessionType, byte sessionID, byte version, String correlationID, int hashID, boolean isEncrypted) {
912912
Log.i(TAG, "on protocol session started");
913-
BaseLifecycleManager.this.onProtocolSessionStarted(sessionType);
913+
BaseLifecycleManager.this.onServiceStarted(sessionType);
914914
}
915915

916916
@Override
917917
public void onProtocolSessionEnded(SessionType sessionType, byte sessionID, String correlationID) {
918-
BaseLifecycleManager.this.onProtocolSessionEnded(sessionType);
918+
BaseLifecycleManager.this.onServiceEnded(sessionType);
919919
}
920920

921921
@Override
922922
public void onProtocolSessionEndedNACKed(SessionType sessionType, byte sessionID, String correlationID) {
923-
BaseLifecycleManager.this.onProtocolSessionEndedNACKed(sessionType);
923+
BaseLifecycleManager.this.onStopServiceNACKed(sessionType);
924924
}
925925

926926
@Override
@@ -1294,7 +1294,7 @@ void initialize() {
12941294
setupInternalRpcListeners();
12951295
}
12961296

1297-
void onProtocolSessionStarted(SessionType sessionType) {
1297+
void onServiceStarted(SessionType sessionType) {
12981298
if (sessionType != null) {
12991299
if (minimumProtocolVersion != null && minimumProtocolVersion.isNewerThan(getProtocolVersion()) == 1) {
13001300
Log.w(TAG, String.format("Disconnecting from head unit, the configured minimum protocol version %s is greater than the supported protocol version %s", minimumProtocolVersion, getProtocolVersion()));
@@ -1341,13 +1341,13 @@ void onProtocolSessionStarted(SessionType sessionType) {
13411341
void onTransportDisconnected(String info, boolean availablePrimary, BaseTransportConfig transportConfig) {
13421342
}
13431343

1344-
void onProtocolSessionStartedNACKed(SessionType sessionType) {
1344+
void onStartServiceNACKed(SessionType sessionType) {
13451345
}
13461346

1347-
void onProtocolSessionEnded(SessionType sessionType) {
1347+
void onServiceEnded(SessionType sessionType) {
13481348
}
13491349

1350-
void onProtocolSessionEndedNACKed(SessionType sessionType) {
1350+
void onStopServiceNACKed(SessionType sessionType) {
13511351
}
13521352

13531353
void startVideoService(boolean encrypted, VideoStreamingParameters parameters) {

0 commit comments

Comments
 (0)