summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2021-02-26 12:02:53 -0500
committerJoey Grover <joeygrover@gmail.com>2021-02-26 12:02:53 -0500
commit4638acf59c8b95c5b7e34c68721983dad7604135 (patch)
treec9045ddf1232afe202f84647bfee503fde5d3ff4
parent0777adc114133f773ead611c2685e41a58dc4523 (diff)
downloadsdl_android-bugfix/sec_lib_selection_fix.tar.gz
Refactor security lib selection methodbugfix/sec_lib_selection_fix
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index e3b7a90a2..280043a8a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -369,7 +369,7 @@ abstract class BaseLifecycleManager {
case REGISTER_APP_INTERFACE:
//We have begun
DebugTool.logInfo(TAG, "RAI Response");
- raiResponse = (RegisterAppInterfaceResponse) message;
+ BaseLifecycleManager.this.raiResponse = (RegisterAppInterfaceResponse) message;
SdlMsgVersion rpcVersion = ((RegisterAppInterfaceResponse) message).getSdlMsgVersion();
if (rpcVersion != null) {
BaseLifecycleManager.this.rpcSpecVersion = new Version(rpcVersion.getMajorVersion(), rpcVersion.getMinorVersion(), rpcVersion.getPatchVersion());
@@ -400,8 +400,9 @@ abstract class BaseLifecycleManager {
return;
}
}
+ //If the vehicle is acceptable and this is the first check, init security lib
+ setSecurityLibraryIfAvailable(vehicleType);
}
- processRaiResponse(raiResponse);
systemCapabilityManager.parseRAIResponse(raiResponse);
break;
case ON_HMI_STATUS:
@@ -919,6 +920,8 @@ abstract class BaseLifecycleManager {
clean();
return;
}
+ //If the vehicle is acceptable, init security lib
+ setSecurityLibraryIfAvailable(systemInfo.getVehicleType());
}
if (appConfig != null) {
@@ -1193,18 +1196,24 @@ abstract class BaseLifecycleManager {
this.encryptionLifecycleManager = new EncryptionLifecycleManager(internalInterface, listener);
}
- private void processRaiResponse(RegisterAppInterfaceResponse rai) {
- if (rai == null) return;
-
- this.raiResponse = rai;
-
- VehicleType vt = rai.getVehicleType();
- if (vt == null) return;
+ /**
+ * Using the vehicle type information, specifically the make, the library will attempt to init
+ * the security library that is associated with that OEM.
+ * @param vehicleType type of vehicle that is currently connected
+ */
+ private void setSecurityLibraryIfAvailable(VehicleType vehicleType) {
+ if (_secList == null) {
+ return;
+ }
- String make = vt.getMake();
- if (make == null) return;
+ if (vehicleType == null) {
+ return;
+ }
- if (_secList == null) return;
+ String make = vehicleType.getMake();
+ if (make == null) {
+ return;
+ }
setSdlSecurityStaticVars();