summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2020-05-28 15:31:56 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2020-05-28 15:31:56 -0400
commit59cb907de0b36d130086441ee356a51d4b478990 (patch)
tree5e6527b2e742ce9a560a768f51299dd17b02caac /android
parent95ece776d53caa5b5963af0f2338b7c8e76a3f6c (diff)
downloadsdl_android-59cb907de0b36d130086441ee356a51d4b478990.tar.gz
Add Android LifecycleManager constructor
Diffstat (limited to 'android')
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index acb0fd1dc..50cf6dfb3 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -34,10 +34,43 @@ package com.smartdevicelink.managers.lifecycle;
import android.support.annotation.RestrictTo;
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.SdlConnection.SdlSession2;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
+import com.smartdevicelink.transport.BaseTransportConfig;
+import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.enums.TransportType;
+
+import java.util.HashMap;
+
/**
* The lifecycle manager creates a central point for all SDL session logic to converge. It should only be used by
* the library itself. Usage outside the library is not permitted and will not be protected for in the future.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public class LifecycleManager extends BaseLifecycleManager {
+ public LifecycleManager(AppConfig appConfig, BaseTransportConfig config, LifecycleListener listener){
+
+ this.lifecycleListener = listener;
+
+ this.rpcListeners = new HashMap<>();
+ this.rpcResponseListeners = new HashMap<>();
+ this.rpcNotificationListeners = new HashMap<>();
+ this.rpcRequestListeners = new HashMap<>();
+
+ this.appConfig = appConfig;
+ this.minimumProtocolVersion = appConfig.getMinimumProtocolVersion();
+ this.minimumRPCVersion = appConfig.getMinimumRPCVersion();
+
+ if (config != null && config.getTransportType().equals(TransportType.MULTIPLEX)) {
+ this.session = new SdlSession2(sdlConnectionListener, (MultiplexTransportConfig) config);
+ }else if(config != null &&config.getTransportType().equals(TransportType.TCP)){
+ this.session = new SdlSession2(sdlConnectionListener, (TCPTransportConfig) config);
+ }else {
+ this.session = SdlSession.createSession((byte)getProtocolVersion().getMajor(),sdlConnectionListener, config);
+ }
+
+ this.systemCapabilityManager = new SystemCapabilityManager(internalInterface);
+ }
}