summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2019-10-30 13:58:32 -0400
committerGitHub <noreply@github.com>2019-10-30 13:58:32 -0400
commit93778656113f0023ec7025281b77e28000a1f5bd (patch)
tree7f5ac0b7ce0d3cd6450419f580c87e6a01f4efc5
parent014401c0dc52f185bd73431b6e386fd59e1a3c07 (diff)
parenta3b38329449f7c1f0c97376c550fb189ccf5f28b (diff)
downloadsdl_android-93778656113f0023ec7025281b77e28000a1f5bd.tar.gz
Merge pull request #1205 from smartdevicelink/release/4.10-RC4.10.0
v4.10 Release
-rw-r--r--.travis.yml2
-rw-r--r--CHANGELOG.md60
-rw-r--r--VERSION2
-rwxr-xr-xandroid/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java34
-rw-r--r--android/sdl_android/build.gradle2
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Alert.json5
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CancelInteraction.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CloseApplication.json11
-rw-r--r--android/sdl_android/src/androidTest/assets/json/CreateWindow.json17
-rw-r--r--android/sdl_android/src/androidTest/assets/json/DeleteWindow.json13
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json23
-rw-r--r--android/sdl_android/src/androidTest/assets/json/GetVehicleData.json6
-rw-r--r--android/sdl_android/src/androidTest/assets/json/PerformInteraction.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json14
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json1
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Show.json39
-rw-r--r--android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json13
-rw-r--r--android/sdl_android/src/androidTest/assets/json/Slider.json3
-rw-r--r--android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json7
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json13
-rw-r--r--android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json7
-rw-r--r--android/sdl_android/src/androidTest/assets/xml/MOBILE_API.xml889
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/SdlArtworkTests.java50
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java79
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java13
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java90
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java33
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java29
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java226
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java223
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java55
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java63
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java65
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java111
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java393
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java136
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java21
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java111
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java22
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java15
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java7
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java25
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java99
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java48
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java24
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java18
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java202
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java66
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java16
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java100
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java57
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java14
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java70
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java13
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java20
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java135
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java109
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java122
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java97
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java10
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java89
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java133
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java30
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java12
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java144
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java5
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java108
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java109
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java74
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java82
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java8
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java56
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java2
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java106
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java110
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java118
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java47
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java8
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java32
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java41
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java51
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java121
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java35
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java75
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java98
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java44
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java42
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java74
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java22
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java63
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java70
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java366
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java1
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java63
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java7
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java94
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java36
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java83
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java29
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java47
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java199
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java69
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java135
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java28
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java17
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java28
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java73
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java4
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java3
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java24
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java5
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java5
-rw-r--r--android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml12
-rw-r--r--android/sdl_android/src/main/res/values/sdl.xml2
-rw-r--r--android/sdl_android/src/main/res/values/strings.xml1
-rw-r--r--android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java3
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java55
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java182
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java125
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java40
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java70
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java135
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java86
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java122
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java162
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java13
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java12
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java42
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java114
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java108
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java206
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java88
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java71
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java80
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java239
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java113
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java89
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java176
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java126
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java73
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplication.java61
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java163
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java45
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java46
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java78
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java89
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java21
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java46
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java133
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java38
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java101
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java22
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java96
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java98
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java81
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java65
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java132
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java41
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java70
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java62
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java26
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java32
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java63
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java114
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java15
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java143
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java76
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java99
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java20
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java80
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java99
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java95
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java76
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java110
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java49
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java9
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java208
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java80
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java158
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java57
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java52
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java66
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java4
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java79
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java72
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java68
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java28
-rw-r--r--base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/util/CompareUtils.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/util/DebugTool.java76
-rw-r--r--base/src/main/java/com/smartdevicelink/util/FileUtls.java12
-rw-r--r--base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/util/NativeLogTool.java75
-rw-r--r--base/src/main/java/com/smartdevicelink/util/Version.java30
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java1
l---------baseAndroid/src/main/java/com/smartdevicelink/util/CompareUtils.java1
-rw-r--r--hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java22
-rw-r--r--hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java20
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/BuildConfig.java2
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java105
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java16
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java32
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java45
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java128
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java1
308 files changed, 14711 insertions, 2357 deletions
diff --git a/.travis.yml b/.travis.yml
index 51e3dfe7a..625caaa52 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ android:
- tools
- platform-tools
- ndk-bundle
-
+
# The BuildTools version used by your project
- build-tools-28.0.3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40d356106..02101bda7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,59 @@
-# 4.9.1 Release Notes
+# 4.10.0 Release Notes
-### Hotfix
+## Features
-- [Fix ChoiceSetManager issue with HUs that require VR for choices](https://github.com/smartdevicelink/sdl_java_suite/issues/1137) \ No newline at end of file
+- [[SDL 0054] ChangeRegistration Manager was implemented for the Java Suite](https://github.com/smartdevicelink/sdl_java_suite/issues/1140)
+- [[SDL 0116] Open Menu RPC](https://github.com/smartdevicelink/sdl_java_suite/issues/659)
+- [[SDL 0115] CloseApplication RPC](https://github.com/smartdevicelink/sdl_java_suite/issues/658)
+- [[SDL 0119] SDL Passenger Mode](https://github.com/smartdevicelink/sdl_java_suite/issues/735)
+- [[SDL 0173] Read Generic Network Signal Data](https://github.com/smartdevicelink/sdl_java_suite/issues/990)
+- [[SDL 0177] Alert icon](https://github.com/smartdevicelink/sdl_java_suite/issues/795)
+- [[SDL 0179] Pixel density and Scale](https://github.com/smartdevicelink/sdl_java_suite/issues/804)
+- [[SDL 0184] Cancel Interaction RPC](https://github.com/smartdevicelink/sdl_java_suite/issues/840)
+- [[SDL 0186] Template Titles](https://github.com/smartdevicelink/sdl_java_suite/issues/818)
+- [[SDL 0199]-Adding-GPS-Shift-support](https://github.com/smartdevicelink/sdl_java_suite/issues/875)
+- [[SDL 0207] - RPC message protection](https://github.com/smartdevicelink/sdl_java_suite/issues/978)
+- [[SDL 0213]- Remote Control - Radio and Climate Parameter Update](https://github.com/smartdevicelink/sdl_java_suite/issues/960)
+- [[SDL 0216] Widget support](https://github.com/smartdevicelink/sdl_java_suite/issues/1069)
+- [[SDL 0221] Remote Control - Allow Multiple Modules per Module Type](https://github.com/smartdevicelink/sdl_java_suite/issues/1070)
+- [[SDL 0223] Add Currently Playing Media Image to MediaServiceData](https://github.com/smartdevicelink/sdl_java_suite/issues/1047)
+- [[SDL 0224] Navigation Subscription Buttons](https://github.com/smartdevicelink/sdl_java_suite/issues/1068)
+- [[SDL 0225] Update Published App Services](https://github.com/smartdevicelink/sdl_java_suite/issues/1060)
+- [[SDL 0231] Add Tiles as an Option for Main Menus](https://github.com/smartdevicelink/sdl_java_suite/issues/1076)
+- [[SDL 0243] Manager Update for DisplayCapability](https://github.com/smartdevicelink/sdl_java_suite/issues/1154)
+- [[SDL 0246] Add App Services to HMICapabilities](https://github.com/smartdevicelink/sdl_java_suite/issues/1159)
+- [Add showInOptionalState to LockScreenConfig along with other missing methods](https://github.com/smartdevicelink/sdl_java_suite/pull/1153)
+- [Make TCP use new transport layers](https://github.com/smartdevicelink/sdl_java_suite/pull/1108)
+- [FileManager now has getBytesAvailable() ](https://github.com/smartdevicelink/sdl_java_suite/issues/1133)
+- [Added isHighlighted & systemAction setters to SoftButtonState](https://github.com/smartdevicelink/sdl_java_suite/issues/1127)
+- [SoftButtonObject now let developers set their own ids](https://github.com/smartdevicelink/sdl_java_suite/issues/1126)
+- [Added prerecordedSpeech to SystemCapabilityManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1123)
+
+
+
+## Bug Fixes
+
+- [Prevent NPE when using Static Icons in the MenuManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1193)
+- [iSdlProtocol now gets notified when encrypted session is started](https://github.com/smartdevicelink/sdl_java_suite/issues/1181)
+- [Prevent NPE in TransportBrokerImpl.onHardwareDisconnected(SourceFile_309)](https://github.com/smartdevicelink/sdl_java_suite/issues/1082)
+- [Prevent NPE in SdlRouterService.java:3220 (handleIncommingClientMessage)](https://github.com/smartdevicelink/sdl_java_suite/issues/1101)
+- [Fix isStreaming() method in VSM](https://github.com/smartdevicelink/sdl_java_suite/issues/1164)
+- [Fix issues causing the video stream to not resume after stopping](https://github.com/smartdevicelink/sdl_java_suite/issues/1102)
+ - [Also see #1150](https://github.com/smartdevicelink/sdl_java_suite/issues/1150)
+- [Fix an issue that caused the video (NAV) service and stream to not be able to start again after the secondary transport was disconnected and reconnected](https://github.com/smartdevicelink/sdl_java_suite/issues/1151)
+- [Fix NPE in UsbAccessory.getManufacturer()](https://github.com/smartdevicelink/sdl_java_suite/issues/1086)
+- [Prevent a runtime exception when service isn't started in the foreground in time](https://github.com/smartdevicelink/sdl_java_suite/issues/1167)
+- [Dispose main underlying layers when SdlManager is disposed](https://github.com/smartdevicelink/sdl_java_suite/pull/1176)
+- [Align some RPC response params with RPC spec and make them not mandatory ](https://github.com/smartdevicelink/sdl_java_suite/issues/1180)
+- [Fix an issue where static Icons were not working with the ChoiceManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1194)
+- [Fix typo issue and register the SdlRouterService Bluetooth broadcast receiver to listen for state changes](https://github.com/smartdevicelink/sdl_java_suite/issues/1190)
+- [Register legacy Bluetooth broadcast receiver to listen for state changes](https://github.com/smartdevicelink/sdl_java_suite/pull/1192)
+- [Fix issue where video formats aren't supported, but used to start the video service](https://github.com/smartdevicelink/sdl_java_suite/pull/1206)
+- [Allow FileManager to start even with certain RPCs aren't allowed, eg ListFiles](https://github.com/smartdevicelink/sdl_java_suite/pull/1201)
+
+
+## Misc
+
+- [Fix misc code analyzer issues](https://github.com/smartdevicelink/sdl_java_suite/pull/1179)
+- [Old proxy classes are now deprecated ](https://github.com/smartdevicelink/sdl_java_suite/issues/1148)
+- [Align lockscreen behavior between platforms](https://github.com/smartdevicelink/sdl_java_suite/issues/1125)
diff --git a/VERSION b/VERSION
index 1f1ac7c2f..1910ba9d2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.9.1 \ No newline at end of file
+4.10.0 \ No newline at end of file
diff --git a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
index ada04a703..6b7e77c69 100755
--- a/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
+++ b/android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java
@@ -15,6 +15,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -32,6 +33,9 @@ import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.transport.BaseTransportConfig;
@@ -50,6 +54,8 @@ public class SdlService extends Service {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -156,7 +162,7 @@ public class SdlService extends Service {
// The app type to be used
Vector<AppHMIType> appType = new Vector<>();
- appType.add(AppHMIType.MEDIA);
+ appType.add(AppHMIType.DEFAULT);
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
// Here we will listen for ON_HMI_STATUS and ON_COMMAND notifications
@@ -167,8 +173,11 @@ public class SdlService extends Service {
sdlManager.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus status = (OnHMIStatus) notification;
- if (status.getHmiLevel() == HMILevel.HMI_FULL && ((OnHMIStatus) notification).getFirstRun()) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ if (onHMIStatus.getHmiLevel() == HMILevel.HMI_FULL && onHMIStatus.getFirstRun()) {
setVoiceCommands();
sendMenus();
performWelcomeSpeak();
@@ -187,6 +196,23 @@ public class SdlService extends Service {
@Override
public void onError(String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
// Create App Icon, this is set in the SdlManager builder
@@ -270,7 +296,7 @@ public class SdlService extends Service {
});
// sub menu parent cell
- MenuCell mainCell3 = new MenuCell("Test Cell 3 (sub menu)", null, Arrays.asList(subCell1,subCell2));
+ MenuCell mainCell3 = new MenuCell("Test Cell 3 (sub menu)", MenuLayout.LIST, null, Arrays.asList(subCell1,subCell2));
MenuCell mainCell4 = new MenuCell("Show Perform Interaction", null, null, new MenuSelectionListener() {
@Override
diff --git a/android/sdl_android/build.gradle b/android/sdl_android/build.gradle
index 88c2617ec..aa5f96b1f 100644
--- a/android/sdl_android/build.gradle
+++ b/android/sdl_android/build.gradle
@@ -6,7 +6,7 @@ android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 8
- targetSdkVersion 26
+ targetSdkVersion 28
versionCode 11
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
diff --git a/android/sdl_android/src/androidTest/assets/json/Alert.json b/android/sdl_android/src/androidTest/assets/json/Alert.json
index ab497110b..75ff2ca50 100644
--- a/android/sdl_android/src/androidTest/assets/json/Alert.json
+++ b/android/sdl_android/src/androidTest/assets/json/Alert.json
@@ -9,6 +9,11 @@
"alertText2":"Line 2",
"alertText3":"Line 3",
"progressIndicator":true,
+ "cancelID":45,
+ "alertIcon":{
+ "value":"alertIconImage1.png",
+ "imageType":"DYNAMIC"
+ },
"ttsChunks":[
{
"text":"Phrase 1",
diff --git a/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
new file mode 100644
index 000000000..dc420ad8f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CancelInteraction.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"CancelInteraction",
+ "correlationID":554,
+ "parameters":{
+ "cancelID":6052,
+ "functionID":12
+ }
+ },
+ "response":{
+ "name":"CancelInteractionResponse",
+ "correlationID":554
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CloseApplication.json b/android/sdl_android/src/androidTest/assets/json/CloseApplication.json
new file mode 100644
index 000000000..d58666311
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CloseApplication.json
@@ -0,0 +1,11 @@
+{
+ "request":{
+ "name":"CloseApplication",
+ "correlationID":131
+ },
+ "response":{
+ "name":"CloseApplicationResponse",
+ "correlationID":131,
+ "parameters":{}
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/CreateWindow.json b/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
new file mode 100644
index 000000000..6322b5250
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/CreateWindow.json
@@ -0,0 +1,17 @@
+{
+ "request":{
+ "name":"CreateWindow",
+ "correlationID":107,
+ "parameters":{
+ "windowID":765,
+ "windowName":"Window Name",
+ "type": "MAIN",
+ "associatedServiceType":"Service Type",
+ "duplicateUpdatesFromWindowID":766
+ }
+ },
+ "response":{
+ "name":"CreateWindowResponse",
+ "correlationID":108
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json b/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
new file mode 100644
index 000000000..69b9013b1
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/DeleteWindow.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"DeleteWindow",
+ "correlationID":109,
+ "parameters":{
+ "windowID":765
+ }
+ },
+ "response":{
+ "name":"DeleteWindowResponse",
+ "correlationID":110
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
new file mode 100644
index 000000000..5ab1c6c41
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/GetInteriorVehicleDataConsent.json
@@ -0,0 +1,23 @@
+{
+ "request":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":168,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":[
+ "A0A",
+ "R0A"
+ ]
+ }
+ },
+ "response":{
+ "name":"GetInteriorVehicleDataConsent",
+ "correlationID":169,
+ "parameters":{
+ "allowed":[
+ true,
+ true
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
index 81b25ef87..7cef581b7 100644
--- a/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/GetVehicleData.json
@@ -31,7 +31,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -168,7 +169,8 @@
"type":"DIESEL",
"range":10.0
}
- ]
+ ],
+ "oemCustomVehicleDataName":"oemCustomVehicleDataState"
}
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
index b8965ee61..583a72b1c 100644
--- a/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
+++ b/android/sdl_android/src/androidTest/assets/json/PerformInteraction.json
@@ -43,6 +43,7 @@
}
],
"timeout":0,
+ "cancelID":45,
"vrHelp":[
{
"position":7,
diff --git a/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
new file mode 100644
index 000000000..9f9f60096
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ReleaseInteriorVehicleDataModule.json
@@ -0,0 +1,14 @@
+{
+ "request":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":172,
+ "parameters":{
+ "moduleType":"CLIMATE",
+ "moduleIds":"A0A"
+ }
+ },
+ "response":{
+ "name":"ReleaseInteriorVehicleDataModule",
+ "correlationID":173
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
index f86dc188c..3b14d1a43 100644
--- a/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
+++ b/android/sdl_android/src/androidTest/assets/json/ScrollableMessage.json
@@ -5,6 +5,7 @@
"parameters":{
"scrollableMessageBody":"Sample body text",
"timeout":1000,
+ "cancelID":45,
"softButtons":[
{
"isHighlighted":true,
diff --git a/android/sdl_android/src/androidTest/assets/json/Show.json b/android/sdl_android/src/androidTest/assets/json/Show.json
index 97ef1f20f..6afe27d72 100644
--- a/android/sdl_android/src/androidTest/assets/json/Show.json
+++ b/android/sdl_android/src/androidTest/assets/json/Show.json
@@ -17,10 +17,49 @@
"mainField2":"Main Field 2",
"mainField3":"Main Field 3",
"mainField4":"Main Field 4",
+ "templateTitle":"Template Title",
"statusBar":"Status",
"mediaClock":"Media Clock",
"alignment":"LEFT_ALIGNED",
"mediaTrack":"Media Track",
+ "windowID":10,
+ "templateConfiguration": {
+ "template": "template",
+ "dayColorScheme": {
+ "backgroundColor": {
+ "blue": 9,
+ "green": 8,
+ "red": 7
+ },
+ "secondaryColor": {
+ "blue": 6,
+ "green": 5,
+ "red": 4
+ },
+ "primaryColor": {
+ "blue": 3,
+ "green": 2,
+ "red": 1
+ }
+ },
+ "nightColorScheme": {
+ "backgroundColor": {
+ "blue": 18,
+ "green": 17,
+ "red": 16
+ },
+ "secondaryColor": {
+ "blue": 15,
+ "green": 14,
+ "red": 13
+ },
+ "primaryColor": {
+ "blue": 12,
+ "green": 11,
+ "red": 10
+ }
+ }
+ },
"secondaryGraphic":{
"value":"image2.png",
"imageType":"STATIC"
diff --git a/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
new file mode 100644
index 000000000..8870423de
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/ShowAppMenu.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"ShowAppMenu",
+ "correlationID":187,
+ "parameters":{
+ "menuID":100
+ }
+ },
+ "response":{
+ "name":"ShowAppMenuResponse",
+ "correlationID":188
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/Slider.json b/android/sdl_android/src/androidTest/assets/json/Slider.json
index 38f033df4..5b69f4728 100644
--- a/android/sdl_android/src/androidTest/assets/json/Slider.json
+++ b/android/sdl_android/src/androidTest/assets/json/Slider.json
@@ -12,7 +12,8 @@
"Header Line 4"
],
"position":11,
- "timeout":30000
+ "timeout":30000,
+ "cancelID":45
}
},
"response":{
diff --git a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
index 92cf00a1b..4abab4cc0 100644
--- a/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/SubscribeVehicleData.json
@@ -30,7 +30,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -148,6 +149,10 @@
"electronicParkBrakeStatus":{
"dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
"resultCode":"SUCCESS"
+ },
+ "oemCustomVehicleDataName":{
+ "oemCustomDataType":"oemCustomVehicleDataName",
+ "resultCode":"SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json b/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json
new file mode 100644
index 000000000..70521a278
--- /dev/null
+++ b/android/sdl_android/src/androidTest/assets/json/UnpublishAppService.json
@@ -0,0 +1,13 @@
+{
+ "request":{
+ "name":"UnpublishAppService",
+ "correlationID":184,
+ "parameters":{
+ "serviceID":"test"
+ }
+ },
+ "response":{
+ "name":"UnpublishAppServiceResponse",
+ "correlationID":185
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
index d01b99aa8..f6f8860fb 100644
--- a/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
+++ b/android/sdl_android/src/androidTest/assets/json/UnsubscribeVehicleData.json
@@ -30,7 +30,8 @@
"myKey":true,
"fuelRange":true,
"turnSignal":true,
- "electronicParkBrakeStatus":true
+ "electronicParkBrakeStatus":true,
+ "oemCustomVehicleDataName":true
}
},
"response":{
@@ -148,6 +149,10 @@
"electronicParkBrakeStatus":{
"dataType":"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS",
"resultCode":"SUCCESS"
+ },
+ "oemCustomVehicleDataName":{
+ "oemCustomDataType":"oemCustomVehicleDataName",
+ "resultCode":"SUCCESS"
}
}
}
diff --git a/android/sdl_android/src/androidTest/assets/xml/MOBILE_API.xml b/android/sdl_android/src/androidTest/assets/xml/MOBILE_API.xml
index 6582c9361..86cfe4f5c 100644
--- a/android/sdl_android/src/androidTest/assets/xml/MOBILE_API.xml
+++ b/android/sdl_android/src/androidTest/assets/xml/MOBILE_API.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
-<interface name="SmartDeviceLink RAPI" version="5.1.0" minVersion="1.0" date="2019-03-19">
+<interface name="SmartDeviceLink RAPI" version="6.0.0" minVersion="1.0" date="2019-03-19">
<enum name="Result" internal_scope="base" since="1.0">
<element name="SUCCESS">
<description>The request succeeded</description>
@@ -138,6 +138,9 @@
<element name="CORRUPTED_DATA" since="5.0">
<description>The data sent failed to pass CRC check in receiver end</description>
</element>
+ <element name="ENCRYPTION_NEEDED" since="6.0">
+ <description>SDL receives an un-encrypted RPC request that needs protection. </description>
+ </element>
</enum>
<enum name="ButtonPressMode" since="1.0">
@@ -347,6 +350,28 @@
</element>
</enum>
+ <enum name="WindowType" since="6.0">
+ <element name="MAIN">
+ <description>
+ This window type describes the main window on a display.
+ </description>
+ </element>
+ <element name="WIDGET">
+ <description>
+ A widget is a small window that the app can create to provide information and soft buttons for quick app control.
+ </description>
+ </element>
+ </enum>
+
+ <enum name="PredefinedWindows" since="6.0">
+ <element name="DEFAULT_WINDOW" value="0">
+ <description>The default window is a main window pre-created on behalf of the app.</description>
+ </element>
+ <element name="PRIMARY_WIDGET" value="1">
+ <description>The primary widget of the app.</description>
+ </element>
+ </enum>
+
<enum name="HMILevel" since="1.0">
<description>Enumeration that describes current levels of HMI.</description>
<element name="FULL" internal_name="HMI_FULL" />
@@ -543,6 +568,7 @@
<element name="VEHICLEDATA_ENGINEOILLIFE" since="5.0" />
<element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" since="5.0" />
<element name="VEHICLEDATA_CLOUDAPPVEHICLEID" since="5.1"/>
+ <element name="VEHICLEDATA_OEM_CUSTOM_DATA" since="6.0"/>
</enum>
<enum name="HybridAppPreference" since="5.1">
@@ -623,6 +649,26 @@
<element name="SOURCE" since="4.5" />
<element name="SHUFFLE" since="4.5" />
<element name="REPEAT" since="4.5" />
+ <!-- Navigation Buttons -->
+ <element name="NAV_CENTER_LOCATION" since="6.0" />
+ <element name="NAV_ZOOM_IN" since="6.0" />
+ <element name="NAV_ZOOM_OUT" since="6.0" />
+ <element name="NAV_PAN_UP" since="6.0" />
+ <element name="NAV_PAN_UP_RIGHT" since="6.0" />
+ <element name="NAV_PAN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN" since="6.0" />
+ <element name="NAV_PAN_DOWN_LEFT" since="6.0" />
+ <element name="NAV_PAN_LEFT" since="6.0" />
+ <element name="NAV_PAN_UP_LEFT" since="6.0" />
+ <element name="NAV_TILT_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" since="6.0" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" since="6.0" />
+ <element name="NAV_HEADING_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="MediaClockFormat" since="1.0">
@@ -733,6 +779,10 @@
<description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
</element>
+ <element name="templateTitle" since="6.0">
+ <description>The title of the new template that will be displayed; applies to "Show"</description>
+ </element>
+
<element name="alertText1">
<description>The first line of the alert text field; applies to "Alert"</description>
</element>
@@ -872,6 +922,10 @@
<description>The optional image of a destination / location</description>
</element>
+ <element name="alertIcon" since="6.0">
+ <description>The image field for Alert</description>
+ </element>
+
</enum>
<enum name="CharacterSet" since="1.0">
@@ -898,7 +952,7 @@
</enum>
<enum name="TBTState" since="2.0">
- <description>Enumeration that describes possible states of turn-by-turn client or AppLink app.</description>
+ <description>Enumeration that describes possible states of turn-by-turn client or SmartDeviceLink app.</description>
<element name="ROUTE_UPDATE_REQUEST" />
<element name="ROUTE_ACCEPTED" />
<element name="ROUTE_REFUSED" />
@@ -1074,6 +1128,9 @@
<enum name="GlobalProperty" since="1.0">
<description>The different global properties.</description>
+ <element name="USER_LOCATION" since="6.0">
+ <description>Location of the user's seat of setGlobalProperties</description>
+ </element>
<element name="HELPPROMPT" since="1.0">
<description>The property helpPrompt of setGlobalProperties</description>
</element>
@@ -1642,9 +1699,6 @@
</param>
</struct>
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- Ford Specific Data Items -->
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<enum name="FileType" since="2.0">
<description>Enumeration listing possible file types.</description>
<element name="GRAPHIC_BMP" />
@@ -1800,7 +1854,8 @@
</param>
<param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255" mandatory="true">
- <description>References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
+ <description>
+ References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
0x00 No event
0xFE Not supported
0xFF Fault
@@ -1832,10 +1887,6 @@
</param>
</struct>
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- / Ford Specific Data Items -->
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-
<enum name="VehicleDataResultCode" since="2.0">
<description>Enumeration that describes possible result codes of a vehicle data entry request.</description>
<element name="SUCCESS" internal_name="VDRC_SUCCESS">
@@ -1845,7 +1896,7 @@
<description>DTC / DID request successful, however, not all active DTCs or full contents of DID location available</description>
</element>
<element name="DISALLOWED" internal_name="VDRC_DISALLOWED">
- <description>This vehicle data item is not allowed for this app by Ford.</description>
+ <description>This vehicle data item is not allowed for this app by the OEM/Manufactorer of the connected module.</description>
</element>
<element name="USER_DISALLOWED" internal_name="VDRC_USER_DISALLOWED">
<description>The user has not granted access to this type of vehicle data item at this time.</description>
@@ -1909,6 +1960,12 @@
</element>
</enum>
+ <enum name="MenuLayout" since="6.0">
+ <description>How the main menu or submenu is laid out on screen</description>
+ <element name="LIST" />
+ <element name="TILES" />
+ </enum>
+
<struct name="GPSData" since="2.0">
<description>Struct with the GPS data.</description>
<param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
@@ -2014,6 +2071,13 @@
<param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true" since="2.0" until="5.0"/>
</history>
</param>
+ <param name="shifted" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ False, if the GPS data is raw and un-shifted.
+ If not provided, then value is assumed False.
+ </description>
+ </param>
</struct>
<struct name="VehicleDataResult" since="2.0">
@@ -2024,6 +2088,9 @@
<param name="resultCode" type="VehicleDataResultCode" mandatory="true">
<description>Published data result code.</description>
</param>
+ <param name="oemCustomDataType" type="String" mandatory="false" since="6.0">
+ <description>Type of requested oem specific parameter </description>
+ </param>
</struct>
<struct name="DIDResult" since="2.0">
@@ -2172,10 +2239,14 @@
</param>
<param name="hmiPermissions" type="HMIPermissions" mandatory="true"/>
<param name="parameterPermissions" type="ParameterPermissions" mandatory="true"/>
+ <param name="requireEncryption" type="Boolean" mandatory="false" since="6.0"/>
</struct>
- <struct name="DisplayCapabilities" since="1.0">
- <description>Contains information about the display capabilities.</description>
+ <struct name="DisplayCapabilities" deprecated="true" since="6.0">
+ <history>
+ <struct name="DisplayCapabilities" since="1.0" until="6.0"/>
+ </history>
+ <description>Contains information about the display capabilities. This struct is deprecated; please see the new SystemCapability DISPLAYS and corresponding struct DisplayCapability </description>
<param name="displayType" type="DisplayType" mandatory="true" deprecated="true" since="5.0">
<description>The type of the display. See DisplayType</description>
<history>
@@ -2206,15 +2277,49 @@
<param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false" since="3.0">
<description>The number of on-screen custom presets available (if any); otherwise omitted.</description>
</param>
-
<!-- TODO: Add pixel density? -->
</struct>
+ <struct name="Grid" since="6.0">
+ <description>Describes a location (origin coordinates and span) of a vehicle component.</description>
+ <param name="col" type="Integer" mandatory="true" minvalue="-1" maxvalue="100">
+ </param>
+ <param name="row" type="Integer" mandatory="true" minvalue="-1" maxvalue="100">
+ </param>
+ <param name="level" type="Integer" mandatory="false" defvalue="0" minvalue="-1" maxvalue="100" >
+ </param>
+ <param name="colspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+ <param name="rowspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+ <param name="levelspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+ </struct>
+
+ <struct name="ModuleInfo" since="6.0">
+ <description>Information about a RC module</description>
+ <param name="moduleId" type="String" maxlength="100" mandatory="true">
+ <description> uuid of a module. "moduleId + moduleType" uniquely identify a module.</description>
+ </param>
+ <param name="location" type="Grid" mandatory="false">
+ <description>Location of a module.</description>
+ </param>
+ <param name="serviceArea" type="Grid" mandatory="false">
+ <description>Service area of a module. </description>
+ </param>
+ <param name="allowMultipleAccess" type="Boolean" mandatory="false" defvalue="true">
+ <description>allow multiple users/apps to access the module or not </description>
+ </param>
+ </struct>
+
<struct name="ButtonCapabilities" since="1.0">
<description>Contains information about a button's capabilities.</description>
<param name="name" type="ButtonName" mandatory="true">
<description>The name of the button. See ButtonName.</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="shortPressAvailable" type="Boolean" mandatory="true">
<description>
The button supports a short press.
@@ -2260,6 +2365,12 @@
<param name="imageSupported" type="Boolean" mandatory="true">
<description>The button supports referencing a static or dynamic image.</description>
</param>
+ <param name="textSupported" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ The button supports the use of text.
+ If not included, the default value should be considered true that the button will support text.
+ </description>
+ </param>
</struct>
<struct name="PresetBankCapabilities" since="2.0">
@@ -2269,6 +2380,64 @@
</param>
</struct>
+ <struct name="WindowCapability" since="6.0">
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ The specified ID of the window. This ID is either one used when sending the CreateWindow request,
+ or one of the predefined window ID values from the enum PredefinedWindows. If ommited, value is
+ assumed to be the main window on the main display.
+ </description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="imageTypeSupported" type="ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
+ <description>Provides information about image types supported by the system.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
+ <description>A set of all window templates available on the head unit.</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-window custom presets available (if any); otherwise omitted.</description>
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of buttons and the capabilities of each on-window button.</description>
+ </param>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of soft buttons available on-window and the capabilities for each button.</description>
+ </param>
+ <param name="menuLayoutsAvailable" type="MenuLayout" array="true" minsize="1" maxsize="1000" mandatory="false" since="6.0">
+ <description>An array of available menu layouts. If this parameter is not provided, only the `LIST` layout is assumed to be available</description>
+ </param>
+ </struct>
+
+ <struct name="WindowTypeCapabilities" since="6.0">
+ <param name="type" type="WindowType" mandatory="true" />
+ <param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
+ </struct>
+
+ <struct name="DisplayCapability" since="6.0">
+ <param name="displayName" type="String" mandatory="false" />
+ <param name="windowTypeSupported" type="WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
+ <description>
+ Informs the application how many windows the app is allowed to create per type.
+ </description>
+ </param>
+ <param name="windowCapabilities" type="WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <description>
+ Contains a list of capabilities of all windows related to the app.
+ Once the app has registered the capabilities of all windows are provided.
+ GetSystemCapability still allows requesting window capabilities of all windows.
+ After registration, only windows with capabilities changed will be included. Following cases will cause only affected windows to be included:
+ 1. App creates a new window. After the window is created, a system capability notification will be sent related only to the created window.
+ 2. App sets a new layout to the window. The new layout changes window capabilties. The notification will reflect those changes to the single window.
+ </description>
+ </param>
+ </struct>
+
<struct name="HMICapabilities" since="3.0">
<param name="navigation" type="Boolean" mandatory="false">
<description>Availability of build in Nav. True: Available, False: Not Available</description>
@@ -2282,6 +2451,15 @@
<param name="remoteControl" type="Boolean" mandatory="false" since="4.5">
<description>Availability of remote control feature. True: Available, False: Not Available</description>
</param>
+ <param name="appServices" type="Boolean" mandatory="false" since="6.0">
+ <description>Availability of App Services functionality. True: Available, False: Not Available</description>
+ </param>
+ <param name="displays" type="Boolean" mandatory="false" since="6.0">
+ <description>Availability of displays capability. True: Available, False: Not Available</description>
+ </param>
+ <param name="seatLocation" type="Boolean" mandatory="false" since="6.0">
+ <description>Availability of seat location feature. True: Available, False: Not Available</description>
+ </param>
</struct>
<struct name="MenuParams" since="1.0">
@@ -2391,8 +2569,17 @@
<description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
<description>If omitted, the entire keyboard will be enabled.</description>
</param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false" deprecated="true" since="6.0">
+ <description>Deprecated, use autoCompleteList instead.</description>
+ <history>
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false" since="3.0" until="6.0" />
+ </history>
+ </param>
+ <param name="autoCompleteList" type="String" maxlength="1000" minsize="0" maxsize="100" array="true" mandatory="false" since="6.0">
+ <description>
+ Allows an app to prepopulate the text field with a list of suggested or completed entries as the user types.
+ If empty, the auto-complete list will be removed from the screen.
+ </description>
</param>
</struct>
@@ -2585,7 +2772,7 @@
</enum>
<enum name="FunctionID" internal_scope="base" since="1.0">
- <description>Enumeration linking function names with function IDs in AppLink protocol. Assumes enumeration starts at value 0.</description>
+ <description>Enumeration linking function names with function IDs in SmartDeviceLink protocol. Assumes enumeration starts at value 0.</description>
<element name="RESERVED" value="0" since="1.0" />
<!--
Base Request / Response RPCs
@@ -2645,6 +2832,14 @@
<element name="GetAppServiceDataID" value="53" hexvalue="35" since="5.1" />
<element name="GetFileID" value="54" hexvalue="36" since="5.1" />
<element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" />
+ <element name="UnpublishAppServiceID" value="56" hexvalue="38" since="6.0" />
+ <element name="CancelInteractionID" value="57" hexvalue="39" since="6.0" />
+ <element name="CloseApplicationID" value="58" hexvalue="3A" since="6.0" />
+ <element name="ShowAppMenuID" value="59" hexvalue="3B" since="6.0" />
+ <element name="CreateWindowID" value="60" hexvalue="3C" since="6.0" />
+ <element name="DeleteWindowID" value="61" hexvalue="3D" since="6.0" />
+ <element name="GetInteriorVehicleDataConsentID" value="62" hexvalue="3E" since="6.0" />
+ <element name="ReleaseInteriorVehicleDataModuleID" value="63" hexvalue="3F" since="6.0" />
<!--
Base Notifications
@@ -2829,6 +3024,8 @@
<element name="VIDEO_STREAMING"/>
<element name="REMOTE_CONTROL"/>
<element name="APP_SERVICES" since="5.1"/>
+ <element name="SEAT_LOCATION" since="6.0"/>
+ <element name="DISPLAYS" since="6.0"/>
</enum>
<struct name="NavigationCapability" since="4.5">
@@ -2872,6 +3069,15 @@
<param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
<description>True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data'. </description>
</param>
+ <param name="diagonalScreenSize" type="Float" minvalue="0" mandatory="false" since="6.0">
+ <description>The diagonal screen size in inches.</description>
+ </param>
+ <param name="pixelPerInch" type="Float" minvalue="0" mandatory="false" since="6.0">
+ <description>PPI is the diagonal resolution in pixels divided by the diagonal screen size in inches.</description>
+ </param>
+ <param name="scale" type="Float" minvalue="1" maxvalue="10" mandatory="false" since="6.0">
+ <description>The scaling factor the app should use to change the size of the projecting view.</description>
+ </param>
</struct>
<struct name="RGBColor" since="5.0">
@@ -2895,8 +3101,36 @@
</param>
</struct>
+ <struct name="TemplateConfiguration" since="6.0">
+ <param name="template" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created window template.
+ Currently only predefined window template layouts are defined.
+ </description>
+ </param>
+ <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false" />
+ <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" />
+ </struct>
+
<!---Remote control -->
+ <struct name="SeatLocation" since="6.0">
+ <description>Describes the location of a seat.</description>
+ <param name="grid" type="Grid" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="SeatLocationCapability" since="6.0">
+ <description>Contains information about the locations of each seat</description>
+ <param name="rows" type="Integer" minvalue="1" maxvalue="100" mandatory="false"></param>
+ <param name="columns" type="Integer" minvalue="1" maxvalue="100" mandatory="false"></param>
+ <param name="levels" type="Integer" minvalue="1" maxvalue="100" defvalue="1" mandatory="false">
+ </param>
+ <param name="seats" type="SeatLocation" array="true" mandatory="false">
+ <description>Contains a list of SeatLocation in the vehicle</description>
+ </param>
+ </struct>
+
<enum name="MassageZone" since="5.0">
<description>List possible zones of a multi-contour massage seat.</description>
<element name="LUMBAR">
@@ -2953,15 +3187,22 @@
<param name="action" type="SeatMemoryActionType" mandatory="true"/>
</struct>
- <enum name="SupportedSeat" since="5.0">
+ <enum name="SupportedSeat" deprecated="true" since="6.0">
<description>List possible seats that is a remote controllable seat.</description>
+ <history>
+ <enum name="SupportedSeat" since="5.0" until="6.0"/>
+ </history>
<element name="DRIVER"/>
<element name="FRONT_PASSENGER"/>
</enum>
<struct name="SeatControlData" since="5.0">
<description>Seat control data corresponds to "SEAT" ModuleType. </description>
- <param name="id" type="SupportedSeat" mandatory="true"></param>
+ <param name="id" type="SupportedSeat" mandatory="true" deprecated="true" since="6.0">
+ <history>
+ <param name="id" type="SupportedSeat" mandatory="true" since="5.0" until="6.0"/>
+ </history>
+ </param>
<param name="heatingEnabled" type="Boolean" mandatory="false"></param>
<param name="coolingEnabled" type="Boolean" mandatory="false"></param>
@@ -2991,6 +3232,9 @@
It should not be used to identify a module by mobile application.
</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="heatingEnabledAvailable" type="Boolean" mandatory="false">
</param>
<param name="coolingEnabledAvailable" type="Boolean" mandatory="false">
@@ -3100,16 +3344,21 @@
<param name="hdRadioEnable" type="Boolean" mandatory="false" since="5.0">
<description> True if the hd radio is on, false if the radio is off</description>
</param>
- <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0">
- <description>number of HD sub-channels if available</description>
+ <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" deprecated="true" since="6.0">
+ <description>Number of HD sub-channels if available</description>
<history>
<param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false" since="4.5" until="5.0"/>
+ <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0" until="6.0"/>
</history>
</param>
- <param name="hdChannel" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0">
+ <param name="availableHdChannels" type="Integer" minvalue="0" maxvalue="7" array="true" minsize="0" maxsize="8" mandatory="false" since="6.0">
+ <description>The list of available HD sub-channel indexes. Empty list means no Hd channel is available. Read-only. </description>
+ </param>
+ <param name="hdChannel" type="Integer" minvalue="0" maxvalue="7" mandatory="false" since="6.0">
<description>Current HD sub-channel if available</description>
<history>
<param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false" since="4.5" until="5.0"/>
+ <param name="hdChannel" type="Integer" minvalue="1" maxvalue="7" mandatory="false" since="5.0" until="6.0"/>
</history>
</param>
<param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
@@ -3160,17 +3409,22 @@
<param name="heatedMirrorsEnable" type="Boolean" mandatory="false" since="5.0">
<description>value false means disabled, value true means enabled.</description>
</param>
+ <param name="climateEnable" type="Boolean" mandatory="false" since="6.0">
+ <description>True if the climate module is on, false if the climate module is off</description>
+ </param>
</struct>
<struct name="RadioControlCapabilities" since="4.5">
<description>Contains information about a radio control module's capabilities.</description>
- <!-- need an ID in the future -->
<param name="moduleName" type="String" maxlength="100" mandatory="true">
<description>
The short friendly name of the climate control module.
It should not be used to identify a module by mobile application.
</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="radioEnableAvailable" type="Boolean" mandatory="false">
<description>
Availability of the control of enable/disable radio.
@@ -3201,11 +3455,20 @@
True: Available, False: Not Available, Not present: Not Available.
</description>
</param>
- <param name="availableHDsAvailable" type="Boolean" mandatory="false">
+ <param name="availableHDsAvailable" type="Boolean" mandatory="false" deprecated="true" since="6.0">
<description>
Availability of the getting the number of available HD channels.
True: Available, False: Not Available, Not present: Not Available.
</description>
+ <history>
+ <param name="availableHDsAvailable" type="Boolean" mandatory="false" since="4.5" until="6.0"/>
+ </history>
+ </param>
+ <param name="availableHdChannelsAvailable" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ Availability of the list of available HD sub-channel indexes.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
</param>
<param name="stateAvailable" type="Boolean" mandatory="false">
<description>
@@ -3247,11 +3510,13 @@
<struct name="ClimateControlCapabilities" since="4.5">
<description>Contains information about a climate control module's capabilities.</description>
- <!-- need an ID in the future -->
<param name="moduleName" type="String" maxlength="100" mandatory="true">
<description>The short friendly name of the climate control module.
It should not be used to identify a module by mobile application.</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="currentTemperatureAvailable" type="Boolean" mandatory="false" since="5.0">
<description>
Availability of the reading of current temperature.
@@ -3346,6 +3611,12 @@
True: Available, False: Not Available, Not present: Not Available.
</description>
</param>
+ <param name="climateEnableAvailable" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ Availability of the control of enable/disable climate control.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
</struct>
<struct name="EqualizerSettings" since="5.0">
@@ -3391,6 +3662,9 @@
It should not be used to identify a module by mobile application.
</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="sourceAvailable" type="Boolean" mandatory="false">
<description>Availability of the control of audio source. </description>
</param>
@@ -3543,6 +3817,9 @@
It should not be used to identify a module by mobile application.
</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="supportedLights" type="LightCapabilities" minsize="1" maxsize="100" array="true" mandatory="true">
<description> An array of available LightCapabilities that are controllable. </description>
</param>
@@ -3588,6 +3865,9 @@
It should not be used to identify a module by mobile application.
</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false" since="6.0">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="distanceUnitAvailable" type="Boolean" mandatory="false">
<description>Availability of the control of distance unit. </description>
</param>
@@ -3603,6 +3883,9 @@
<description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description>
<param name="moduleType" type="ModuleType" mandatory="true">
</param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false" since="6.0">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
<param name="radioControlData" type="RadioControlData" mandatory="false">
</param>
<param name="climateControlData" type="ClimateControlData" mandatory="false">
@@ -3830,6 +4113,13 @@
Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
</description>
</param>
+ <param name="mediaImage" type="Image" mandatory="false" since="6.0">
+ <description>
+ Music: The album art of the current track
+ Podcast: The podcast or chapter artwork of the current podcast episode
+ Audiobook: The book or chapter artwork of the current audiobook
+ </description>
+ </param>
</struct>
<struct name="WeatherServiceManifest" since="5.1">
@@ -4141,6 +4431,10 @@
<param name="appServicesCapabilities" type="AppServicesCapabilities" mandatory="false" since="5.1">
<description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
</param>
+ <param name="seatLocationCapability" type="SeatLocationCapability" mandatory="false" since="6.0">
+ <description>Contains information about the locations of each seat</description>
+ </param>
+ <param name="displayCapabilities" type="DisplayCapability" array="true" minsize="1" maxsize="1000" mandatory="false" since="6.0"/>
</struct>
<!-- Requests/Responses -->
@@ -4157,21 +4451,21 @@
<param name="appName" type="String" maxlength="100" mandatory="true" since="1.0">
<description>
- The mobile application name, e.g. "Ford Drive Green".
- Needs to be unique over all applications.
+ The mobile application name, e.g. "My SDL App".
+ Needs to be unique over all applications from the same device.
May not be empty.
May not start with a new line character.
- May not interfere with any name or synonym of previously registered applications and any predefined blacklist of words (global commands)
- Needs to be unique over all applications. Applications with the same name will be rejected.
+ May not interfere with any name or synonym of previously registered applications from the same device and any predefined blacklist of words (global commands)
+ Additional applications with the same name from the same device will be rejected.
Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
</description>
</param>
<param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0">
<description>
- TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
+ TTS string for VR recognition of the mobile application name, e.g. "My S D L App".
Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
- Needs to be unique over all applications.
+ Needs to be unique over all applications from the same device.
May not be empty.
May not start with a new line character.
Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
@@ -4189,7 +4483,7 @@
<param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false" since="1.0">
<description>
Defines an additional voice recognition command.
- May not interfere with any app name of previously registered applications and any predefined blacklist of words (global commands)
+ May not interfere with any app name of previously registered applications from the same device and any predefined blacklist of words (global commands)
Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
</description>
</param>
@@ -4290,21 +4584,44 @@
<description>The currently active display language on the module. See "Language" for options.</description>
</param>
- <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ See DisplayCapabilities. This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
- <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ See ButtonCapabilities. This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
- <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.
+ This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
- <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" since="2.0">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.
+ This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
+
<param name="hmiZoneCapabilities" type="HmiZoneCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="1.0">
<description>See HmiZoneCapabilities</description>
</param>
@@ -4340,7 +4657,7 @@
</param>
<param name="hmiCapabilities" type="HMICapabilities" mandatory="false" since="3.0">
- <description>Specifies the HMI’s capabilities. See HMICapabilities.</description>
+ <description>Specifies the HMI's capabilities. See HMICapabilities.</description>
</param>
<param name="sdlVersion" type="String" maxlength="100" mandatory="false" platform="documentation" since="3.0">
@@ -4389,9 +4706,113 @@
</function>
+ <function name="CreateWindow" functionID="CreateWindowID" messagetype="request" since="6.0">
+ <description>
+ Create a new window on the display with the specified window type.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ </description>
+ </param>
+
+ <param name="windowName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ Multiple apps can share the same window name except for the default main window.
+ Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ </description>
+ </param>
+
+ <param name="type" type="WindowType" mandatory="true">
+ <description>The type of the window to be created. Main window or widget.</description>
+ </param>
+
+ <param name="associatedServiceType" type="String" mandatory="false">
+ <description>
+ Allows an app to create a widget related to a specific service type.
+ As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio. Actions such as skip or play/pause will be
+ directed to this active media app. In case of widgets, the system can provide a single "media" widget which will act as a placeholder for the active media app.
+
+ It is only allowed to have one window per service type. This means that a media app can only have a single MEDIA widget. Still the app can create widgets omitting this parameter. Those widgets would be available as app specific widgets that are permanently included in the HMI.
+
+ This parameter is related to widgets only. The default main window, which is pre-created during app registration, will be created based on the HMI types specified in the app registration request.
+ </description>
+ </param>
+ <param name="duplicateUpdatesFromWindowID" type="Integer" mandatory="false">
+ <description>
+ Optional parameter. Specify whether the content sent to an existing window
+ should be duplicated to the created window.
+ If there isn't a window with the ID, the request will be rejected with `INVALID_DATA`.
+ </description>
+ </param>
+ </function>
+
+ <function name="CreateWindow" functionID="CreateWindowID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="DISALLOWED"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" functionID="DeleteWindowID" messagetype="request" since="6.0">
+ <description>
+ Deletes previously created window of the SDL application.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and cannot be deleted.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" functionID="DeleteWindowID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="DISALLOWED"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+ </function>
+
<function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="request" since="1.0">
<description>Allows setting global properties.</description>
-
+ <param name="userLocation" type="SeatLocation" mandatory="false" since="6.0">
+ <description>Location of the user's seat. Default is driver's seat location if it is not set yet.</description>
+ </param>
<param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" since="1.0">
<description>
The help prompt.
@@ -4419,7 +4840,7 @@
<param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0">
<description>
VR Help Items.
- If omitted on supported displays, the default AppLink VR help / What Can I Say? screen shall be used.
+ If omitted on supported displays, the default SmartDeviceLink VR help / What Can I Say? screen shall be used.
If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC shall be rejected.
If omitted and a vrHelpTitle is provided, the request will be rejected.
</description>
@@ -4435,6 +4856,10 @@
<param name="keyboardProperties" type="KeyboardProperties" mandatory="false" since="3.0">
<description>On-screen keyboard configuration (if available).</description>
</param>
+
+ <param name="menuLayout" type="MenuLayout" mandatory="false" since="6.0">
+ <description>Sets the layout of the main menu screen. If this is sent while a menu is already on-screen, the head unit will change the display to the new layout type.</description>
+ </param>
</function>
<function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="response" since="1.0">
@@ -4610,6 +5035,10 @@
<param name="menuIcon" type="Image" mandatory="false" since="5.0">
<description>The image field for AddSubMenu</description>
</param>
+
+ <param name="menuLayout" type="MenuLayout" mandatory="false" since="6.0">
+ <description>Sets the layout of the submenu screen.</description>
+ </param>
</function>
<function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response" since="1.0">
@@ -4669,6 +5098,43 @@
</function>
+ <function name="ShowAppMenu" functionID="ShowAppMenuID" messagetype="request" since="6.0">
+ <description>Shows the built in menu view</description>
+
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="false">
+ <description>
+ If omitted the HMI opens the app's menu.
+ If set to a sub-menu ID the HMI opens the corresponding sub-menu previously added using `AddSubMenu`.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="ShowAppMenu" functionID="ShowAppMenuID" messagetype="response" since="6.0">
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
<function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request" since="1.0">
<description>creates interaction choice set to be used later by performInteraction</description>
@@ -4763,6 +5229,12 @@
<description>See LayoutMode.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ An ID for this specific PerformInteraction to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
+
</function>
<function name="PerformInteraction" functionID="PerformInteractionID" messagetype="response" since="1.0">
@@ -4896,6 +5368,19 @@
</description>
</param>
+ <param name="alertIcon" type="Image" mandatory="false" since="6.0">
+ <description>
+ Image struct determining whether static or dynamic icon.
+ If omitted on supported displays, no (or the default if applicable) icon should be displayed.
+ </description>
+ </param>
+
+ <param name="cancelID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
+
</function>
<function name="Alert" functionID="AlertID" messagetype="response" since="1.0">
@@ -5024,9 +5509,31 @@
</param>
<param name="metadataTags" type="MetadataTags" mandatory="false" since="4.5">
- <description>App defined metadata information. See MetadataStruct. Uses mainField1, mainField2, mainField3, mainField4.
+ <description>
+ App defined metadata information. See MetadataStruct. Uses mainField1, mainField2, mainField3, mainField4.
If omitted on supported displays, the currently set metadata tags will not change.
- If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.</description>
+ If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.
+ </description>
+ </param>
+
+ <param name="templateTitle" type="String" minlength="0" maxlength="100" mandatory="false" since="6.0">
+ <description>
+ The title of the new template that will be displayed.
+ How this will be displayed is dependent on the OEM design and implementation of the template.
+ </description>
+ </param>
+ <param name="windowID" type="Integer" mandatory="false" since="6.0" >
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included,
+ it will be assumed that this request is specifically for the main window on the main display.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+
+ <param name="templateConfiguration" type="TemplateConfiguration" mandatory="false" since="6.0">
+ <description>
+ Used to set an alternate template layout to a window.
+ </description>
</param>
</function>
@@ -5385,8 +5892,6 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5403,7 +5908,6 @@
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
</function>
@@ -5503,8 +6007,6 @@
<param name="cloudAppVehicleID" type="VehicleDataResult" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5520,8 +6022,6 @@
<param name="myKey" type="VehicleDataResult" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
-
</function>
<function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="request" since="2.0">
@@ -5599,8 +6099,6 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5616,8 +6114,6 @@
<param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
-
</function>
<function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="response" since="2.0">
@@ -5715,8 +6211,6 @@
<param name="cloudAppVehicleID" type="VehicleDataResult" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5732,8 +6226,6 @@
<param name="myKey" type="VehicleDataResult" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
-
</function>
<function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="request" since="2.0">
@@ -5814,8 +6306,6 @@
<param name="cloudAppVehicleID" type="Boolean" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5831,8 +6321,6 @@
<param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
-
</function>
<function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="response" since="2.0">
@@ -5934,8 +6422,6 @@
<param name="cloudAppVehicleID" type="String" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -5951,8 +6437,6 @@
<param name="myKey" type="MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Data Items -->
-
</function>
<function name="ReadDID" functionID="ReadDIDID" messagetype="request" since="2.0">
@@ -6033,7 +6517,7 @@
<description>Provides additional human readable info regarding the result.</description>
</param>
- <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="false">
<description>2 byte ECU Header for DTC response (as defined in VHR_Layout_Specification_DTCs.pdf)</description>
</param>
@@ -6088,7 +6572,7 @@
<description>Provides additional human readable info regarding the result.</description>
</param>
- <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
+ <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="false">
<description>
Array of bytes comprising CAN message result.
</description>
@@ -6110,6 +6594,11 @@
If omitted on supported displays, only the system defined "Close" SoftButton will be displayed.
</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ An ID for this specific ScrollableMessage to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="response" since="2.0">
@@ -6164,6 +6653,11 @@
If omitted, the value is set to 10000.
</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ An ID for this specific Slider to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="Slider" functionID="SliderID" messagetype="response" since="2.0">
@@ -6668,12 +7162,11 @@
</function>
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request" since="3.0">
- <description>
- Used to set an alternate display layout.
- If not sent, default screen for given platform will be shown
- </description>
-
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request" deprecated="true" since="6.0">
+ <history>
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request" since="3.0" until="6.0"/>
+ </history>
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
<param name="displayLayout" type="String" maxlength="500" mandatory="true">
<description>
Predefined or dynamically created screen layout.
@@ -6686,8 +7179,11 @@
<param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" since="5.0"/>
</function>
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response" since="3.0">
-
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response" deprecated="true" since="6.0">
+ <history>
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response" since="3.0" until="6.0"/>
+ </history>
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
<param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
@@ -6772,6 +7268,10 @@
<element name="TIMED_OUT"/>
<element name="IGNORED"/>
</param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
</function>
<function name="SendLocation" functionID="SendLocationID" messagetype="request" since="3.0">
@@ -6879,6 +7379,9 @@
<param name="moduleType" type="ModuleType" mandatory="true">
<description>The module where the button should be pressed</description>
</param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false" since="6.0">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
<param name="buttonName" type="ButtonName" mandatory="true">
<description>The name of supported RC climate or radio button.</description>
</param>
@@ -6915,11 +7418,14 @@
In the future, this should be the Identification of a module.
</description>
</param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false" since="6.0">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
<param name="subscribe" type="Boolean" mandatory="false" since="4.5.1">
<description>
- If subscribe is true, the head unit will register OnInteriorVehicleData notifications for the requested moduleType.
- If subscribe is false, the head unit will unregister OnInteriorVehicleData notifications for the requested moduleType.
- If subscribe is not included, the subscription status of the app for the requested moduleType will remain unchanged.
+ If subscribe is true, the head unit will register OnInteriorVehicleData notifications for the requested module (moduleId and moduleType).
+ If subscribe is false, the head unit will unregister OnInteriorVehicleData notifications for the requested module (moduleId and moduleType).
+ If subscribe is not included, the subscription status of the app for the requested module (moduleId and moduleType) will remain unchanged.
</description>
<history>
<param name="subscribe" type="Boolean" mandatory="false" defvalue="false" since="4.5" until="4.5.1"/>
@@ -6928,7 +7434,7 @@
</function>
<function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="response" since="4.5">
- <param name="moduleData" type="ModuleData" mandatory="true">
+ <param name="moduleData" type="ModuleData" mandatory="false">
</param>
<param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
@@ -6958,6 +7464,73 @@
</param>
</function>
+ <function name="GetInteriorVehicleDataConsent" functionID="GetInteriorVehicleDataConsentID" messagetype="request" since="6.0">
+ <param name="moduleType" type="ModuleType" mandatory="true">
+ <description>The module type that the app requests to control.</description>
+ </param>
+ <param name="moduleIds" type="String" maxlength="100" array="true" mandatory="true">
+ <description>Ids of a module of same type, published by System Capability. </description>
+ </param>
+ </function>
+
+ <function name="GetInteriorVehicleDataConsent" functionID="GetInteriorVehicleDataConsentID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ <param name="allowed" type="Boolean" array="true" mandatory="false">
+ <description>
+ This array has the same size as "moduleIds" in the request and each element corresponds to one moduleId
+ If true, SDL grants the permission for the requested module
+ If false, SDL denies the permission for the requested module.
+ </description>
+ </param>
+ </function>
+
+ <function name="ReleaseInteriorVehicleDataModule" functionID="ReleaseInteriorVehicleDataModuleID" messagetype="request" since="6.0">
+ <param name="moduleType" type="ModuleType" mandatory="true">
+ </param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false" since="5.1">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
+ </function>
+
+ <function name="ReleaseInteriorVehicleDataModule" functionID="ReleaseInteriorVehicleDataModuleID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false">
+ </param>
+ </function>
+
<function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request" since="4.5">
<param name="moduleData" type="ModuleData" mandatory="true">
<description>The module data to set for the requested RC module.</description>
@@ -6966,7 +7539,7 @@
<function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="response" since="4.5">
<description>Used to set the values of one remote control module </description>
- <param name="moduleData" type="ModuleData" mandatory="true">
+ <param name="moduleData" type="ModuleData" mandatory="false">
</param>
<param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
@@ -7082,7 +7655,7 @@
</function>
<function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="response" since="4.5">
- <param name="systemCapability" type="SystemCapability" mandatory="true">
+ <param name="systemCapability" type="SystemCapability" mandatory="false">
</param>
<param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
@@ -7156,6 +7729,10 @@
<element name="DISALLOWED"/>
<element name="WARNINGS"/>
</param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
</function>
<function name="GetCloudAppProperties" functionID="GetCloudAppPropertiesID" messagetype="request" since="5.1">
@@ -7183,13 +7760,23 @@
<element name="DISALLOWED"/>
<element name="WARNINGS"/>
</param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
</function>
<function name="PublishAppService" functionID="PublishAppServiceID" messagetype="request" since="5.1">
- <description>Registers a service offered by this app on the module</description>
+ <description>
+ Registers a service offered by this app on the module.
+ Subsequent calls with the same service type will update the manifest for that service.
+ </description>
<param name="appServiceManifest" type="AppServiceManifest" mandatory="true">
- <description> The manifest of the service that wishes to be published.</description>
+ <description>
+ The manifest of the service that wishes to be published.
+ If already published, the updated manifest for this service.
+ </description>
</param>
</function>
@@ -7221,6 +7808,38 @@
</param>
</function>
+ <function name="UnpublishAppService" functionID="UnpublishAppServiceID" messagetype="request" since="6.0">
+ <description> Unpublish an existing service published by this application. </description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> The ID of the service to be unpublished. </description>
+ </param>
+ </function>
+
+ <function name="UnpublishAppService" functionID="UnpublishAppServiceID" messagetype="response" since="6.0">
+ <description> The response to UnpublishAppService </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
<function name="GetAppServiceData" functionID="GetAppServiceDataID" messagetype="request" since="5.1">
<description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
@@ -7296,6 +7915,77 @@
</param>
</function>
+ <function name="CancelInteraction" functionID="CancelInteractionID" messagetype="request" since="6.0">
+ <description>
+ Close an active interaction on the HMI.
+ </description>
+
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ The ID of the specific interaction you want to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ </description>
+ </param>
+
+ <param name="functionID" type="Integer" mandatory="true">
+ <description>
+ The ID of the type of interaction the developer wants to dismiss. Only values 10, (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ </description>
+ </param>
+ </function>
+
+ <function name="CancelInteraction" functionID="CancelInteractionID" messagetype="response" since="6.0">
+ <description>
+ If no applicable request can be dismissed, the result will be IGNORED.
+ </description>
+
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="IGNORED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ <element name="ABORTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="CloseApplication" functionID="CloseApplicationID" messagetype="request" since="6.0">
+ <description>Request from the application to exit the foreground and enter HMI_NONE.</description>
+ </function>
+
+ <function name="CloseApplication" functionID="CloseApplicationID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="DISALLOWED"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="IGNORED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
<!-- Notifications -->
<function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification" since="1.0">
@@ -7317,6 +8007,11 @@
If it is NOT_STREAMABLE, the app must stop streaming video to SDL Core(stop service).
</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification" since="1.0">
@@ -7424,8 +8119,6 @@
<param name="cloudAppVehicleID" type="String" mandatory="false" since="5.1">
<description>Parameter used by cloud apps to identify a head unit</description>
</param>
-
- <!-- Ford Specific Vehicle Data -->
<param name="eCallInfo" type="ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -7441,7 +8134,7 @@
<param name="myKey" type="MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <!-- / Ford Specific Vehicle Data -->
+
</function>
@@ -7467,6 +8160,21 @@
<param name="state" type="DriverDistractionState" mandatory="true">
<description>Current State of Driver Distraction</description>
</param>
+ <param name="lockScreenDismissalEnabled" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ If enabled, the lock screen will be able to be dismissed while connected to SDL, allowing users
+ the ability to interact with the app. Dismissals should include a warning to the user and ensure
+ that they are not the driver.
+ </description>
+ </param>
+ <param name="lockScreenDismissalWarning" type="String" mandatory="false" since="6.0">
+ <description>
+ Warning message to be displayed on the lock screen when dismissal is enabled.
+ This warning should be used to ensure that the user is not the driver of the vehicle,
+ ex. `Swipe down to dismiss, acknowledging that you are not the driver.`.
+ This parameter must be present if "lockScreenDismissalEnabled" is set to true.
+ </description>
+ </param>
</function>
<function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" since="2.0">
@@ -7474,6 +8182,7 @@
<param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true" mandatory="true">
<description>Change in permissions for a given set of RPCs</description>
</param>
+ <param name="requireEncryption" type="Boolean" mandatory="false" since="6.0"/>
</function>
<function name="OnAudioPassThru" functionID="OnAudioPassThruID" messagetype="notification" since="2.0">
@@ -7717,4 +8426,4 @@
</function>
-->
-</interface>
+</interface> \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index 1c465c382..5c6656bf9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -4,6 +4,7 @@ import android.content.Context;
import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.exception.SdlException;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
@@ -104,6 +105,11 @@ public class SdlManagerTests extends AndroidTestCase2 {
public void onError(String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ return null;
+ }
};
// build manager object - use all setters, will test using getters below
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
index b4e27f205..b1a0ba26e 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java
@@ -20,8 +20,6 @@ import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.test.Test;
-import junit.framework.Assert;
-
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -39,7 +37,6 @@ import static org.mockito.Mockito.mock;
*/
public class FileManagerTests extends AndroidTestCase2 {
public static final String TAG = "FileManagerTests";
- private FileManager fileManager;
private Context mTestContext;
private SdlFile validFile;
@@ -101,6 +98,7 @@ public class FileManagerTests extends AndroidTestCase2 {
int correlationId = message.getCorrelationID();
PutFileResponse putFileResponse = new PutFileResponse();
putFileResponse.setSuccess(true);
+ putFileResponse.setSpaceAvailable(Test.GENERAL_INT);
message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
}
return null;
@@ -153,8 +151,9 @@ public class FileManagerTests extends AndroidTestCase2 {
@Override
public void onComplete(boolean success) {
assertTrue(success);
- Assert.assertEquals(fileManager.getState(), BaseSubManager.READY);
+ assertEquals(fileManager.getState(), BaseSubManager.READY);
assertEquals(fileManager.getRemoteFileNames(), Test.GENERAL_STRING_LIST);
+ assertEquals(Test.GENERAL_INT, fileManager.getBytesAvailable());
}
});
}
@@ -170,6 +169,7 @@ public class FileManagerTests extends AndroidTestCase2 {
public void onComplete(boolean success) {
assertFalse(success);
assertEquals(fileManager.getState(), BaseSubManager.ERROR);
+ assertEquals(BaseFileManager.SPACE_AVAILABLE_MAX_VALUE, fileManager.getBytesAvailable());
}
});
}
@@ -191,6 +191,7 @@ public class FileManagerTests extends AndroidTestCase2 {
assertTrue(success);
assertTrue(fileManager.getRemoteFileNames().contains(validFile.getName()));
assertTrue(fileManager.hasUploadedFile(validFile));
+ assertEquals(Test.GENERAL_INT, fileManager.getBytesAvailable());
}
});
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/SdlArtworkTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/SdlArtworkTests.java
new file mode 100644
index 000000000..395b06e27
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/SdlArtworkTests.java
@@ -0,0 +1,50 @@
+package com.smartdevicelink.managers.file;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
+import com.smartdevicelink.test.Test;
+
+public class SdlArtworkTests extends AndroidTestCase2 {
+
+ public void testClone(){
+ SdlArtwork original = Test.GENERAL_ARTWORK;
+ SdlArtwork clone = original.clone();
+
+ equalTest(original, clone);
+
+
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ assertNotNull(artwork);
+
+ SdlArtwork staticIconClone = artwork.clone();
+ assertNotNull(staticIconClone);
+
+
+ assertTrue(clone instanceof Cloneable);
+ assertTrue(artwork instanceof Cloneable);
+
+ }
+
+ public static boolean equalTest(SdlArtwork original, SdlArtwork clone){
+
+ assertNotNull(original);
+ assertNotNull(clone);
+ assertNotSame(original,clone);
+
+
+ assertEquals(original.getResourceId(), clone.getResourceId());
+
+ assertEquals(original.getFileData(), clone.getFileData());
+
+ assertNotNull(original.getImageRPC());
+ assertNotNull(clone.getImageRPC());
+
+ assertNotSame(original.getImageRPC(),clone.getImageRPC());
+ assertEquals(original.getImageRPC().getIsTemplate(), clone.getImageRPC().getIsTemplate());
+ assertEquals(original.getImageRPC().getValue(), clone.getImageRPC().getValue());
+ assertEquals(original.getImageRPC().getImageType(), clone.getImageRPC().getImageType());
+
+ return true;
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
new file mode 100644
index 000000000..6ed606648
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdateTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 8/2/19 11:27 AM
+ *
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.test.Test;
+
+public class LifecycleConfigurationUpdateTest extends AndroidTestCase2 {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testIndividualSettersAndGetters(){
+
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate();
+
+ lifecycleConfigurationUpdate.setAppName(Test.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setShortAppName(Test.GENERAL_STRING);
+ lifecycleConfigurationUpdate.setTtsName(Test.GENERAL_VECTOR_TTS_CHUNKS);
+ lifecycleConfigurationUpdate.setVoiceRecognitionCommandNames(Test.GENERAL_VECTOR_STRING);
+
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
+
+ public void testHelperConstructor(){
+
+ LifecycleConfigurationUpdate lifecycleConfigurationUpdate = new LifecycleConfigurationUpdate(Test.GENERAL_STRING, Test.GENERAL_STRING, Test.GENERAL_VECTOR_TTS_CHUNKS, Test.GENERAL_VECTOR_STRING);
+
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getAppName());
+ assertEquals(Test.GENERAL_STRING, lifecycleConfigurationUpdate.getShortAppName());
+ assertEquals(Test.GENERAL_VECTOR_TTS_CHUNKS, lifecycleConfigurationUpdate.getTtsName());
+ assertEquals(Test.GENERAL_VECTOR_STRING, lifecycleConfigurationUpdate.getVoiceRecognitionCommandNames());
+ }
+
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
index c2d4066ce..0bf3dd5ae 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenConfigTests.java
@@ -3,7 +3,6 @@ package com.smartdevicelink.managers.lockscreen;
import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.test.Test;
-
/**
* This is a unit test class for the SmartDeviceLink library manager class :
* {@link com.smartdevicelink.managers.lockscreen.LockScreenConfig}
@@ -25,6 +24,7 @@ public class LockScreenConfigTests extends AndroidTestCase2 {
lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
}
@Override
@@ -38,8 +38,9 @@ public class LockScreenConfigTests extends AndroidTestCase2 {
assertEquals(Test.GENERAL_INT, lockScreenConfig.getCustomView());
assertEquals(Test.GENERAL_INT, lockScreenConfig.getAppIcon());
assertEquals(Test.GENERAL_INT, lockScreenConfig.getBackgroundColor());
- assertEquals(true, lockScreenConfig.isEnabled());
- assertEquals(true, lockScreenConfig.isDeviceLogoEnabled());
+ assertTrue(lockScreenConfig.isEnabled());
+ assertTrue(lockScreenConfig.isDeviceLogoEnabled());
+ assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenConfig.getDisplayMode());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
index 69e0aa898..1d294e100 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lockscreen/LockScreenManagerTests.java
@@ -3,10 +3,21 @@ package com.smartdevicelink.managers.lockscreen;
import android.content.Context;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.OnDriverDistraction;
+import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.test.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
/**
@@ -16,6 +27,7 @@ import static org.mockito.Mockito.mock;
public class LockScreenManagerTests extends AndroidTestCase2 {
private LockScreenManager lockScreenManager;
+ private OnRPCNotificationListener onDDListener;
@Override
public void setUp() throws Exception{
@@ -23,6 +35,16 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
ISdl internalInterface = mock(ISdl.class);
+ Answer<Void> onDDStatusAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ onDDListener = (OnRPCNotificationListener) args[1];
+ return null;
+ }
+ };
+ doAnswer(onDDStatusAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_DRIVER_DISTRACTION), any(OnRPCNotificationListener.class));
+
Context context = getContext();
// create config
LockScreenConfig lockScreenConfig = new LockScreenConfig();
@@ -31,6 +53,7 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
lockScreenConfig.setBackgroundColor(Test.GENERAL_INT);
lockScreenConfig.showDeviceLogo(true);
lockScreenConfig.setEnabled(true);
+ lockScreenConfig.setDisplayMode(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED);
lockScreenManager = new LockScreenManager(lockScreenConfig, context, internalInterface);
}
@@ -44,13 +67,92 @@ public class LockScreenManagerTests extends AndroidTestCase2 {
assertEquals(Test.GENERAL_INT, lockScreenManager.customView);
assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenIcon);
assertEquals(Test.GENERAL_INT, lockScreenManager.lockScreenColor);
- assertEquals(true, lockScreenManager.deviceLogoEnabled);
- assertEquals(true, lockScreenManager.lockScreenEnabled);
+ assertTrue(lockScreenManager.deviceLogoEnabled);
+ assertTrue(lockScreenManager.lockScreenEnabled);
assertNull(lockScreenManager.deviceLogo);
+ assertEquals(LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED, lockScreenManager.displayMode);
+ }
+
+ public void testGetLockScreenStatusHmiNoneDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_NONE;
+ assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
- public void testGetLockScreenStatus(){
+ public void testGetLockScreenStatusHmiBackgroundDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
assertEquals(LockScreenStatus.OFF, lockScreenManager.getLockScreenStatus());
}
-}
+ public void testGetLockScreenStatusHmiNoneDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_BACKGROUND;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiFullDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiFullDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_FULL;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiLimitedDDOff(){
+ lockScreenManager.driverDistStatus = false;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.OPTIONAL, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testGetLockScreenStatusHmiLimitedDDOn(){
+ lockScreenManager.driverDistStatus = true;
+ lockScreenManager.hmiLevel = HMILevel.HMI_LIMITED;
+ assertEquals(LockScreenStatus.REQUIRED, lockScreenManager.getLockScreenStatus());
+ }
+
+ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue(){
+ lockScreenManager.enableDismissGesture = true;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertTrue(lockScreenManager.enableDismissGesture);
+ assertTrue(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse(){
+ lockScreenManager.enableDismissGesture = false;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertFalse(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse(){
+ lockScreenManager.enableDismissGesture = true;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(false);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertTrue(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+ public void testLockScreenDismissibleWithEnableFalseAndDismissibilityTrue(){
+ lockScreenManager.enableDismissGesture = false;
+ OnDriverDistraction onDriverDistraction = new OnDriverDistraction();
+ onDriverDistraction.setLockscreenDismissibility(true);
+ onDriverDistraction.setState(DriverDistractionState.DD_ON);
+ onDDListener.onNotified(onDriverDistraction);
+ assertFalse(lockScreenManager.enableDismissGesture);
+ assertFalse(lockScreenManager.mIsLockscreenDismissible);
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
index c4e22af6f..34cebfc08 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java
@@ -25,7 +25,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
private SdlArtwork testArtwork;
@Override
- public void setUp() throws Exception{
+ public void setUp() throws Exception {
super.setUp();
ISdl internalInterface = mock(ISdl.class);
@@ -45,6 +45,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertNull(screenManager.getTextField2());
assertNull(screenManager.getTextField3());
assertNull(screenManager.getTextField4());
+ assertNull(screenManager.getTitle());
assertNull(screenManager.getMediaTrackTextField());
assertNull(screenManager.getPrimaryGraphic());
assertNull(screenManager.getSecondaryGraphic());
@@ -60,6 +61,7 @@ public class ScreenManagerTests extends AndroidTestCase2 {
assertNull(screenManager.getSoftButtonObjectById(1));
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE);
assertEquals(screenManager.getState(), BaseSubManager.READY);
+ assertNull(screenManager.getMenuConfiguration());
}
public void testSetTextField() {
@@ -67,10 +69,12 @@ public class ScreenManagerTests extends AndroidTestCase2 {
screenManager.setTextField2("Wednesday");
screenManager.setTextField3("My");
screenManager.setTextField4("Dudes");
+ screenManager.setTitle("title");
assertEquals(screenManager.getTextField1(), "It is");
assertEquals(screenManager.getTextField2(), "Wednesday");
assertEquals(screenManager.getTextField3(), "My");
assertEquals(screenManager.getTextField4(), "Dudes");
+ assertEquals(screenManager.getTitle(), "title");
}
public void testMediaTrackTextFields() {
@@ -120,9 +124,12 @@ public class ScreenManagerTests extends AndroidTestCase2 {
public void testSetMenuManagerFields(){
screenManager.setDynamicMenuUpdatesMode(DynamicMenuUpdatesMode.FORCE_ON);
screenManager.setMenu(Test.GENERAL_MENUCELL_LIST);
+ screenManager.setMenuConfiguration(Test.GENERAL_MENU_CONFIGURATION);
assertEquals(screenManager.getMenu(), Test.GENERAL_MENUCELL_LIST);
assertEquals(screenManager.getDynamicMenuUpdatesMode(), DynamicMenuUpdatesMode.FORCE_ON);
+ // Should not set because of improper RAI response and improper HMI states
+ assertNull(screenManager.getMenuConfiguration());
}
public void testSetVoiceCommands(){
@@ -135,17 +142,19 @@ public class ScreenManagerTests extends AndroidTestCase2 {
SoftButtonState softButtonState1 = new SoftButtonState("object1-state1", "it is", testArtwork);
SoftButtonState softButtonState2 = new SoftButtonState("object1-state2", "Wed", testArtwork);
SoftButtonObject softButtonObject1 = new SoftButtonObject("object1", Arrays.asList(softButtonState1, softButtonState2), softButtonState1.getName(),null);
+ softButtonObject1.setButtonId(100);
// Create softButtonObject2
SoftButtonState softButtonState3 = new SoftButtonState("object2-state1", "my", testArtwork);
SoftButtonState softButtonState4 = new SoftButtonState("object2-state2", "dudes!", null);
SoftButtonObject softButtonObject2 = new SoftButtonObject("object2", Arrays.asList(softButtonState3, softButtonState4), softButtonState3.getName(), null);
+ softButtonObject2.setButtonId(200);
List<SoftButtonObject> softButtonObjects = Arrays.asList(softButtonObject1, softButtonObject2);
screenManager.setSoftButtonObjects(Arrays.asList(softButtonObject1, softButtonObject2));
assertEquals(screenManager.getSoftButtonObjects(), softButtonObjects);
assertEquals(screenManager.getSoftButtonObjectByName("object2"), softButtonObject2);
- assertEquals(screenManager.getSoftButtonObjectById(100), softButtonObject2);
+ assertEquals(screenManager.getSoftButtonObjectById(200), softButtonObject2);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
index 144057c36..514549080 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SoftButtonManagerTests.java
@@ -12,6 +12,8 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
@@ -24,6 +26,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import static org.mockito.ArgumentMatchers.any;
@@ -39,8 +42,9 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
private SoftButtonManager softButtonManager;
private boolean fileManagerUploadArtworksGotCalled;
- private boolean internalInterfaceSendRPCRequestGotCalled;
+ private boolean internalInterfaceSendRPCGotCalled;
private boolean softButtonMangerUpdateCompleted;
+ private int softButtonObject1Id = 1000, softButtonObject2Id = 2000;
private SoftButtonObject softButtonObject1, softButtonObject2;
private SoftButtonState softButtonState1, softButtonState2, softButtonState3, softButtonState4;
@@ -86,13 +90,13 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
softButtonManager = new SoftButtonManager(internalInterface, fileManager);
- // When internalInterface.sendRPCRequest() is called inside SoftButtonManager:
+ // When internalInterface.sendRPC() is called inside SoftButtonManager:
// 1) respond with a fake onResponse() callback to let the SoftButtonManager continue working
// 2) assert that the Show RPC values (ie: MainField1 & SoftButtons) that are created by the SoftButtonManager, match the ones that are provided by the developer
Answer<Void> onSendShowRPCAnswer = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
- internalInterfaceSendRPCRequestGotCalled = true;
+ internalInterfaceSendRPCGotCalled = true;
Object[] args = invocation.getArguments();
Show show = (Show) args[0];
@@ -104,16 +108,18 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
return null;
}
};
- doAnswer(onSendShowRPCAnswer).when(internalInterface).sendRPCRequest(any(Show.class));
+ doAnswer(onSendShowRPCAnswer).when(internalInterface).sendRPC(any(Show.class));
// Create soft button objects
softButtonState1 = new SoftButtonState("object1-state1", "o1s1", new SdlArtwork("image1", FileType.GRAPHIC_PNG, 1, true));
softButtonState2 = new SoftButtonState("object1-state2", "o1s2", new SdlArtwork(StaticIconName.ALBUM));
softButtonObject1 = new SoftButtonObject("object1", Arrays.asList(softButtonState1, softButtonState2), softButtonState1.getName(), null);
+ softButtonObject1.setButtonId(softButtonObject1Id);
softButtonState3 = new SoftButtonState("object2-state1", "o2s1", null);
softButtonState4 = new SoftButtonState("object2-state2", "o2s2", new SdlArtwork("image3", FileType.GRAPHIC_PNG, 3, true));
softButtonObject2 = new SoftButtonObject("object2", Arrays.asList(softButtonState3, softButtonState4), softButtonState3.getName(), null);
+ softButtonObject2.setButtonId(softButtonObject2Id);
}
@Override
@@ -124,9 +130,15 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
public void testSoftButtonManagerUpdate() {
// Reset the boolean variables
fileManagerUploadArtworksGotCalled = false;
- internalInterfaceSendRPCRequestGotCalled = false;
+ internalInterfaceSendRPCGotCalled = false;
softButtonMangerUpdateCompleted = false;
+ SoftButtonCapabilities softCap = new SoftButtonCapabilities();
+ softCap.setImageSupported(true);
+ WindowCapability defaultCap = new WindowCapability();
+ defaultCap.setSoftButtonCapabilities(Collections.singletonList(softCap));
+ softButtonManager.defaultMainWindowCapability = defaultCap;
+
// Test batch update
softButtonManager.setBatchUpdates(true);
@@ -147,8 +159,9 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Check that everything got called as expected
- assertTrue("FileManager.uploadArtworks() did not get called", fileManagerUploadArtworksGotCalled);
- assertTrue("InternalInterface.sendRPCRequest() did not get called", internalInterfaceSendRPCRequestGotCalled);
+
+ assertTrue("FileManager.uploadArtworks() did get called", fileManagerUploadArtworksGotCalled);
+ assertTrue("InternalInterface.sendRPC() did not get called", internalInterfaceSendRPCGotCalled);
assertTrue("SoftButtonManger update onComplete() did not get called", softButtonMangerUpdateCompleted);
@@ -169,11 +182,11 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Test get by valid id
- assertEquals("Returned SoftButtonObject doesn't match the expected value", softButtonObject2, softButtonManager.getSoftButtonObjectById(100));
+ assertEquals("Returned SoftButtonObject doesn't match the expected value", softButtonObject2, softButtonManager.getSoftButtonObjectById(softButtonObject2Id));
// Test get by invalid id
- assertNull("Returned SoftButtonObject doesn't match the expected value", softButtonManager.getSoftButtonObjectById(500));
+ assertNull("Returned SoftButtonObject doesn't match the expected value", softButtonManager.getSoftButtonObjectById(5555));
}
public void testSoftButtonState(){
@@ -190,9 +203,10 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Test SoftButtonState.getSoftButton()
- SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_BOTH, 0);
+ SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_BOTH, SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE);
softButtonExpectedValue.setText("o1s1");
softButtonExpectedValue.setImage(new Image(artworkExpectedValue.getName(), ImageType.DYNAMIC));
+ SoftButton actual = softButtonState1.getSoftButton();
assertTrue("Returned SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, softButtonState1.getSoftButton()));
}
@@ -210,11 +224,11 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
// Test SoftButtonObject.getButtonId()
- assertEquals("Returned button Id doesn't match the expected value", 0, softButtonObject1.getButtonId());
+ assertEquals("Returned button Id doesn't match the expected value", softButtonObject1Id, softButtonObject1.getButtonId());
// Test SoftButtonObject.getCurrentStateSoftButton()
- SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_TEXT, 0);
+ SoftButton softButtonExpectedValue = new SoftButton(SoftButtonType.SBT_TEXT, softButtonObject2Id);
softButtonExpectedValue.setText("o2s1");
assertTrue("Returned current state SoftButton doesn't match the expected value", Validator.validateSoftButton(softButtonExpectedValue, softButtonObject2.getCurrentStateSoftButton()));
@@ -239,4 +253,56 @@ public class SoftButtonManagerTests extends AndroidTestCase2 {
assertTrue(success);
assertEquals(softButtonState1, softButtonObject1.getCurrentState());
}
+
+ public void testAssigningIdsToSoftButtonObjects() {
+ SoftButtonObject sbo1, sbo2, sbo3, sbo4, sbo5;
+
+ // Case 1 - don't set id for any button (Manager should set ids automatically starting from 1 and up)
+ sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ softButtonManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5));
+ assertEquals("SoftButtonObject id doesn't match the expected value", 1, sbo1.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 2, sbo2.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 3, sbo3.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 4, sbo4.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 5, sbo5.getButtonId());
+
+
+ // Case 2 - Set ids for all buttons (Manager shouldn't alter the ids set by developer)
+ sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo1.setButtonId(100);
+ sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo2.setButtonId(200);
+ sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo3.setButtonId(300);
+ sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo4.setButtonId(400);
+ sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo5.setButtonId(500);
+ softButtonManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5));
+ assertEquals("SoftButtonObject id doesn't match the expected value", 100, sbo1.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 200, sbo2.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 300, sbo3.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 400, sbo4.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 500, sbo5.getButtonId());
+
+
+ // Case 3 - Set ids for some buttons (Manager shouldn't alter the ids set by developer. And it should assign ids for the ones that don't have id)
+ sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo1.setButtonId(50);
+ sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ sbo4.setButtonId(100);
+ sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
+ softButtonManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5));
+ assertEquals("SoftButtonObject id doesn't match the expected value", 50, sbo1.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 101, sbo2.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 102, sbo3.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 100, sbo4.getButtonId());
+ assertEquals("SoftButtonObject id doesn't match the expected value", 103, sbo5.getButtonId());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
index d063f52e3..3597c33f5 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java
@@ -8,10 +8,10 @@ import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
@@ -58,7 +58,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
super.tearDown();
}
- private DisplayCapabilities getDisplayCapability(int numberOfMainFields){
+ private WindowCapability getWindowCapability(int numberOfMainFields){
TextField mainField1 = new TextField();
mainField1.setName(TextFieldName.mainField1);
@@ -84,10 +84,10 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
}
}
- DisplayCapabilities displayCapabilities = new DisplayCapabilities();
- displayCapabilities.setTextFields(returnList);
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setTextFields(returnList);
- return displayCapabilities;
+ return windowCapability;
}
public void testInstantiation(){
@@ -96,6 +96,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertNull(textAndGraphicManager.getTextField2());
assertNull(textAndGraphicManager.getTextField3());
assertNull(textAndGraphicManager.getTextField4());
+ assertNull(textAndGraphicManager.getTitle());
assertNull(textAndGraphicManager.getMediaTrackTextField());
assertNull(textAndGraphicManager.getPrimaryGraphic());
assertNull(textAndGraphicManager.getSecondaryGraphic());
@@ -109,7 +110,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertNull(textAndGraphicManager.inProgressUpdate);
assertNull(textAndGraphicManager.queuedImageUpdate);
assertFalse(textAndGraphicManager.hasQueuedUpdate);
- assertNull(textAndGraphicManager.displayCapabilities);
+ assertNull(textAndGraphicManager.defaultMainWindowCapability);
assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_NONE);
assertFalse(textAndGraphicManager.isDirty);
assertEquals(textAndGraphicManager.getState(), BaseSubManager.SETTING_UP);
@@ -125,7 +126,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
// The tests.java class has an example of this, but we must build it to do what
// we need it to do. Build display cap w/ 3 main fields and test that it returns 3
- textAndGraphicManager.displayCapabilities = getDisplayCapability(3);
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(3);
assertEquals(textAndGraphicManager.getNumberOfLines(), 3);
}
@@ -134,7 +135,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
Show inputShow = new Show();
// Force it to return display with support for only 1 line of text
- textAndGraphicManager.displayCapabilities = getDisplayCapability(1);
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(1);
textAndGraphicManager.setTextField1("It is");
textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
@@ -184,7 +185,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
Show inputShow = new Show();
// Force it to return display with support for only 2 lines of text
- textAndGraphicManager.displayCapabilities = getDisplayCapability(2);
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(2);
textAndGraphicManager.setTextField1("It is");
textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
@@ -281,7 +282,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
Show inputShow = new Show();
// Force it to return display with support for only 3 lines of text
- textAndGraphicManager.displayCapabilities = getDisplayCapability(3);
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(3);
textAndGraphicManager.setTextField1("It is");
textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
@@ -374,7 +375,7 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
Show inputShow = new Show();
// Force it to return display with support for only 4 lines of text
- textAndGraphicManager.displayCapabilities = getDisplayCapability(4);
+ textAndGraphicManager.defaultMainWindowCapability = getWindowCapability(4);
textAndGraphicManager.setTextField1("It is");
textAndGraphicManager.setTextField1Type(MetadataType.HUMIDITY);
@@ -484,6 +485,13 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertEquals(textAndGraphicManager.getMediaTrackTextField(), songTitle);
}
+ public void testTemplateTitle() {
+
+ String title = "template title";
+ textAndGraphicManager.setTitle(title);
+ assertEquals(textAndGraphicManager.getTitle(), title);
+ }
+
public void testAlignment() {
textAndGraphicManager.setTextAlignment(TextAlignment.LEFT_ALIGNED);
@@ -534,12 +542,13 @@ public class TextAndGraphicManagerTests extends AndroidTestCase2 {
assertNull(textAndGraphicManager.getTextField2Type());
assertNull(textAndGraphicManager.getTextField3Type());
assertNull(textAndGraphicManager.getTextField4Type());
+ assertNull(textAndGraphicManager.getTitle());
assertNotNull(textAndGraphicManager.getBlankArtwork());
assertNull(textAndGraphicManager.currentScreenData);
assertNull(textAndGraphicManager.inProgressUpdate);
assertNull(textAndGraphicManager.queuedImageUpdate);
assertFalse(textAndGraphicManager.hasQueuedUpdate);
- assertNull(textAndGraphicManager.displayCapabilities);
+ assertNull(textAndGraphicManager.defaultMainWindowCapability);
assertFalse(textAndGraphicManager.isDirty);
assertEquals(textAndGraphicManager.getState(), BaseSubManager.SHUTDOWN);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
index a47528348..7b9696151 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperationTests.java
@@ -36,8 +36,6 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.managers.screen.choiceset.CheckChoiceVROptionalInterface;
-import com.smartdevicelink.managers.screen.choiceset.CheckChoiceVROptionalOperation;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
index e52f7b273..1a9efffbe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManagerTests.java
@@ -52,8 +52,14 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class ChoiceSetManagerTests extends AndroidTestCase2 {
@@ -79,7 +85,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNotNull(csm.operationQueue);
assertNotNull(csm.executor);
assertNotNull(csm.hmiListener);
- assertNotNull(csm.displayListener);
+ assertNotNull(csm.onDisplayCapabilityListener);
assertNull(csm.pendingPresentOperation);
}
@@ -90,7 +96,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertNull(csm.currentHMILevel);
assertNull(csm.currentSystemContext);
- assertNull(csm.displayCapabilities);
+ assertNull(csm.defaultMainWindowCapability);
assertNull(csm.pendingPresentationSet);
assertNull(csm.pendingPresentOperation);
@@ -98,7 +104,7 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
assertEquals(csm.nextChoiceId, 1);
assertTrue(csm.executor.isShutdown());
- assertTrue(csm.isVROptional);
+ assertFalse(csm.isVROptional);
assertEquals(csm.getState(), BaseSubManager.SHUTDOWN);
@@ -232,7 +238,61 @@ public class ChoiceSetManagerTests extends AndroidTestCase2 {
for (ChoiceCell cell : returnedChoices){
assertEquals(cell.getText(), "test2");
}
+ }
+
+ public void testPresentingKeyboardShouldReturnCancelIDIfKeyboardCanBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.READY);
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNotNull(cancelId);
}
+ public void testPresentingKeyboardShouldNotReturnCancelIDIfKeyboardCannotBeSent() {
+ ISdl internalInterface = mock(ISdl.class);
+ FileManager fileManager = mock(FileManager.class);
+
+ ChoiceSetManager newCSM = new ChoiceSetManager(internalInterface, fileManager);
+ ChoiceSetManager partialMockCSM = spy(newCSM);
+ when(partialMockCSM.getState()).thenReturn(BaseSubManager.ERROR);
+
+ Integer cancelId = partialMockCSM.presentKeyboard("initial text", mock(KeyboardProperties.class), mock(KeyboardListener.class));
+ assertNull(cancelId);
+ }
+
+ public void testDismissingExecutingKeyboard(){
+ Integer testCancelID = 42;
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(testCancelID).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(1)).dismissKeyboard();
+ }
+
+ public void testDismissingQueuedKeyboard(){
+ Integer testCancelID = 42;
+
+ // Currently executing operation
+ PresentKeyboardOperation testKeyboardOp = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp).isExecuting();
+ doReturn(96).when(testKeyboardOp).getCancelID();
+ csm.currentlyPresentedKeyboardOperation = testKeyboardOp;
+
+ // Queued operations
+ PresentKeyboardOperation testKeyboardOp2 = mock(PresentKeyboardOperation.class);
+ doReturn(true).when(testKeyboardOp2).isExecuting();
+ doReturn(testCancelID).when(testKeyboardOp2).getCancelID();
+ LinkedBlockingQueue<Runnable> testOperationQueue = new LinkedBlockingQueue<>();
+ testOperationQueue.add(testKeyboardOp2);
+ csm.operationQueue = testOperationQueue;
+
+ // Queued operation should be canceled
+ csm.dismissKeyboard(testCancelID);
+ verify(testKeyboardOp, times(0)).dismissKeyboard();
+ verify(testKeyboardOp2, times(1)).dismissKeyboard();
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
index 3d7a30a79..900336594 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetTests.java
@@ -46,6 +46,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
private ChoiceSetLayout layout;
private List<ChoiceCell> choices;
private Integer defaultTimeout;
+ private Boolean canceledHandlerCalled;
@Override
public void setUp() throws Exception{
@@ -55,6 +56,7 @@ public class ChoiceSetTests extends AndroidTestCase2 {
layout = ChoiceSetLayout.CHOICE_SET_LAYOUT_LIST;
defaultTimeout = 10;
choices = Arrays.asList(new ChoiceCell(Test.GENERAL_STRING), new ChoiceCell(Test.GENERAL_STRING));
+ canceledHandlerCalled = false;
}
@Override
@@ -98,4 +100,18 @@ public class ChoiceSetTests extends AndroidTestCase2 {
assertEquals(choiceSet2.getChoices(), choices);
assertEquals(choiceSet2.getChoiceSetSelectionListener(), listener);
}
+
+ public void testCancelingChoiceSet() {
+ ChoiceSet choiceSet = new ChoiceSet(Test.GENERAL_STRING, choices, listener);
+
+ choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ canceledHandlerCalled = true;
+ }
+ };
+
+ choiceSet.cancel();
+ assertTrue(canceledHandlerCalled);
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
index 3a9eed394..67200d0fe 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperationTests.java
@@ -36,8 +36,6 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
-import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
-import com.smartdevicelink.managers.screen.choiceset.DeleteChoicesOperation;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
index 514d88bca..b29863110 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperationTests.java
@@ -38,15 +38,14 @@ package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
-import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
-import com.smartdevicelink.managers.screen.choiceset.PreloadChoicesOperation;
import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.CharacterSet;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.test.Test;
@@ -75,14 +74,14 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
ImageField imageField = new ImageField(ImageFieldName.choiceImage, Arrays.asList(FileType.GRAPHIC_PNG, FileType.GRAPHIC_JPEG));
TextField textField = new TextField(TextFieldName.menuName, CharacterSet.CID1SET, 2, 2);
- DisplayCapabilities displayCapabilities = new DisplayCapabilities();
- displayCapabilities.setGraphicSupported(true);
- displayCapabilities.setImageFields(Collections.singletonList(imageField));
- displayCapabilities.setTextFields(Collections.singletonList(textField));
+ WindowCapability windowCapability = new WindowCapability();
+ windowCapability.setImageFields(Collections.singletonList(imageField));
+ windowCapability.setImageTypeSupported(Arrays.asList(ImageType.STATIC, ImageType.DYNAMIC));
+ windowCapability.setTextFields(Collections.singletonList(textField));
ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
- preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager, displayCapabilities, true, cellsToPreload, null);
+ preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager, windowCapability, true, cellsToPreload, null);
}
@Override
@@ -91,13 +90,6 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
}
public void testHasTextFieldOfName(){
-
- TextField textField = new TextField();
- textField.setName(TextFieldName.secondaryText);
-
- DisplayCapabilities capabilities = new DisplayCapabilities();
- capabilities.setTextFields(Collections.singletonList(textField));
-
boolean test = preloadChoicesOperation.hasTextFieldOfName(TextFieldName.secondaryText);
assertFalse(test);
@@ -106,13 +98,6 @@ public class PreloadChoicesOperationTests extends AndroidTestCase2 {
}
public void testHasImageFieldOfName(){
-
- ImageField imageField = new ImageField();
- imageField.setName(ImageFieldName.choiceImage);
-
- DisplayCapabilities capabilities = new DisplayCapabilities();
- capabilities.setImageFields(Collections.singletonList(imageField));
-
boolean test = preloadChoicesOperation.hasImageFieldOfName(ImageFieldName.choiceImage);
assertTrue(test);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
index ea5204eae..d8cf5be9d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperationTests.java
@@ -36,34 +36,60 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
import java.util.Collections;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
private PresentChoiceSetOperation presentChoiceSetOperation;
+ private ChoiceSet choiceSet;
+ private ISdl internalInterface;
+ private KeyboardListener keyboardListener;
+ private ChoiceSetSelectionListener choiceSetSelectionListener;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- ChoiceSetSelectionListener choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+ internalInterface = mock(ISdl.class);
+
+ keyboardListener = mock(KeyboardListener.class);
+ choiceSetSelectionListener = mock(ChoiceSetSelectionListener.class);
+
ChoiceCell cell1 = new ChoiceCell("Cell1");
cell1.setChoiceId(0);
- ChoiceSet choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
- presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener);
+ choiceSet = new ChoiceSet("Test", Collections.singletonList(cell1), choiceSetSelectionListener);
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -71,35 +97,209 @@ public class PresentChoiceSetOperationTests extends AndroidTestCase2 {
super.tearDown();
}
- public void testGetLayoutMode(){
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
+ public void testGetLayoutMode(){
// First we will check knowing our keyboard listener is NOT NULL
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
presentChoiceSetOperation.keyboardListener = null;
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_ONLY);
}
public void testGetPerformInteraction(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentChoiceSetOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getTimeout(), Integer.valueOf(10000));
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
assertEquals(presentChoiceSetOperation.getLayoutMode(), LayoutMode.LIST_WITH_SEARCH);
}
public void testSetSelectedCellWithId(){
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, getKeyBoardProperties(), keyboardListener, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
assertNull(presentChoiceSetOperation.selectedCellRow);
presentChoiceSetOperation.setSelectedCellWithId(0);
assertEquals(presentChoiceSetOperation.selectedCellRow, Integer.valueOf(0));
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingChoiceSetSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
}
-}
+ public void testCancelingChoiceSetUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ presentChoiceSetOperation.finishOperation();
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+ }
+
+ public void testCancelingChoiceSetIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentChoiceSetOperation = new PresentChoiceSetOperation(internalInterface, choiceSet, InteractionMode.MANUAL_ONLY, null, null, choiceSetSelectionListener, Test.GENERAL_INTEGER);
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertFalse(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ choiceSet.cancel();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentChoiceSetOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentChoiceSetOperation.isExecuting());
+ assertTrue(presentChoiceSetOperation.isFinished());
+ assertFalse(presentChoiceSetOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
index ccf498293..486a1c361 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperationTests.java
@@ -36,27 +36,66 @@
package com.smartdevicelink.managers.screen.choiceset;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.test.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class PresentKeyboardOperationTests extends AndroidTestCase2 {
private PresentKeyboardOperation presentKeyboardOperation;
+ private KeyboardListener keyboardListener;
+ private ISdl internalInterface;
+
+ private ExecutorService executor;
@Override
public void setUp() throws Exception{
super.setUp();
- ISdl internalInterface = mock(ISdl.class);
- KeyboardListener keyboardListener = mock(KeyboardListener.class);
- presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener);
+ internalInterface = mock(ISdl.class);
+ keyboardListener = mock(KeyboardListener.class);
+
+ Answer<Void> setGlobalPropertiesAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ SetGlobalProperties setGlobalProperties = (SetGlobalProperties) args[0];
+
+ RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
+ response.setSuccess(true);
+ setGlobalProperties.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(setGlobalPropertiesAnswer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
+
+ executor = Executors.newCachedThreadPool();
}
@Override
@@ -64,20 +103,186 @@ public class PresentKeyboardOperationTests extends AndroidTestCase2 {
super.tearDown();
}
+ private KeyboardProperties getKeyBoardProperties(){
+ KeyboardProperties properties = new KeyboardProperties();
+ properties.setLanguage(Language.EN_US);
+ properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
+ properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
+ return properties;
+ }
+
public void testGetPerformInteraction(){
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, getKeyBoardProperties(), "Test", null, keyboardListener, Test.GENERAL_INTEGER);
+
PerformInteraction pi = presentKeyboardOperation.getPerformInteraction();
assertEquals(pi.getInitialText(), "Test");
assertNull(pi.getHelpPrompt());
assertNull(pi.getTimeoutPrompt());
assertNull(pi.getVrHelp());
assertEquals(pi.getInteractionLayout(), LayoutMode.KEYBOARD);
+ assertEquals(pi.getCancelID(), Test.GENERAL_INTEGER);
}
- private KeyboardProperties getKeyBoardProperties(){
- KeyboardProperties properties = new KeyboardProperties();
- properties.setLanguage(Language.EN_US);
- properties.setKeyboardLayout(KeyboardLayout.QWERTZ);
- properties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
- return properties;
+ public void testCancelingKeyboardSuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(true);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardUnsuccessfullyIfThreadIsRunning(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ presentKeyboardOperation.dismissKeyboard();
+ Answer<Void> cancelInteractionAnswer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ CancelInteraction cancelInteraction = (CancelInteraction) args[0];
+
+ assertEquals(cancelInteraction.getCancelID(), Test.GENERAL_INTEGER);
+ assertEquals(cancelInteraction.getInteractionFunctionID().intValue(), FunctionID.PERFORM_INTERACTION.getId());
+
+ RPCResponse response = new RPCResponse(FunctionID.CANCEL_INTERACTION.toString());
+ response.setSuccess(false);
+ cancelInteraction.getOnRPCResponseListener().onResponse(0, response);
+
+ return null;
+ }
+ };
+ doAnswer(cancelInteractionAnswer).when(internalInterface).sendRPC(any(CancelInteraction.class));
+
+ verify(internalInterface, times(1)).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasFinished(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ presentKeyboardOperation.finishOperation();
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+ }
+
+ public void testCancelingKeyboardIfThreadHasNotYetRun(){
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeature(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertTrue(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, times(1)).sendRPC(any(PerformInteraction.class));
+ }
+
+ public void testCancelingChoiceSetIfHeadUnitDoesNotSupportFeatureButThreadIsNotRunning(){
+ // Cancel Interaction is only supported on RPC specs v.6.0.0+
+ when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(5, 3));
+ presentKeyboardOperation = new PresentKeyboardOperation(internalInterface, null, "Test", null, null, Test.GENERAL_INTEGER);
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertFalse(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ presentKeyboardOperation.dismissKeyboard();
+
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+
+ // Once the operation has started
+ executor.execute(presentKeyboardOperation);
+ try {
+ executor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {}
+
+ assertFalse(presentKeyboardOperation.isExecuting());
+ assertTrue(presentKeyboardOperation.isFinished());
+ assertFalse(presentKeyboardOperation.isCancelled());
+
+ // Make sure neither a `CancelInteraction` or `PerformInteraction` RPC is ever sent
+ verify(internalInterface, never()).sendRPC(any(CancelInteraction.class));
+ verify(internalInterface, never()).sendRPC(any(PerformInteraction.class));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
index 9699a3899..0a629d808 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuCellTests.java
@@ -33,9 +33,14 @@
package com.smartdevicelink.managers.screen.menu;
import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.managers.file.SdlArtworkTests;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.test.Test;
+import java.util.ArrayList;
+import java.util.List;
+
public class MenuCellTests extends AndroidTestCase2 {
@@ -63,6 +68,7 @@ public class MenuCellTests extends AndroidTestCase2 {
menuCell.setIcon(Test.GENERAL_ARTWORK);
menuCell.setVoiceCommands(Test.GENERAL_STRING_LIST);
menuCell.setMenuSelectionListener(menuSelectionListener);
+ menuCell.setSubMenuLayout(Test.GENERAL_MENU_LAYOUT);
// use getters and assert equality
assertEquals(menuCell.getTitle(), Test.GENERAL_STRING);
@@ -71,6 +77,7 @@ public class MenuCellTests extends AndroidTestCase2 {
assertEquals(menuCell.getMenuSelectionListener(), menuSelectionListener);
assertEquals(menuCell.getCellId(), Test.GENERAL_MENU_MAX_ID);
assertEquals(menuCell.getParentCellId(), Test.GENERAL_MENU_MAX_ID);
+ assertEquals(menuCell.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
}
public void testConstructors(){
@@ -86,6 +93,12 @@ public class MenuCellTests extends AndroidTestCase2 {
MenuCell menuCell4 =new MenuCell(Test.GENERAL_STRING,null, null, menuSelectionListener);
assertEquals(menuCell4.getTitle(), Test.GENERAL_STRING);
assertEquals(menuCell4.getMenuSelectionListener(), menuSelectionListener);
+
+ MenuCell menuCell5 = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_MENU_LAYOUT, Test.GENERAL_ARTWORK, Test.GENERAL_MENUCELL_LIST);
+ assertEquals(menuCell5.getTitle(), Test.GENERAL_STRING);
+ assertEquals(menuCell5.getIcon(), Test.GENERAL_ARTWORK);
+ assertEquals(menuCell5.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
+ assertEquals(menuCell5.getSubCells(), Test.GENERAL_MENUCELL_LIST);
}
public void testEquality(){
@@ -107,4 +120,46 @@ public class MenuCellTests extends AndroidTestCase2 {
assertFalse(menuCell.equals(menuCell3));
}
+ public void testClone(){
+ MenuCell original = new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener);
+ MenuCell clone = original.clone();
+
+ assertNotNull(clone);
+ assertNotSame(original, clone);
+
+ assertEquals(original.getTitle(), clone.getTitle());
+ assertEquals(original.getCellId(), clone.getCellId());
+ assertEquals(original.getParentCellId(), clone.getParentCellId());
+
+ SdlArtworkTests.equalTest(original.getIcon(), clone.getIcon());
+
+ //Test subcells
+ List<MenuCell> subcells = new ArrayList<>();
+ subcells.add(original.clone());
+ subcells.add(clone.clone());
+
+ original = new MenuCell(Test.GENERAL_STRING, MenuLayout.LIST, Test.GENERAL_ARTWORK,subcells);
+ clone = original.clone();
+
+ assertNotNull(original.getSubCells());
+ assertNotNull(clone.getSubCells());
+ assertNotSame(original.getSubCells(), clone.getSubCells());
+
+ List<MenuCell> originalSubCells = original.getSubCells();
+ List<MenuCell> cloneSubCells = clone.getSubCells();
+
+ assertEquals(originalSubCells.size(), cloneSubCells.size());
+
+ for(int i = 0; i < originalSubCells.size(); i++){
+
+ assertNotNull(originalSubCells.get(i));
+ assertNotNull(cloneSubCells.get(i));
+
+ assertNotSame(originalSubCells.get(i), cloneSubCells.get(i));
+ }
+
+
+
+ }
+
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
new file mode 100644
index 000000000..62f6ccb92
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuConfigurationTests.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/18/19 3:36 PM
+ *
+ */
+
+package com.smartdevicelink.managers.screen.menu;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.test.Test;
+
+public class MenuConfigurationTests extends AndroidTestCase2 {
+
+
+ @Override
+ public void setUp() throws Exception{
+ super.setUp();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSettersAndGetters(){
+
+ // set everything - we only use the constructor to set variables in the Menu Manager
+ MenuConfiguration menuConfiguration = new MenuConfiguration(Test.GENERAL_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
+
+ // use getters and assert equality
+ assertEquals(menuConfiguration.getMenuLayout(), Test.GENERAL_MENU_LAYOUT);
+ assertEquals(menuConfiguration.getSubMenuLayout(), Test.GENERAL_MENU_LAYOUT);
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
index 73581cab4..a5dfa9037 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/MenuManagerTests.java
@@ -39,15 +39,21 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -80,7 +86,7 @@ public class MenuManagerTests extends AndroidTestCase2 {
cells = createTestCells();
- ISdl internalInterface = mock(ISdl.class);
+ final ISdl internalInterface = mock(ISdl.class);
FileManager fileManager = mock(FileManager.class);
// When internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, OnRPCNotificationListener) is called
@@ -106,6 +112,19 @@ public class MenuManagerTests extends AndroidTestCase2 {
};
doAnswer(onCommandAnswer).when(internalInterface).addOnRPCNotificationListener(eq(FunctionID.ON_COMMAND), any(OnRPCNotificationListener.class));
+ Answer<Void> answer = new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) {
+ Object[] args = invocation.getArguments();
+ RPCRequest request = (RPCRequest) args[0];
+ RPCResponse response = new RPCResponse(FunctionID.SET_GLOBAL_PROPERTIES.toString());
+ response.setSuccess(true);
+ request.getOnRPCResponseListener().onResponse(0, response);
+ return null;
+ }
+ };
+ doAnswer(answer).when(internalInterface).sendRPC(any(SetGlobalProperties.class));
+
menuManager = new MenuManager(internalInterface, fileManager);
// Check some stuff during setup
@@ -120,9 +139,10 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertNull(menuManager.inProgressUpdate);
assertNull(menuManager.keepsNew);
assertNull(menuManager.keepsOld);
+ assertNull(menuManager.menuConfiguration);
assertNotNull(menuManager.hmiListener);
assertNotNull(menuManager.commandListener);
- assertNotNull(menuManager.displayListener);
+ assertNotNull(menuManager.onDisplaysCapabilityListener);
}
@@ -137,11 +157,12 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertNull(menuManager.menuCells);
assertNull(menuManager.oldMenuCells);
assertNull(menuManager.currentHMILevel);
- assertNull(menuManager.displayCapabilities);
+ assertNull(menuManager.defaultMainWindowCapability);
assertNull(menuManager.inProgressUpdate);
assertNull(menuManager.waitingUpdateMenuCells);
assertNull(menuManager.keepsNew);
assertNull(menuManager.keepsOld);
+ assertNull(menuManager.menuConfiguration);
// after everything, make sure we are in the correct state
assertEquals(menuManager.getState(), BaseSubManager.SHUTDOWN);
@@ -425,6 +446,41 @@ public class MenuManagerTests extends AndroidTestCase2 {
assertEquals(menuManager.menuCells.size(), 0);
}
+ public void testOpeningMainMenu(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ mockMenuManager.openMenu();
+ verify(mockMenuManager, Mockito.times(1)).openMenu();
+ }
+
+ public void testOpeningSubMenuNullCells(){
+ // call open Menu
+ MenuManager mockMenuManager = mock(MenuManager.class);
+ MenuCell cell = mock(MenuCell.class);
+ mockMenuManager.oldMenuCells = null;
+ assertFalse(mockMenuManager.openSubMenu(cell));
+ }
+
+ public void testOpeningSubMenu(){
+ // call open Menu
+ List<MenuCell> testCells = createTestCells();
+ menuManager.oldMenuCells = testCells;
+ menuManager.sdlMsgVersion = new SdlMsgVersion(6,0);
+ // has to get success response to be true
+ assertTrue(menuManager.openSubMenu(testCells.get(3)));
+ }
+
+ public void testSetMenuConfiguration(){
+ menuManager.currentHMILevel = HMILevel.HMI_FULL;
+ menuManager.currentSystemContext = SystemContext.SYSCTXT_MAIN;
+ menuManager.sdlMsgVersion = new SdlMsgVersion(6,0);
+
+ MenuConfiguration menuConfigurationTest = new MenuConfiguration(MenuLayout.LIST, MenuLayout.LIST);
+ menuManager.setMenuConfiguration(menuConfigurationTest);
+ assertEquals(menuManager.menuConfiguration, menuConfigurationTest);
+
+ }
+
// HELPERS
// Emulate what happens when Core sends OnHMIStatus notification
@@ -459,7 +515,8 @@ public class MenuManagerTests extends AndroidTestCase2 {
MenuCell subCell1 = new MenuCell("SubCell 1",null, null, menuSelectionListenerSub1);
MenuCell subCell2 = new MenuCell("SubCell 2",null, null, menuSelectionListenerSub2);
- mainCell4 = new MenuCell("Test Cell 4", livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4 = new MenuCell("Test Cell 4", null, livio, Arrays.asList(subCell1,subCell2)); // sub menu parent cell
+ mainCell4.setCellId(4);
return Arrays.asList(mainCell1, mainCell2, mainCell3, mainCell4);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
index 76bce2e7a..34a452f06 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/VideoStreamManagerTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.managers.video;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.util.DisplayMetrics;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
@@ -15,6 +16,7 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
import com.smartdevicelink.proxy.rpc.TouchCoord;
@@ -32,7 +34,6 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
@@ -450,4 +451,49 @@ public class VideoStreamManagerTests extends AndroidTestCase2 {
assertEquals(MotionEvent.ACTION_UP, motionEvent.getActionMasked());
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
+
+ public void testConvertTouchEvent_Scale_1() {
+ assertMotionEventWithScale(800, 480, 1.0f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_25() {
+ assertMotionEventWithScale(1280, 768, 1.25f);
+ }
+
+ public void testConvertTouchEvent_Scale_1_5() {
+ assertMotionEventWithScale(1280, 768, 1.5f);
+ }
+
+ private void assertMotionEventWithScale(int width, int height, float scale) {
+ ISdl internalInterface = mock(ISdl.class);
+
+ // Preferred Resolution capability
+ ImageResolution resolution = new ImageResolution(width, height);
+
+ // Remote display
+ DisplayMetrics displayMetrics = new DisplayMetrics();
+ displayMetrics.widthPixels = (int) (resolution.getResolutionWidth() / scale);
+ displayMetrics.heightPixels = (int) (resolution.getResolutionHeight() / scale);
+
+
+ VideoStreamManager videoStreamManager = new VideoStreamManager(internalInterface);
+ videoStreamManager.createTouchScalar(resolution, displayMetrics);
+
+ List<MotionEvent> motionEventList;
+ long e1TS = 1558124390L;
+ int e1x = 50, e1y = 100;
+ int e1Id = 100;
+ OnTouchEvent testOnTouchEvent;
+ MotionEvent motionEvent;
+ TouchEvent touchEvent1 = new TouchEvent(e1Id, Collections.singletonList(e1TS), Collections.singletonList(new TouchCoord(e1x, e1y)));
+
+ testOnTouchEvent = new OnTouchEvent(TouchType.BEGIN, Arrays.asList(touchEvent1));
+ motionEventList = videoStreamManager.convertTouchEvent(testOnTouchEvent);
+
+
+ motionEvent = motionEventList.get(0);
+ assertEquals(1, motionEvent.getPointerCount());
+ assertEquals(Math.round(e1x / scale), Math.round(motionEvent.getX(0)));
+ assertEquals(Math.round(e1y / scale), Math.round(motionEvent.getY(0)));
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
index 375de9362..5cb0cf719 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/JsonUtils.java
@@ -170,6 +170,24 @@ public final class JsonUtils {
return null;
}
+
+ public static List<Boolean> readBooleanListFromJsonObject(JSONObject json, String key){
+ JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
+
+ if(jsonArray != null){
+ int len = jsonArray.length();
+ List<Boolean> result = new ArrayList<>(len);
+ for(int i=0; i<len; i++){
+ try {
+ Boolean bool = jsonArray.getBoolean(i);
+ result.add(bool);
+ } catch (JSONException e) {}
+ }
+ return result;
+ }
+
+ return null;
+ }
public static List<Double> readDoubleListFromJsonObject(JSONObject json, String key){
JSONArray jsonArray = readJsonArrayFromJsonObject(json, key);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
index ad9ee5b3a..3fbe0a611 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java
@@ -8,6 +8,7 @@ import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.menu.MenuCell;
+import com.smartdevicelink.managers.screen.menu.MenuConfiguration;
import com.smartdevicelink.managers.screen.menu.MenuSelectionListener;
import com.smartdevicelink.managers.screen.menu.VoiceCommand;
import com.smartdevicelink.managers.screen.menu.VoiceCommandSelectionListener;
@@ -33,7 +34,9 @@ import com.smartdevicelink.proxy.rpc.DIDResult;
import com.smartdevicelink.proxy.rpc.DateTime;
import com.smartdevicelink.proxy.rpc.DeviceInfo;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.EqualizerSettings;
+import com.smartdevicelink.proxy.rpc.Grid;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.HMIPermissions;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
@@ -55,6 +58,7 @@ import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.ModuleData;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.NavigationInstruction;
import com.smartdevicelink.proxy.rpc.NavigationServiceData;
@@ -74,6 +78,7 @@ import com.smartdevicelink.proxy.rpc.ScreenParams;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
import com.smartdevicelink.proxy.rpc.SeatControlData;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
import com.smartdevicelink.proxy.rpc.SingleTireStatus;
import com.smartdevicelink.proxy.rpc.SisData;
@@ -85,6 +90,7 @@ import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.Temperature;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.TextField;
import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
@@ -99,6 +105,8 @@ import com.smartdevicelink.proxy.rpc.WeatherAlert;
import com.smartdevicelink.proxy.rpc.WeatherData;
import com.smartdevicelink.proxy.rpc.WeatherServiceData;
import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AmbientLightStatus;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
@@ -149,6 +157,7 @@ import com.smartdevicelink.proxy.rpc.enums.MassageMode;
import com.smartdevicelink.proxy.rpc.enums.MassageZone;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
import com.smartdevicelink.proxy.rpc.enums.MediaType;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.ModuleType;
import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
@@ -190,6 +199,7 @@ import com.smartdevicelink.proxy.rpc.enums.VideoStreamingState;
import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
import com.smartdevicelink.proxy.rpc.enums.WarningLightStatus;
import com.smartdevicelink.proxy.rpc.enums.WayPointType;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.util.Version;
import org.json.JSONArray;
@@ -343,6 +353,7 @@ public class Test {
public static final AudioStreamingIndicator GENERAL_AUDIO_STREAMING_INDICATOR = AudioStreamingIndicator.PLAY;
public static final String GENERAL_APP_ID = "123e4567e8";
public static final String GENERAL_FULL_APP_ID = "123e4567-e89b-12d3-a456-426655440000";
+ public static final String GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME = "oemCustomVehicleDataName";
public static final HybridAppPreference GENERAL_HYBRID_APP_PREFERENCE = HybridAppPreference.CLOUD;
public static final CloudAppProperties GENERAL_CLOUDAPPPROPERTIES = new CloudAppProperties();
public static final AppServiceType GENERAL_APP_SERVICE_TYPE = AppServiceType.MEDIA;
@@ -398,7 +409,16 @@ public class Test {
public static final AudioControlData GENERAL_AUDIOCONTROLDATA = new AudioControlData();
public static final LightControlData GENERAL_LIGHTCONTROLDATA = new LightControlData();
public static final HMISettingsControlData GENERAL_HMISETTINGSCONTROLDATA = new HMISettingsControlData();
+
+ public static final VehicleDataResult GENERAL_OEM_CUSTOM_VEHICLE_DATA = new VehicleDataResult();
+ public static final TemplateConfiguration GENERAL_TEMPLATE_CONFIGURATION = new TemplateConfiguration();
+ public static final WindowTypeCapabilities GENERAL_WINDOW_TYPE_CAPABILITIES = new WindowTypeCapabilities();
+ public static final WindowCapability GENERAL_WINDOW_CAPABILITY = new WindowCapability();
+ public static final DisplayCapability GENERAL_DISPLAY_CAPABILITY = new DisplayCapability();
+
public static final SdlArtwork GENERAL_ARTWORK = new SdlArtwork("sdl", FileType.GRAPHIC_PNG, R.drawable.ic_sdl, false);
+ public static final MenuLayout GENERAL_MENU_LAYOUT = MenuLayout.LIST;
+ public static final MenuConfiguration GENERAL_MENU_CONFIGURATION = new MenuConfiguration(GENERAL_MENU_LAYOUT, GENERAL_MENU_LAYOUT);
public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities();
@@ -407,7 +427,10 @@ public class Test {
public static final HapticRect GENERAL_HAPTIC_RECT = new HapticRect();
public static final FuelType GENERAL_FUELTYPE = FuelType.GASOLINE;
public static final LockScreenConfig GENERAL_LOCKSCREENCONFIG = new LockScreenConfig();
-
+ public static final Grid GENERAL_GRID = new Grid();
+ public static final SeatLocation GENERAL_SEAT_LOCATION = new SeatLocation();
+ public static final ModuleInfo GENERAL_MODULE_INFO = new ModuleInfo();
+ public static final WindowType GENERAL_WINDOWTYPE = WindowType.MAIN;
public static final List<Long> GENERAL_LONG_LIST = Arrays.asList(new Long[]{ 1L, 2L });
public static final List<Turn> GENERAL_TURN_LIST = new ArrayList<Turn>();
public static final List<Choice> GENERAL_CHOICE_LIST = new ArrayList<Choice>();
@@ -455,6 +478,14 @@ public class Test {
public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA);
public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT);
public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION);
+ public static final List<SeatLocation> GENERAL_SEAT_LIST = new ArrayList<>(1);
+ public static final List<Boolean> GENERAL_BOOLEAN_LIST = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.TRUE});
+ public static final List<Integer> GENERAL_AVAILABLE_HD_CHANNELS_LIST = Arrays.asList(new Integer[]{ 1, 2});
+ public static final List<ImageType> GENERAL_IMAGE_TYPE_LIST = Arrays.asList(new ImageType[]{ImageType.DYNAMIC, ImageType.STATIC});
+ public static final List<WindowTypeCapabilities> GENERAL_WINDOW_TYPE_CAPABILITIES_LIST = new ArrayList<WindowTypeCapabilities>(1);
+ public static final List<WindowCapability> GENERAL_WINDOW_CAPABILITY_LIST = new ArrayList<WindowCapability>(1);
+ public static final List<DisplayCapability> GENERAL_DISPLAYCAPABILITY_LIST = new ArrayList<DisplayCapability>(1);
+ public static final List<MenuLayout> GENERAL_MENU_LAYOUT_LIST = Arrays.asList(MenuLayout.LIST, MenuLayout.TILES);
public static final int GENERAL_MENU_MAX_ID = 2000000000;
public static final MenuCell GENERAL_MENUCELL = new MenuCell(GENERAL_STRING,null, null, new MenuSelectionListener() {
@Override
@@ -473,7 +504,6 @@ public class Test {
});
public static final List<VoiceCommand> GENERAL_VOICE_COMMAND_LIST = Arrays.asList(GENERAL_VOICE_COMMAND);
-
public static final JSONArray JSON_TURNS = new JSONArray();
public static final JSONArray JSON_CHOICES = new JSONArray();
public static final JSONArray JSON_HMILEVELS = new JSONArray();
@@ -492,6 +522,7 @@ public class Test {
public static final JSONArray JSON_RADIOCONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_CLIMATECONTROLCAPABILITIES = new JSONArray();
public static final JSONArray JSON_TEXTFIELDTYPES = new JSONArray();
+ public static final JSONArray JSON_SEAT_LOCATIONS = new JSONArray();
public static final JSONObject JSON_TURN = new JSONObject();
public static final JSONObject JSON_IMAGE = new JSONObject();
public static final JSONObject JSON_CHOICE = new JSONObject();
@@ -519,7 +550,16 @@ public class Test {
public static final JSONObject JSON_RGBCOLOR = new JSONObject();
public static final JSONObject JSON_DAYCOLORSCHEME = new JSONObject();
public static final JSONObject JSON_NIGHTCOLORSCHEME = new JSONObject();
-
+ public static final JSONObject JSON_GRID = new JSONObject();
+ public static final JSONObject JSON_MODULE_INFO = new JSONObject();
+ public static final JSONArray JSON_IMAGE_TYPE_SUPPORTED = new JSONArray();
+ public static final JSONObject JSON_WINDOW_TYPE_CAPABILITIES = new JSONObject();
+ public static final JSONArray JSON_WINDOW_TYPE_CAPABILITIES_LIST = new JSONArray();
+ public static final JSONObject JSON_WINDOW_CAPABILITY = new JSONObject();
+ public static final JSONArray JSON_WINDOW_CAPABILITIES = new JSONArray();
+ public static final JSONArray JSON_IMAGE_TYPES = new JSONArray();
+ public static final JSONObject JSON_DISPLAYCAPABILITY = new JSONObject();
+ public static final JSONArray JSON_DISPLAYCAPABILITY_LIST = new JSONArray();
static {
GENERAL_TOUCHEVENTCAPABILITIES.setDoublePressAvailable(GENERAL_BOOLEAN);
GENERAL_TOUCHEVENTCAPABILITIES.setMultiTouchAvailable(GENERAL_BOOLEAN);
@@ -666,16 +706,40 @@ public class Test {
GENERAL_IMAGEFIELD.setImageTypeSupported(GENERAL_FILETYPE_LIST);
GENERAL_IMAGEFIELD_LIST.add(GENERAL_IMAGEFIELD);
+ GENERAL_WINDOW_TYPE_CAPABILITIES.setType(GENERAL_WINDOWTYPE);
+ GENERAL_WINDOW_TYPE_CAPABILITIES.setMaximumNumberOfWindows(GENERAL_INT);
+ GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.add(GENERAL_WINDOW_TYPE_CAPABILITIES);
+
+ GENERAL_WINDOW_CAPABILITY.setWindowID(GENERAL_INT);
+ GENERAL_WINDOW_CAPABILITY.setTextFields(GENERAL_TEXTFIELD_LIST);
+ GENERAL_WINDOW_CAPABILITY.setImageFields(GENERAL_IMAGEFIELD_LIST);
+ GENERAL_WINDOW_CAPABILITY.setImageTypeSupported(GENERAL_IMAGE_TYPE_LIST);
+ GENERAL_WINDOW_CAPABILITY.setTemplatesAvailable(GENERAL_STRING_LIST);
+ GENERAL_WINDOW_CAPABILITY.setNumCustomPresetsAvailable(GENERAL_INT);
+ GENERAL_WINDOW_CAPABILITY.setButtonCapabilities(GENERAL_BUTTONCAPABILITIES_LIST);
+ GENERAL_WINDOW_CAPABILITY.setSoftButtonCapabilities(GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ GENERAL_WINDOW_CAPABILITY_LIST.add(GENERAL_WINDOW_CAPABILITY);
+
+ GENERAL_DISPLAY_CAPABILITY.setDisplayName(GENERAL_STRING);
+ GENERAL_DISPLAY_CAPABILITY.setWindowTypeSupported(GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
+ GENERAL_DISPLAY_CAPABILITY.setWindowCapabilities(GENERAL_WINDOW_CAPABILITY_LIST);
+ GENERAL_DISPLAYCAPABILITY_LIST.add(GENERAL_DISPLAY_CAPABILITY);
+
GENERAL_SCREENPARAMS.setImageResolution(GENERAL_IMAGERESOLUTION);
GENERAL_SCREENPARAMS.setTouchEventAvailable(GENERAL_TOUCHEVENTCAPABILITIES);
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK1);
GENERAL_MEDIACLOCKFORMAT_LIST.add(MediaClockFormat.CLOCK2);
+ GENERAL_SEAT_LIST.add(GENERAL_SEAT_LOCATION);
GENERAL_IMAGE.setValue(GENERAL_STRING);
GENERAL_IMAGE.setImageType(GENERAL_IMAGETYPE);
GENERAL_IMAGE.setIsTemplate(GENERAL_BOOLEAN);
+ GENERAL_TEMPLATE_CONFIGURATION.setTemplate(GENERAL_STRING);
+ GENERAL_TEMPLATE_CONFIGURATION.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
+ GENERAL_TEMPLATE_CONFIGURATION.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+
GENERAL_SOFTBUTTON.setIsHighlighted(GENERAL_BOOLEAN);
GENERAL_SOFTBUTTON.setSoftButtonID(GENERAL_INT);
GENERAL_SOFTBUTTON.setSystemAction(SystemAction.STEAL_FOCUS);
@@ -735,6 +799,9 @@ public class Test {
GENERAL_VEHICLEDATARESULT_LIST.add(result);
}
+ GENERAL_OEM_CUSTOM_VEHICLE_DATA.setResultCode(VehicleDataResultCode.SUCCESS);
+ GENERAL_OEM_CUSTOM_VEHICLE_DATA.setOEMCustomVehicleDataType(GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+
GENERAL_DIDRESULT.setData(GENERAL_STRING);
GENERAL_DIDRESULT.setDidLocation(GENERAL_INT);
GENERAL_DIDRESULT.setResultCode(VehicleDataResultCode.SUCCESS);
@@ -794,6 +861,7 @@ public class Test {
GENERAL_PERMISSIONITEM.setRpcName(GENERAL_STRING);
GENERAL_PERMISSIONITEM.setHMIPermissions(GENERAL_HMIPERMISSIONS);
GENERAL_PERMISSIONITEM.setParameterPermissions(GENERAL_PARAMETERPERMISSIONS);
+ GENERAL_PERMISSIONITEM.setRequireEncryption(GENERAL_BOOLEAN);
GENERAL_PERMISSIONITEM_LIST.add(GENERAL_PERMISSIONITEM);
GENERAL_SYSTEMCAPABILITY.setSystemCapabilityType(GENERAL_SYSTEMCAPABILITYTYPE);
@@ -1037,6 +1105,10 @@ public class Test {
GENERAL_NAVIGATION_INSTRUCTION.setDrivingSide(GENERAL_DIRECTION);
GENERAL_NAVIGATION_INSTRUCTION.setDetails(GENERAL_STRING);
GENERAL_NAVIGATION_INSTRUCTION.setImage(GENERAL_IMAGE);
+ GENERAL_MODULE_INFO.setModuleId(Test.GENERAL_STRING);
+ GENERAL_MODULE_INFO.setModuleLocation(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setModuleServiceArea(Test.GENERAL_GRID);
+ GENERAL_MODULE_INFO.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
try {
@@ -1062,6 +1134,9 @@ public class Test {
JSON_CHOICE.put(Choice.KEY_SECONDARY_IMAGE, JSON_IMAGE);
JSON_CHOICE.put(Choice.KEY_VR_COMMANDS, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+ JSON_IMAGE_TYPE_SUPPORTED.put(ImageType.DYNAMIC);
+ JSON_IMAGE_TYPE_SUPPORTED.put(ImageType.STATIC);
+
JSON_HMILEVELS.put(HMILevel.HMI_FULL);
JSON_HMILEVELS.put(HMILevel.HMI_BACKGROUND);
@@ -1074,6 +1149,7 @@ public class Test {
JSON_PERMISSIONITEM.put(PermissionItem.KEY_HMI_PERMISSIONS, JSON_HMIPERMISSIONS);
JSON_PERMISSIONITEM.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, JSON_PARAMETERPERMISSIONS);
JSON_PERMISSIONITEM.put(PermissionItem.KEY_RPC_NAME, GENERAL_STRING);
+ JSON_PERMISSIONITEM.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, GENERAL_BOOLEAN);
JSON_PERMISSIONITEMS.put(JSON_PERMISSIONITEM);
JSON_IMAGE.put(Image.KEY_IMAGE_TYPE, GENERAL_IMAGETYPE);
@@ -1210,6 +1286,23 @@ public class Test {
JSON_IMAGEFIELD.put(ImageField.KEY_NAME, ImageFieldName.graphic);
JSON_IMAGEFIELDS.put(JSON_IMAGEFIELD);
+ JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_TYPE, GENERAL_WINDOWTYPE);
+ JSON_WINDOW_TYPE_CAPABILITIES.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, GENERAL_INT);
+ JSON_WINDOW_TYPE_CAPABILITIES_LIST.put(JSON_WINDOW_TYPE_CAPABILITIES);
+
+ JSON_IMAGE_TYPES.put(ImageType.DYNAMIC);
+ JSON_IMAGE_TYPES.put(ImageType.STATIC);
+
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_WINDOW_ID, GENERAL_INT);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_TEXT_FIELDS, JSON_TEXTFIELDS);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_IMAGE_FIELDS, JSON_IMAGEFIELDS);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, JSON_IMAGE_TYPES);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, GENERAL_INT);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_BUTTON_CAPABILITIES, JSON_BUTTONCAPABILITIES);
+ JSON_WINDOW_CAPABILITY.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, JSON_SOFTBUTTONCAPABILITIES);
+ JSON_WINDOW_CAPABILITIES.put(JSON_WINDOW_CAPABILITY);
+
JSONObject jsonTEC = new JSONObject();
jsonTEC.put(TouchEventCapabilities.KEY_DOUBLE_PRESS_AVAILABLE, GENERAL_BOOLEAN);
jsonTEC.put(TouchEventCapabilities.KEY_MULTI_TOUCH_AVAILABLE, GENERAL_BOOLEAN);
@@ -1228,6 +1321,11 @@ public class Test {
JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(GENERAL_STRING_LIST));
JSON_DISPLAYCAPABILITIES.put(DisplayCapabilities.KEY_TEXT_FIELDS, JSON_TEXTFIELDS);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_DISPLAY_NAME, GENERAL_STRING);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, JSON_WINDOW_TYPE_CAPABILITIES_LIST);
+ JSON_DISPLAYCAPABILITY.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, JSON_WINDOW_CAPABILITIES);
+ JSON_DISPLAYCAPABILITY_LIST.put(JSON_DISPLAYCAPABILITY);
+
JSON_TOUCHCOORD.put(TouchCoord.KEY_X, GENERAL_INT);
JSON_TOUCHCOORD.put(TouchCoord.KEY_Y, GENERAL_INT);
JSON_TOUCHCOORDS.put(JSON_TOUCHCOORD);
@@ -1241,6 +1339,13 @@ public class Test {
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ALBUM);
JSON_TEXTFIELDTYPES.put(MetadataType.MEDIA_ARTIST);
+ JSON_SEAT_LOCATIONS.put(JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_LOCATION, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, Test.JSON_GRID);
+ JSON_MODULE_INFO.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+
} catch (JSONException e) {
Log.e("Test", "Static Json Construction Failed.", e);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
index 5172e4053..781b687a6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Validator.java
@@ -5,103 +5,13 @@ import com.smartdevicelink.protocol.enums.FrameData;
import com.smartdevicelink.protocol.enums.FrameDataControlFrameType;
import com.smartdevicelink.protocol.enums.FrameType;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.rpc.AirbagStatus;
-import com.smartdevicelink.proxy.rpc.AppServiceCapability;
-import com.smartdevicelink.proxy.rpc.AppServiceManifest;
-import com.smartdevicelink.proxy.rpc.AppServiceRecord;
-import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
-import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
-import com.smartdevicelink.proxy.rpc.AudioControlData;
-import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
-import com.smartdevicelink.proxy.rpc.BeltStatus;
-import com.smartdevicelink.proxy.rpc.BodyInformation;
-import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
-import com.smartdevicelink.proxy.rpc.Choice;
-import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
-import com.smartdevicelink.proxy.rpc.ClimateControlData;
-import com.smartdevicelink.proxy.rpc.ClusterModeStatus;
-import com.smartdevicelink.proxy.rpc.Coordinate;
-import com.smartdevicelink.proxy.rpc.DIDResult;
-import com.smartdevicelink.proxy.rpc.DateTime;
-import com.smartdevicelink.proxy.rpc.DeviceInfo;
-import com.smartdevicelink.proxy.rpc.DeviceStatus;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
-import com.smartdevicelink.proxy.rpc.ECallInfo;
-import com.smartdevicelink.proxy.rpc.EmergencyEvent;
-import com.smartdevicelink.proxy.rpc.EqualizerSettings;
-import com.smartdevicelink.proxy.rpc.FuelRange;
-import com.smartdevicelink.proxy.rpc.GPSData;
-import com.smartdevicelink.proxy.rpc.HMICapabilities;
-import com.smartdevicelink.proxy.rpc.HMIPermissions;
-import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
-import com.smartdevicelink.proxy.rpc.HMISettingsControlData;
-import com.smartdevicelink.proxy.rpc.HeadLampStatus;
-import com.smartdevicelink.proxy.rpc.Headers;
-import com.smartdevicelink.proxy.rpc.Image;
-import com.smartdevicelink.proxy.rpc.ImageField;
-import com.smartdevicelink.proxy.rpc.ImageResolution;
-import com.smartdevicelink.proxy.rpc.KeyboardProperties;
-import com.smartdevicelink.proxy.rpc.LightCapabilities;
-import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
-import com.smartdevicelink.proxy.rpc.LightControlData;
-import com.smartdevicelink.proxy.rpc.LightState;
-import com.smartdevicelink.proxy.rpc.LocationDetails;
-import com.smartdevicelink.proxy.rpc.MassageCushionFirmness;
-import com.smartdevicelink.proxy.rpc.MassageModeData;
-import com.smartdevicelink.proxy.rpc.MediaServiceData;
-import com.smartdevicelink.proxy.rpc.MediaServiceManifest;
-import com.smartdevicelink.proxy.rpc.MenuParams;
-import com.smartdevicelink.proxy.rpc.ModuleData;
-import com.smartdevicelink.proxy.rpc.MyKey;
-import com.smartdevicelink.proxy.rpc.NavigationCapability;
-import com.smartdevicelink.proxy.rpc.NavigationInstruction;
-import com.smartdevicelink.proxy.rpc.NavigationServiceData;
-import com.smartdevicelink.proxy.rpc.NavigationServiceManifest;
-import com.smartdevicelink.proxy.rpc.OasisAddress;
-import com.smartdevicelink.proxy.rpc.ParameterPermissions;
-import com.smartdevicelink.proxy.rpc.PermissionItem;
-import com.smartdevicelink.proxy.rpc.PhoneCapability;
-import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
-import com.smartdevicelink.proxy.rpc.RGBColor;
-import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
-import com.smartdevicelink.proxy.rpc.RadioControlData;
-import com.smartdevicelink.proxy.rpc.RdsData;
-import com.smartdevicelink.proxy.rpc.Rectangle;
-import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
-import com.smartdevicelink.proxy.rpc.ScreenParams;
-import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.SeatControlCapabilities;
-import com.smartdevicelink.proxy.rpc.SeatControlData;
-import com.smartdevicelink.proxy.rpc.SeatMemoryAction;
-import com.smartdevicelink.proxy.rpc.SingleTireStatus;
-import com.smartdevicelink.proxy.rpc.SisData;
-import com.smartdevicelink.proxy.rpc.SoftButton;
-import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
-import com.smartdevicelink.proxy.rpc.StartTime;
-import com.smartdevicelink.proxy.rpc.StationIDNumber;
-import com.smartdevicelink.proxy.rpc.TTSChunk;
-import com.smartdevicelink.proxy.rpc.Temperature;
-import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
-import com.smartdevicelink.proxy.rpc.TextField;
-import com.smartdevicelink.proxy.rpc.TireStatus;
-import com.smartdevicelink.proxy.rpc.TouchCoord;
-import com.smartdevicelink.proxy.rpc.TouchEvent;
-import com.smartdevicelink.proxy.rpc.TouchEventCapabilities;
-import com.smartdevicelink.proxy.rpc.Turn;
-import com.smartdevicelink.proxy.rpc.VehicleDataResult;
-import com.smartdevicelink.proxy.rpc.VehicleType;
-import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
-import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
-import com.smartdevicelink.proxy.rpc.VrHelpItem;
-import com.smartdevicelink.proxy.rpc.WeatherAlert;
-import com.smartdevicelink.proxy.rpc.WeatherData;
-import com.smartdevicelink.proxy.rpc.WeatherServiceData;
-import com.smartdevicelink.proxy.rpc.WeatherServiceManifest;
+import com.smartdevicelink.proxy.rpc.*;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
@@ -136,8 +46,13 @@ public class Validator{
return ( result1 == null );
}
- return ( result1.getDataType().equals(result2.getDataType())
- && result1.getResultCode().equals(result2.getResultCode()) );
+ if(result1.getDataType() != null && result2.getDataType() != null){
+ return ( result1.getDataType().equals(result2.getDataType())
+ && result1.getResultCode().equals(result2.getResultCode()) );
+ } else {
+ return ( result1.getOEMCustomVehicleDataType().equals(result2.getOEMCustomVehicleDataType())
+ && result1.getResultCode().equals(result2.getResultCode()) );
+ }
}
public static boolean validateBulkData(byte[] array1, byte[] array2){
@@ -367,7 +282,7 @@ public class Validator{
return validateImage(button1.getImage(), button2.getImage())
&& validateText(button1.getText(), button2.getText())
&& button1.getIsHighlighted() == button2.getIsHighlighted()
- && button1.getSoftButtonID() == button2.getSoftButtonID()
+ && ( (button1 .getSoftButtonID() == null && button2.getSoftButtonID() == null) || button1.getSoftButtonID().equals(button2.getSoftButtonID()))
&& button1.getSystemAction() == button2.getSystemAction()
&& button1.getType() == button2.getType();
}
@@ -549,6 +464,29 @@ public class Validator{
return true;
}
+ public static boolean validateTemplateConfiguration(TemplateConfiguration params1, TemplateConfiguration params2) {
+ if (params1 == null) {
+ return (params2 == null);
+ }
+ if (params2 == null) {
+ return (params1 == null);
+ }
+
+ if (!params1.getTemplate().equals(params2.getTemplate())) {
+ return false;
+ }
+
+ if (!validateTemplateColorScheme(params1.getDayColorScheme(), params2.getDayColorScheme())) {
+ return false;
+ }
+
+ if (!validateTemplateColorScheme(params1.getNightColorScheme(), params2.getNightColorScheme())) {
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateAppServiceCapabilityList(List<AppServiceCapability> list1, List<AppServiceCapability> list2){
if(list1 == null){
return ( list2 == null );
@@ -1499,6 +1437,29 @@ public class Validator{
return true;
}
+
+ public static boolean validateWindowTypeCapabilities(WindowTypeCapabilities item1, WindowTypeCapabilities item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getType() == null) {
+ return (item2.getType() == null);
+ }
+
+ if (item1.getType() != item2.getType()) {
+ return false;
+ }
+
+ if (item1.getMaximumNumberOfWindows() != item2.getMaximumNumberOfWindows()) {
+ return false;
+ }
+
+ return true;
+ }
public static boolean validateFileTypes (List<FileType> item1, List<FileType> item2) {
if (item1 == null) {
@@ -2002,6 +1963,9 @@ public class Validator{
if(item1.getVdop() != item2.getVdop()){
return false;
}
+ if(item1.getShifted() != item2.getShifted()){
+ return false;
+ }
return true;
}
@@ -2385,6 +2349,10 @@ public class Validator{
return false;
}
+ if(item1.getRequireEncryption() != item2.getRequireEncryption()) {
+ return false;
+ }
+
return true;
}
@@ -2779,7 +2747,162 @@ public class Validator{
return true;
}
-
+
+ public static boolean validateDisplayCapabilityList(List<DisplayCapability> list1, List<DisplayCapability> list2) {
+ if (list1 == null || list2 == null) {
+ return false;
+ }
+
+ if (list1.size() != list2.size()) {
+ return false;
+ }
+
+ for (int i = 0; i < list1.size(); i++) {
+ if (!validateDisplayCapability(list1.get(i), list2.get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateDisplayCapability(DisplayCapability item1, DisplayCapability item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (!item1.getDisplayName().equals(item2.getDisplayName())) {
+ return false;
+ }
+
+ if (item1.getWindowTypeSupported() == null) {
+ return (item2.getWindowTypeSupported() == null);
+ }
+
+ if (item1.getWindowTypeSupported().size() != item2.getWindowTypeSupported().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getWindowTypeSupported().size(); i++) {
+ if (item1.getWindowTypeSupported().get(i) == null && item2.getWindowTypeSupported().get(i) != null) {
+ return false;
+ }
+
+ if (!validateWindowTypeCapabilities(item1.getWindowTypeSupported().get(i), item2.getWindowTypeSupported().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getWindowCapabilities() == null) {
+ return (item2.getWindowCapabilities() == null);
+ }
+
+ if (item1.getWindowCapabilities().size() != item2.getWindowCapabilities().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getWindowCapabilities().size(); i++) {
+ if (item1.getWindowCapabilities().get(i) == null && item2.getWindowCapabilities().get(i) != null) {
+ return false;
+ }
+
+ if (!validateWindowCapability(item1.getWindowCapabilities().get(i), item2.getWindowCapabilities().get(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean validateWindowCapability(WindowCapability item1, WindowCapability item2) {
+ if (item1 == null) {
+ return (item2 == null);
+ }
+ if (item2 == null) {
+ return (item1 == null);
+ }
+
+ if (item1.getWindowID() != item2.getWindowID()) {
+ return false;
+ }
+
+ if (!validateStringList(item1.getTemplatesAvailable(), item2.getTemplatesAvailable())) {
+ log("TA", item1.getTemplatesAvailable() + " | " + item2.getTemplatesAvailable());
+ return false;
+ }
+
+ if (item1.getNumCustomPresetsAvailable() != item2.getNumCustomPresetsAvailable()) {
+ return false;
+ }
+
+ if (item1.getTextFields() == null) {
+ return (item2.getTextFields() == null);
+ }
+
+ if (item1.getTextFields().size() != item2.getTextFields().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getTextFields().size(); i++) {
+ if (item1.getTextFields().get(i) == null && item2.getTextFields().get(i) != null) {
+ return false;
+ }
+
+ if (!validateTextFields(item1.getTextFields().get(i), item2.getTextFields().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getImageFields() == null) {
+ return (item2.getImageFields() == null);
+ }
+
+ if (item1.getImageFields().size() != item2.getImageFields().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getImageFields().size(); i++) {
+ if (item1.getImageFields().get(i) == null && item2.getImageFields().get(i) != null) {
+ return false;
+ }
+
+ if (!validateImageFields(item1.getImageFields().get(i), item2.getImageFields().get(i))) {
+ return false;
+ }
+ }
+
+ if (item1.getImageTypeSupported() == null) {
+ return (item2.getImageTypeSupported() == null);
+ }
+
+ if (item1.getImageTypeSupported().size() != item2.getImageTypeSupported().size()) {
+ return false;
+ }
+
+ for (int i = 0; i < item1.getImageTypeSupported().size(); i++) {
+ if (item1.getImageTypeSupported().get(i) == null) {
+ return (item2.getImageTypeSupported().get(i) == null);
+ }
+
+ if (item1.getImageTypeSupported().get(i) != item2.getImageTypeSupported().get(i)) {
+ return false;
+ }
+ }
+
+ if (!validateButtonCapabilities(item1.getButtonCapabilities(), item2.getButtonCapabilities())) {
+ return false;
+ }
+
+ if (!validateSoftButtonCapabilities(item1.getSoftButtonCapabilities(), item2.getSoftButtonCapabilities())) {
+ return false;
+ }
+
+ return true;
+ }
+
public static boolean validateButtonCapabilities (List<ButtonCapabilities> item1, List<ButtonCapabilities> item2) {
if (item1 == null) {
return ( item2 == null );
@@ -3553,6 +3676,15 @@ public class Validator{
return true;
}
+ public static boolean validatePreRecordedSpeechCapabilities(List<PrerecordedSpeech> spA, List<PrerecordedSpeech> spB){
+ for(int i = 0; i < spA.size(); i++){
+ if(!spA.get(i).equals(spB.get(i))){
+ return false;
+ }
+ }
+ return true;
+ }
+
public static boolean validateVideoStreamingFormat(VideoStreamingFormat a, VideoStreamingFormat b){
if(!a.getCodec().equals(b.getCodec())){
return false;
@@ -3582,4 +3714,73 @@ public class Validator{
return true;
}
+
+ public static boolean validateGrid(Grid g1, Grid g2) {
+ String tag = "validateGrid";
+ if (g1 == null) {
+ return (g2 == null);
+ }
+ if (g2 == null) {
+ return (g1 == null);
+ }
+ if (g1.getCol() != g2.getCol()) {
+ log(tag, "Columns do not match");
+ return false;
+ }
+ if (g1.getRow() != g2.getRow()) {
+ log(tag, "Rows do not match");
+ return false;
+ }
+ if (g1.getLevel() != g2.getLevel()) {
+ log(tag, "Levels do not match");
+ return false;
+ }
+ if (g1.getColSpan() != g2.getColSpan()) {
+ log(tag, "Column spans do not match");
+ return false;
+ }
+ if (g1.getRowSpan() != g2.getRowSpan()) {
+ log(tag, "Row spans do not match");
+ return false;
+ }
+ if (g1.getLevelSpan() != g2.getLevelSpan()) {
+ log(tag, "Level spans do not match");
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateModuleInfo(ModuleInfo m1, ModuleInfo m2) {
+ if (m1 == null) {
+ return (m2 == null);
+ }
+ if (m2 == null) {
+ return (m1 == null);
+ }
+ if (!m1.getModuleId().equals(m2.getModuleId())) {
+ return false;
+ }
+ if (!m1.getMultipleAccessAllowance().equals(m2.getMultipleAccessAllowance())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleLocation(), m2.getModuleLocation())) {
+ return false;
+ }
+ if (!validateGrid(m1.getModuleServiceArea(), m2.getModuleServiceArea())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean validateSeatLocation(SeatLocation cap1, SeatLocation cap2) {
+ if (cap1 == null) {
+ return (cap2 == null);
+ }
+ if (cap2 == null) {
+ return (cap1 == null);
+ }
+ return validateGrid(cap1.getGrid(), cap2.getGrid());
+ }
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
index c9373adfc..b0f753e13 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/VehicleDataHelper.java
@@ -77,6 +77,7 @@ public class VehicleDataHelper{
public static final List<FuelRange> FUEL_RANGE_LIST = new ArrayList<FuelRange>(1);
public static final TurnSignal TURN_SIGNAL = TurnSignal.OFF;
public static final ElectronicParkBrakeStatus ELECTRONIC_PARK_BRAKE_STATUS = ElectronicParkBrakeStatus.CLOSED;
+ public static final String OEM_CUSTOM_VEHICLE_DATA_STATE = "oemCustomVehicleDataState";
//other variables inside some of the above objects
// tire status
@@ -107,6 +108,7 @@ public class VehicleDataHelper{
public static final Double GPS_ALTITUDE = 768.5;
public static final Double GPS_HEADING = 315.0;
public static final Double GPS_SPEED = 30.5;
+ public static final Boolean GPS_SHIFTED = true;
// belt status
public static final VehicleDataEventStatus BELT_STATUS_DRIVER_DEPLOYED = VehicleDataEventStatus.NO;
@@ -236,6 +238,7 @@ public class VehicleDataHelper{
GPS.setAltitude(GPS_ALTITUDE);
GPS.setHeading(GPS_HEADING);
GPS.setSpeed(GPS_SPEED);
+ GPS.setShifted(GPS_SHIFTED);
//BELT_STATUS set up
BELT_STATUS.setDriverBeltDeployed(BELT_STATUS_DRIVER_DEPLOYED);
@@ -354,6 +357,7 @@ public class VehicleDataHelper{
VEHICLE_DATA.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
//set up the GetVehicleDataResponse object
VEHICLE_DATA_RESPONSE.setSpeed(SPEED);
@@ -385,6 +389,7 @@ public class VehicleDataHelper{
VEHICLE_DATA_RESPONSE.setFuelRange(FUEL_RANGE_LIST);
VEHICLE_DATA_RESPONSE.setTurnSignal(TURN_SIGNAL);
VEHICLE_DATA_RESPONSE.setElectronicParkBrakeStatus(ELECTRONIC_PARK_BRAKE_STATUS);
+ VEHICLE_DATA_RESPONSE.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, OEM_CUSTOM_VEHICLE_DATA_STATE);
}
private VehicleDataHelper(){}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
index 385a6d12a..0d1fa04bf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java
@@ -18,6 +18,7 @@ import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
@@ -25,14 +26,24 @@ import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.PresetBankCapabilities;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.SystemCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
import com.smartdevicelink.proxy.rpc.enums.AppServiceType;
+import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
+import com.smartdevicelink.proxy.rpc.enums.PrerecordedSpeech;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -46,6 +57,7 @@ import com.smartdevicelink.test.utl.AppServiceFactory;
import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.Version;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -81,15 +93,65 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
raiResponse.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
raiResponse.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
raiResponse.setSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST);
+ raiResponse.setPrerecordedSpeech(Test.GENERAL_PRERECORDEDSPEECH_LIST);
raiResponse.setSuccess(true);
systemCapabilityManager.parseRAIResponse(raiResponse);
return systemCapabilityManager;
}
+ private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
+ WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
+
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setDisplayName(display != null ? display.getDisplayName() : null);
+ displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
+
+ WindowCapability defaultWindowCapability = new WindowCapability();
+ defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ defaultWindowCapability.setButtonCapabilities(button);
+ defaultWindowCapability.setSoftButtonCapabilities(softButton);
+
+ if (display == null) {
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
+ defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
+ defaultWindowCapability.setTextFields(display.getTextFields());
+ defaultWindowCapability.setImageFields(display.getImageFields());
+ ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
+ imageTypeSupported.add(ImageType.STATIC);
+ if (display.getGraphicSupported()) {
+ imageTypeSupported.add(ImageType.DYNAMIC);
+ }
+ defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
+
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ private DisplayCapabilities createDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
+ DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
+ convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
+ convertedCapabilities.setDisplayName(displayName);
+ convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
+ convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
+ convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
+ convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
+ convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
+ convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
+
+ return convertedCapabilities;
+ }
+
public void testParseRAI() {
systemCapabilityManager = createSampleManager();
+ List<DisplayCapability> displayCapabilityList = createDisplayCapabilityList(Test.GENERAL_DISPLAYCAPABILITIES, Test.GENERAL_BUTTONCAPABILITIES_LIST, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ assertTrue(Test.TRUE,
+ Validator.validateDisplayCapabilityList(displayCapabilityList, (List<DisplayCapability>) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS)));
assertTrue(Test.TRUE,
Validator.validateHMICapabilities(Test.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI)));
assertTrue(Test.TRUE,
@@ -106,6 +168,9 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON)));
assertTrue(Test.TRUE,
Validator.validateSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH)));
+ assertTrue(Test.TRUE,
+ Validator.validatePreRecordedSpeechCapabilities(Test.GENERAL_PRERECORDEDSPEECH_LIST, (List<PrerecordedSpeech>) systemCapabilityManager.getCapability(SystemCapabilityType.PRERECORDED_SPEECH)));
+
}
public void testGetVSCapability(){
@@ -184,7 +249,36 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
scmRpcListener.onReceived(onSystemCapabilityUpdated);
assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.APP_SERVICES));
+ }
+
+ public void testOnSystemCapabilityUpdatedForDISPLAYS() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener scmRpcListener = iSDL.rpcListeners.get(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED.getId()).get(0);
+ assertNotNull(scmRpcListener);
+
+ assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS));
+ assertNotNull(systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY));
+
+ List<DisplayCapability> newCaps = createDisplayCapabilityList(Test.GENERAL_DISPLAYCAPABILITIES, Test.GENERAL_BUTTONCAPABILITIES_LIST, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);;
+ SystemCapability systemCapability = new SystemCapability();
+ systemCapability.setSystemCapabilityType(SystemCapabilityType.DISPLAYS);
+ systemCapability.setCapabilityForType(SystemCapabilityType.DISPLAYS, newCaps);
+
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = new OnSystemCapabilityUpdated();
+ onSystemCapabilityUpdated.setSystemCapability(systemCapability);
+
+ scmRpcListener.onReceived(onSystemCapabilityUpdated);
+
+ List<DisplayCapability> appliedCaps = (List<DisplayCapability>)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS);
+ assertNotNull(appliedCaps);
+ assertTrue(Validator.validateDisplayCapabilityList(newCaps, appliedCaps));
+
+ DisplayCapabilities appliedConvertedCaps = (DisplayCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
+ assertNotNull(appliedConvertedCaps);
+ DisplayCapabilities testConvertedCaps = createDisplayCapabilities(newCaps.get(0).getDisplayName(), newCaps.get(0).getWindowCapabilities().get(0));
+ assertTrue(Validator.validateDisplayCapabilities(appliedConvertedCaps, testConvertedCaps));
}
public void testOnSystemCapabilityUpdated(){
@@ -324,6 +418,46 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
assertEquals(phoneCapability, phoneCapabilityUpdated);
}
+ public void testOnSetDisplayLayout() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = createSampleManager(iSDL);
+ OnRPCListener dlRpcListener = iSDL.rpcListeners.get(FunctionID.SET_DISPLAY_LAYOUT.getId()).get(0);
+ assertNotNull(dlRpcListener);
+
+ SetDisplayLayoutResponse newLayout = new SetDisplayLayoutResponse();
+ newLayout.setDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES);
+ newLayout.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
+ newLayout.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ newLayout.setPresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES);
+ newLayout.setSuccess(true);
+ newLayout.setResultCode(Result.SUCCESS);
+
+ dlRpcListener.onReceived(newLayout);
+
+
+ DisplayCapabilities appliedCaps = (DisplayCapabilities)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
+ assertNotNull(appliedCaps);
+ assertTrue(Validator.validateDisplayCapabilities(newLayout.getDisplayCapabilities(), appliedCaps));
+
+ List<DisplayCapability> convertedCaps = (List<DisplayCapability>)systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAYS);
+ assertNotNull(convertedCaps);
+ List<DisplayCapability> testCaps = createDisplayCapabilityList(newLayout.getDisplayCapabilities(), newLayout.getButtonCapabilities(), newLayout.getSoftButtonCapabilities());
+ assertTrue(Validator.validateDisplayCapabilityList(convertedCaps, testCaps));
+
+ WindowCapability matchWindowCapability = testCaps.get(0).getWindowCapabilities().get(0);
+ WindowCapability testWindowCapability = systemCapabilityManager.getDefaultMainWindowCapability();
+ assertTrue(Validator.validateWindowCapability(matchWindowCapability, testWindowCapability));
+ assertNull(systemCapabilityManager.getWindowCapability(42));
+ }
+
+ public void testManagerBeforeDisplayUpdate() {
+ InternalSDLInterface iSDL = new InternalSDLInterface();
+ SystemCapabilityManager systemCapabilityManager = new SystemCapabilityManager(iSDL);
+ assertNull(systemCapabilityManager.getDefaultMainWindowCapability());
+ assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue()));
+ assertNull(systemCapabilityManager.getWindowCapability(PredefinedWindows.PRIMARY_WIDGET.getValue()));
+ }
+
private class InternalSDLInterface implements ISdl{
private final Object RPC_LISTENER_LOCK = new Object();
SparseArray<CopyOnWriteArrayList<OnRPCListener>> rpcListeners = new SparseArray<>();
@@ -460,6 +594,8 @@ public class SystemCapabilityManagerTests extends AndroidTestCase2 {
@Override
public void startAudioService(boolean encrypted){}
+ @Override
+ public void startRPCEncryption() {}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
index 7b497310e..938c95dfd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/RPCConstructorsTests.java
@@ -308,6 +308,13 @@ public class RPCConstructorsTests extends AndroidTestCase2 {
// Find the getter method name by taking the param name, capitalize the first letter, then add thw word "get" to the beginning
// for example if the param name is "buttonName" the method name will be "getButtonName"
String getterMethodName = "get" + parameters.get(i).name.substring(0, 1).toUpperCase() + parameters.get(i).name.substring(1);
+
+ // --------------------------------------------- Exceptional cases ---------------------------------------------
+ if (rpcName.equals("CancelInteraction") && getterMethodName.equals("getFunctionID")){
+ getterMethodName = "getInteractionFunctionID";
+ }
+ // -------------------------------------------------------------------------------------------------------------
+
try {
Method getterMethod = aClass.getMethod(getterMethodName);
Object val = getterMethod.invoke(instance);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
index 524a6bde2..5351bf7a1 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/AudioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AudioControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -30,6 +34,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
msg.setEqualizerAvailable(Test.GENERAL_BOOLEAN);
msg.setVolumeAvailable(Test.GENERAL_BOOLEAN);
msg.setEqualizerMaxChannelId(Test.GENERAL_INT);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -44,6 +49,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
Boolean volumeAvailable = msg.getVolumeAvailable();
Boolean equalizerAvailable = msg.getEqualizerAvailable();
int equalizerMaxChannelId = msg.getEqualizerMaxChannelId();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
@@ -52,6 +58,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) volumeAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) equalizerAvailable);
assertEquals(Test.MATCH, Test.GENERAL_INT, equalizerMaxChannelId);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
AudioControlCapabilities msg = new AudioControlCapabilities();
@@ -63,6 +70,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getVolumeAvailable());
assertNull(Test.NULL, msg.getEqualizerAvailable());
assertNull(Test.NULL, msg.getEqualizerMaxChannelId());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -76,6 +84,7 @@ public class AudioControlCapabilitiesTests extends TestCase {
reference.put(AudioControlCapabilities.KEY_VOLUME_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(AudioControlCapabilities.KEY_EQUALIZER_MAX_CHANNEL_ID, Test.GENERAL_INT);
+ reference.put(AudioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -83,9 +92,15 @@ public class AudioControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
-
+ if (key.equals(AudioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
index 4365ceafa..71f7d3ecf 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ButtonCapabilitiesTests.java
@@ -1,15 +1,19 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -28,6 +32,7 @@ public class ButtonCapabilitiesTests extends TestCase{
msg.setName(Test.GENERAL_BUTTONNAME);
msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
@@ -40,12 +45,14 @@ public class ButtonCapabilitiesTests extends TestCase{
boolean longPress = msg.getLongPressAvailable();
boolean upDown = msg.getUpDownAvailable();
ButtonName buttonName = msg.getName();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shortPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, longPress);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, upDown);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, buttonName);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
ButtonCapabilities msg = new ButtonCapabilities();
@@ -65,15 +72,24 @@ public class ButtonCapabilitiesTests extends TestCase{
reference.put(ButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ButtonCapabilities.KEY_NAME, Test.GENERAL_BUTTONNAME);
+ reference.put(ButtonCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(ButtonCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
index c391eb4eb..a33f35b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlCapabilitiesTests.java
@@ -1,10 +1,13 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ClimateControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
@@ -13,6 +16,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -44,6 +48,8 @@ public class ClimateControlCapabilitiesTests extends TestCase{
msg.setHeatedWindshieldAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedRearWindowAvailable(Test.GENERAL_BOOLEAN);
msg.setHeatedMirrorsAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setClimateEnableAvailable(Test.GENERAL_BOOLEAN);
}
/**
@@ -67,6 +73,8 @@ public class ClimateControlCapabilitiesTests extends TestCase{
boolean heatedWindshieldAvailable = msg.getHeatedWindshieldAvailable();
boolean heatedRearWindowAvailable = msg.getHeatedRearWindowAvailable();
boolean heatedMirrorsAvailable = msg.getHeatedMirrorsAvailable();
+ ModuleInfo info = msg.getModuleInfo();
+ boolean climateEnableAvailable = msg.getClimateEnableAvailable();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
@@ -79,6 +87,7 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, dualModeEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, defrostZoneAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, ventilationModeAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertEquals(Test.MATCH, Test.GENERAL_DEFROSTZONE_LIST.size(), defrostZone.size());
assertEquals(Test.MATCH, Test.GENERAL_VENTILATIONMODE_LIST.size(), ventilationMode.size());
@@ -94,6 +103,8 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedWindshieldAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedRearWindowAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedMirrorsAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, climateEnableAvailable);
+
// Invalid/Null Tests
ClimateControlCapabilities msg = new ClimateControlCapabilities();
assertNotNull(Test.NOT_NULL, msg);
@@ -113,6 +124,8 @@ public class ClimateControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHeatedWindshieldAvailable());
assertNull(Test.NULL, msg.getHeatedRearWindowAvailable());
assertNull(Test.NULL, msg.getHeatedMirrorsAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
+ assertNull(Test.NULL, msg.getClimateEnableAvailable());
}
public void testJson(){
@@ -135,6 +148,8 @@ public class ClimateControlCapabilitiesTests extends TestCase{
reference.put(ClimateControlCapabilities.KEY_HEATED_WIND_SHIELD_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_REAR_WINDOW_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlCapabilities.KEY_HEATED_MIRRORS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(ClimateControlCapabilities.KEY_CLIMATE_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -169,6 +184,12 @@ public class ClimateControlCapabilitiesTests extends TestCase{
ventilationModeListTest.add( (VentilationMode)ventilationModeArrayTest.get(index) );
}
assertTrue(Test.TRUE, ventilationModeListReference.containsAll(ventilationModeListTest) && ventilationModeListTest.containsAll(ventilationModeListReference));
+ } else if (key.equals(ClimateControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
index 99d5c3285..7aeeb76cd 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ClimateControlDataTests.java
@@ -43,6 +43,7 @@ public class ClimateControlDataTests extends TestCase{
msg.setHeatedWindshieldEnable(Test.GENERAL_BOOLEAN);
msg.setHeatedRearWindowEnable(Test.GENERAL_BOOLEAN);
msg.setHeatedMirrorsEnable(Test.GENERAL_BOOLEAN);
+ msg.setClimateEnable(Test.GENERAL_BOOLEAN);
}
/**
@@ -64,6 +65,7 @@ public class ClimateControlDataTests extends TestCase{
boolean heatedWindshieldEnable = msg.getHeatedWindshieldEnable();
boolean heatedRearWindowEnable = msg.getHeatedRearWindowEnable();
boolean heatedMirrorsEnable = msg.getHeatedMirrorsEnable();
+ boolean climateEnable = msg.getClimateEnable();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_INT, fanSpeed);
@@ -80,6 +82,7 @@ public class ClimateControlDataTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedWindshieldEnable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedRearWindowEnable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, heatedMirrorsEnable);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, climateEnable);
// Invalid/Null Tests
ClimateControlData msg = new ClimateControlData();
@@ -99,6 +102,7 @@ public class ClimateControlDataTests extends TestCase{
assertNull(Test.NULL, msg.getHeatedWindshieldEnable());
assertNull(Test.NULL, msg.getHeatedRearWindowEnable());
assertNull(Test.NULL, msg.getHeatedMirrorsEnable());
+ assertNull(Test.NULL, msg.getClimateEnable());
}
public void testJson(){
@@ -119,6 +123,7 @@ public class ClimateControlDataTests extends TestCase{
reference.put(ClimateControlData.KEY_HEATED_WIND_SHIELD_ENABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlData.KEY_HEATED_REAR_WINDOW_ENABLE, Test.GENERAL_BOOLEAN);
reference.put(ClimateControlData.KEY_HEATED_MIRRORS_ENABLE, Test.GENERAL_BOOLEAN);
+ reference.put(ClimateControlData.KEY_CLIMATE_ENABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
index f7fcb45e3..4f0256f79 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilitiesTests.java
@@ -23,7 +23,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.DisplayCapabilities}
+ * {@link com.smartdevicelink.proxy.rpc.DisplayCapabilities}
*/
public class DisplayCapabilitiesTests extends TestCase{
@@ -58,7 +58,7 @@ public class DisplayCapabilitiesTests extends TestCase{
List<MediaClockFormat> mediaClock = msg.getMediaClockFormats();
List<TextField> textFields = msg.getTextFields();
List<ImageField> imageFields = msg.getImageFields();
-
+
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, graphicSupported);
assertEquals(Test.MATCH, Test.GENERAL_INT, numPresets);
@@ -69,7 +69,7 @@ public class DisplayCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_MEDIACLOCKFORMAT_LIST.size(), mediaClock.size());
assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
-
+
for(int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++){
assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
}
@@ -85,6 +85,7 @@ public class DisplayCapabilitiesTests extends TestCase{
for(int i = 0; i < Test.GENERAL_IMAGEFIELD_LIST.size(); i++){
assertTrue(Test.TRUE, Validator.validateImageFields(Test.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
}
+
// Invalid/Null Tests
DisplayCapabilities msg = new DisplayCapabilities();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
new file mode 100644
index 000000000..6bb57761f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/DisplayCapabilityTests.java
@@ -0,0 +1,111 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DisplayCapability}
+ */
+public class DisplayCapabilityTests extends TestCase {
+
+ private DisplayCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new DisplayCapability();
+
+ msg.setDisplayName(Test.GENERAL_STRING);
+ msg.setWindowTypeSupported(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST);
+ msg.setWindowCapabilities(Test.GENERAL_WINDOW_CAPABILITY_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ String displayName = msg.getDisplayName();
+ List<WindowTypeCapabilities> windowTypeSupported = msg.getWindowTypeSupported();
+ List<WindowCapability> windowCapabilities = msg.getWindowCapabilities();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, displayName);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(), windowTypeSupported.size());
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOW_CAPABILITY_LIST.size(), windowCapabilities.size());
+
+ for (int i = 0; i < Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(Test.GENERAL_WINDOW_TYPE_CAPABILITIES_LIST.get(i), windowTypeSupported.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_WINDOW_CAPABILITY_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateWindowCapability(Test.GENERAL_WINDOW_CAPABILITY_LIST.get(i), windowCapabilities.get(i)));
+ }
+
+ // Invalid/Null Tests
+ DisplayCapability msg = new DisplayCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getDisplayName());
+ assertNull(Test.NULL, msg.getWindowTypeSupported());
+ assertNull(Test.NULL, msg.getWindowCapabilities());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(DisplayCapability.KEY_DISPLAY_NAME, Test.GENERAL_STRING);
+ reference.put(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED, Test.JSON_WINDOW_TYPE_CAPABILITIES_LIST);
+ reference.put(DisplayCapability.KEY_WINDOW_CAPABILITIES, Test.JSON_WINDOW_CAPABILITIES);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ if (key.equals(DisplayCapability.KEY_WINDOW_TYPE_SUPPORTED)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateWindowTypeCapabilities(new WindowTypeCapabilities(hashReference), new WindowTypeCapabilities(hashTest)));
+ }
+ } else if (key.equals(DisplayCapability.KEY_WINDOW_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateWindowCapability(new WindowCapability(hashReference), new WindowCapability(hashTest)));
+ }
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
index 1c9e4986b..357e178c0 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GPSDataTests.java
@@ -43,6 +43,7 @@ public class GPSDataTests extends TestCase{
msg.setUtcSeconds(Test.GENERAL_INT);
msg.setUtcYear(Test.GENERAL_INT);
msg.setVdop(Test.GENERAL_DOUBLE);
+ msg.setShifted(Test.GENERAL_BOOLEAN);
}
/**
@@ -68,6 +69,7 @@ public class GPSDataTests extends TestCase{
int satellites = msg.getSatellites();
Dimension dimension = msg.getDimension();
CompassDirection direction = msg.getCompassDirection();
+ boolean shifted = msg.getShifted();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, actual);
@@ -88,6 +90,7 @@ public class GPSDataTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_INT, satellites);
assertEquals(Test.MATCH, Test.GENERAL_DIMENSION, dimension);
assertEquals(Test.MATCH, Test.GENERAL_COMPASSDIRECTION, direction);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, shifted);
// Invalid/Null Tests
GPSData msg = new GPSData();
@@ -111,6 +114,7 @@ public class GPSDataTests extends TestCase{
assertNull(Test.NULL, msg.getUtcSeconds());
assertNull(Test.NULL, msg.getUtcYear());
assertNull(Test.NULL, msg.getVdop());
+ assertNull(Test.NULL, msg.getShifted());
}
public void testJson(){
@@ -135,6 +139,7 @@ public class GPSDataTests extends TestCase{
reference.put(GPSData.KEY_SATELLITES, Test.GENERAL_INT);
reference.put(GPSData.KEY_DIMENSION, Test.GENERAL_DIMENSION);
reference.put(GPSData.KEY_COMPASS_DIRECTION, Test.GENERAL_COMPASSDIRECTION);
+ reference.put(GPSData.KEY_SHIFTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -148,4 +153,4 @@ public class GPSDataTests extends TestCase{
fail(Test.JSON_FAIL);
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
new file mode 100644
index 000000000..1d9bccf92
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/GridTests.java
@@ -0,0 +1,100 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class GridTests extends TestCase {
+
+ private Grid msg;
+
+ @Override
+ public void setUp() {
+ msg = new Grid();
+ msg.setCol(Test.GENERAL_INT);
+ msg.setRow(Test.GENERAL_INT);
+ msg.setLevel(Test.GENERAL_INT);
+ msg.setColSpan(Test.GENERAL_INT);
+ msg.setRowSpan(Test.GENERAL_INT);
+ msg.setLevelSpan(Test.GENERAL_INT);
+ }
+
+ public void testRpcValues() {
+ int col = msg.getCol();
+ int row = msg.getRow();
+ int level = msg.getLevel();
+ int colSpan = msg.getColSpan();
+ int rowSpan = msg.getRowSpan();
+ int levelSpan = msg.getLevelSpan();
+
+ //valid tests
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, colSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, rowSpan, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, levelSpan, Test.GENERAL_INT);
+
+ //null tests
+ Grid msg = new Grid();
+ assertNull(Test.NULL, msg.getCol());
+ assertNull(Test.NULL, msg.getRow());
+ assertNull(Test.NULL, msg.getLevel());
+ assertNull(Test.NULL, msg.getColSpan());
+ assertNull(Test.NULL, msg.getRowSpan());
+ assertNull(Test.NULL, msg.getLevelSpan());
+
+ //test required constructor
+ Grid msg2 = new Grid(Test.GENERAL_INT, Test.GENERAL_INT);
+ int row2 = msg2.getRow();
+ int col2 = msg2.getCol();
+ assertEquals(Test.MATCH, col2, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, row2, Test.GENERAL_INT);
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(Grid.KEY_COL, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL, Test.GENERAL_INT);
+ original.put(Grid.KEY_COL_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_ROW_SPAN, Test.GENERAL_INT);
+ original.put(Grid.KEY_LEVEL_SPAN, Test.GENERAL_INT);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ Grid grid1, grid2;
+ while (iter.hasNext()) {
+ key = iter.next();
+ grid1 = new Grid(JsonRPCMarshaller.deserializeJSONObject(original));
+ grid2 = new Grid(JsonRPCMarshaller.deserializeJSONObject(serialized));
+ if (key.equals(Grid.KEY_COL)) {
+ assertEquals(Test.MATCH, grid1.getCol(), grid2.getCol());
+ } else if (key.equals(Grid.KEY_ROW)) {
+ assertEquals(Test.MATCH, grid1.getRow(), grid2.getRow());
+ } else if (key.equals(Grid.KEY_LEVEL)) {
+ assertEquals(Test.MATCH, grid1.getLevel(), grid2.getLevel());
+ } else if (key.equals(Grid.KEY_COL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getColSpan(), grid2.getColSpan());
+ } else if (key.equals(Grid.KEY_ROW_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getRowSpan(), grid2.getRowSpan());
+ } else if (key.equals(Grid.KEY_LEVEL_SPAN)) {
+ assertEquals(Test.MATCH, grid1.getLevelSpan(), grid2.getLevelSpan());
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
index 620868b40..aa49bf0ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/HMISettingsControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.HMISettingsControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -27,6 +31,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
msg.setDistanceUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setTemperatureUnitAvailable(Test.GENERAL_BOOLEAN);
msg.setDisplayModeUnitAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -38,12 +43,14 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Boolean distanceUnitAvailable = msg.getDistanceUnitAvailable();
Boolean temperatureUnitAvailable = msg.getTemperatureUnitAvailable();
Boolean displayModeUnitAvailable = msg.getDisplayModeUnitAvailable();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) distanceUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) temperatureUnitAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, (boolean) displayModeUnitAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
// Invalid/Null Tests
HMISettingsControlCapabilities msg = new HMISettingsControlCapabilities();
@@ -53,6 +60,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getDistanceUnitAvailable());
assertNull(Test.NULL, msg.getTemperatureUnitAvailable());
assertNull(Test.NULL, msg.getDisplayModeUnitAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -63,6 +71,7 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
reference.put(HMISettingsControlCapabilities.KEY_DISTANCE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_TEMPERATURE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(HMISettingsControlCapabilities.KEY_DISPLAY_MODE_UNIT_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(HMISettingsControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -70,8 +79,15 @@ public class HMISettingsControlCapabilitiesTests extends TestCase {
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(HMISettingsControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
index 2609acd37..68baaba62 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ImageResolutionTests.java
@@ -67,4 +67,26 @@ public class ImageResolutionTests extends TestCase{
fail(Test.JSON_FAIL);
}
}
+
+ public void testSetResolutionWidth_Odd() {
+ msg.setResolutionWidth(175);
+ assertEquals(176, (int)msg.getResolutionWidth());
+ }
+
+ public void testSetResolutionHeight_Odd() {
+ msg.setResolutionHeight(175);
+ assertEquals(176, (int)msg.getResolutionHeight());
+ }
+
+ public void testSetResolutionWidth_Pair() {
+ msg.setResolutionWidth(176);
+ assertEquals(176, (int)msg.getResolutionWidth());
+
+ }
+
+ public void testSetResolutionHeight_Pair() {
+ msg.setResolutionHeight(176);
+ assertEquals(176, (int)msg.getResolutionHeight());
+
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
index da6b52899..9d627258b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/KeyboardPropertiesTests.java
@@ -18,7 +18,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.KeyboardProperties}
+ * {@link com.smartdevicelink.proxy.rpc.KeyboardProperties}
*/
public class KeyboardPropertiesTests extends TestCase{
@@ -29,6 +29,7 @@ public class KeyboardPropertiesTests extends TestCase{
msg = new KeyboardProperties();
msg.setAutoCompleteText(Test.GENERAL_STRING);
+ msg.setAutoCompleteList(Test.GENERAL_STRING_LIST);
msg.setKeyboardLayout(Test.GENERAL_KEYBOARDLAYOUT);
msg.setKeypressMode(Test.GENERAL_KEYPRESSMODE);
msg.setLanguage(Test.GENERAL_LANGUAGE);
@@ -40,14 +41,17 @@ public class KeyboardPropertiesTests extends TestCase{
*/
public void testRpcValues () {
// Test Values
- String autoComplete = msg.getAutoCompleteText();
+ String autoCompleteText = msg.getAutoCompleteText();
+ List<String> autoCompleteList = msg.getAutoCompleteList();
KeyboardLayout keyboardLayout = msg.getKeyboardLayout();
KeypressMode keypressMode = msg.getKeypressMode();
Language language = msg.getLanguage();
List<String> limitedChars = msg.getLimitedCharacterList();
// Valid Tests
- assertEquals(Test.MATCH, Test.GENERAL_STRING, autoComplete);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, autoCompleteText);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), autoCompleteList.size());
+ assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, autoCompleteList));
assertEquals(Test.MATCH, Test.GENERAL_KEYBOARDLAYOUT, keyboardLayout);
assertEquals(Test.MATCH, Test.GENERAL_KEYPRESSMODE, keypressMode);
assertEquals(Test.MATCH, Test.GENERAL_LANGUAGE, language);
@@ -60,8 +64,8 @@ public class KeyboardPropertiesTests extends TestCase{
// Keypress mode is created in the object constructor
assertNotNull(Test.NOT_NULL, msg.getKeypressMode());
-
assertNull(Test.NULL, msg.getAutoCompleteText());
+ assertNull(Test.NULL, msg.getAutoCompleteList());
assertNull(Test.NULL, msg.getLanguage());
assertNull(Test.NULL, msg.getKeyboardLayout());
assertNull(Test.NULL, msg.getLimitedCharacterList());
@@ -72,6 +76,7 @@ public class KeyboardPropertiesTests extends TestCase{
try{
reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_TEXT, Test.GENERAL_STRING);
+ reference.put(KeyboardProperties.KEY_AUTO_COMPLETE_LIST, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
reference.put(KeyboardProperties.KEY_KEYBOARD_LAYOUT, Test.GENERAL_KEYBOARDLAYOUT);
reference.put(KeyboardProperties.KEY_KEYPRESS_MODE, Test.GENERAL_KEYPRESSMODE);
reference.put(KeyboardProperties.KEY_LANGUAGE, Test.GENERAL_LANGUAGE);
@@ -83,7 +88,7 @@ public class KeyboardPropertiesTests extends TestCase{
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- if(key.equals(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST)){
+ if(key.equals(KeyboardProperties.KEY_LIMITED_CHARACTER_LIST) || key.equals(KeyboardProperties.KEY_AUTO_COMPLETE_LIST)){
assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
index 4ebd7f467..ad6e5a4ac 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/LightControlCapabilitiesTests.java
@@ -3,6 +3,7 @@ package com.smartdevicelink.test.rpc.datatypes;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.LightCapabilities;
import com.smartdevicelink.proxy.rpc.LightControlCapabilities;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
import com.smartdevicelink.test.Validator;
@@ -13,6 +14,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +32,7 @@ public class LightControlCapabilitiesTests extends TestCase {
msg.setModuleName(Test.GENERAL_STRING);
msg.setSupportedLights(Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
}
/**
@@ -39,10 +42,12 @@ public class LightControlCapabilitiesTests extends TestCase {
// Test Values
String moduleName = msg.getModuleName();
List<LightCapabilities> supportedLights = msg.getSupportedLights();
+ ModuleInfo info = msg.getModuleInfo();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleName);
assertEquals(Test.MATCH, Test.GENERAL_LIGHTCAPABILITIES_LIST.size(), supportedLights.size());
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
assertTrue(Test.TRUE, Validator.validateLightCapabilitiesList(Test.GENERAL_LIGHTCAPABILITIES_LIST, supportedLights));
@@ -52,6 +57,7 @@ public class LightControlCapabilitiesTests extends TestCase {
assertNull(Test.NULL, msg.getModuleName());
assertNull(Test.NULL, msg.getSupportedLights());
+ assertNull(Test.NULL, msg.getModuleInfo());
}
public void testJson() {
@@ -60,6 +66,7 @@ public class LightControlCapabilitiesTests extends TestCase {
try {
reference.put(LightControlCapabilities.KEY_MODULE_NAME, Test.GENERAL_STRING);
reference.put(LightControlCapabilities.KEY_SUPPORTED_LIGHTS, Test.GENERAL_LIGHTCAPABILITIES_LIST);
+ reference.put(LightControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -75,7 +82,14 @@ public class LightControlCapabilitiesTests extends TestCase {
for (LightCapabilities lc : lcReference) {
assertTrue(Validator.validateLightCapabilities(lc, new LightCapabilities(JsonRPCMarshaller.deserializeJSONObject(lsArray.getJSONObject(i++)))));
}
- } else {
+ } else if(key.equals(LightControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ }
+ else {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
index 2b4c352c5..2883fca6b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/MediaServiceDataTests.java
@@ -1,15 +1,19 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.MediaServiceData;
import com.smartdevicelink.proxy.rpc.enums.MediaType;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -28,6 +32,7 @@ public class MediaServiceDataTests extends TestCase {
msg.setMediaTitle(Test.GENERAL_STRING);
msg.setMediaArtist(Test.GENERAL_STRING);
msg.setMediaAlbum(Test.GENERAL_STRING);
+ msg.setMediaImage(Test.GENERAL_IMAGE);
msg.setPlaylistName(Test.GENERAL_STRING);
msg.setIsExplicit(Test.GENERAL_BOOLEAN);
msg.setTrackPlaybackProgress(Test.GENERAL_INTEGER);
@@ -47,6 +52,7 @@ public class MediaServiceDataTests extends TestCase {
String mediaTitle = msg.getMediaTitle();
String mediaArtist = msg.getMediaArtist();
String mediaAlbum = msg.getMediaAlbum();
+ Image mediaImage = msg.getMediaImage();
String playlistName = msg.getPlaylistName();
boolean isExplicit = msg.getIsExplicit();
Integer trackPlaybackProgress = msg.getTrackPlaybackProgress();
@@ -61,6 +67,7 @@ public class MediaServiceDataTests extends TestCase {
assertEquals(Test.GENERAL_STRING, mediaTitle);
assertEquals(Test.GENERAL_STRING, mediaArtist);
assertEquals(Test.GENERAL_STRING, mediaAlbum);
+ assertEquals(Test.GENERAL_IMAGE, mediaImage);
assertEquals(Test.GENERAL_STRING, playlistName);
assertEquals(Test.GENERAL_BOOLEAN, isExplicit);
assertEquals(Test.GENERAL_INTEGER, trackPlaybackProgress);
@@ -78,6 +85,7 @@ public class MediaServiceDataTests extends TestCase {
assertNull(Test.NULL, msg.getMediaTitle());
assertNull(Test.NULL, msg.getMediaArtist());
assertNull(Test.NULL, msg.getMediaAlbum());
+ assertNull(Test.NULL, msg.getMediaImage());
assertNull(Test.NULL, msg.getPlaylistName());
assertNull(Test.NULL, msg.getIsExplicit());
assertNull(Test.NULL, msg.getTrackPlaybackProgress());
@@ -96,6 +104,7 @@ public class MediaServiceDataTests extends TestCase {
reference.put(MediaServiceData.KEY_MEDIA_TITLE, Test.GENERAL_STRING);
reference.put(MediaServiceData.KEY_MEDIA_ARTIST, Test.GENERAL_STRING);
reference.put(MediaServiceData.KEY_MEDIA_ALBUM, Test.GENERAL_STRING);
+ reference.put(MediaServiceData.KEY_MEDIA_IMAGE, Test.GENERAL_IMAGE);
reference.put(MediaServiceData.KEY_PLAYLIST_NAME, Test.GENERAL_STRING);
reference.put(MediaServiceData.KEY_IS_EXPLICIT, Test.GENERAL_BOOLEAN);
reference.put(MediaServiceData.KEY_TRACK_PLAYBACK_PROGRESS, Test.GENERAL_INTEGER);
@@ -111,7 +120,14 @@ public class MediaServiceDataTests extends TestCase {
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+
+ if (key.equals(MediaServiceData.KEY_MEDIA_IMAGE)){
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, new Image(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
index b553587ad..7f4a78b27 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleDataTests.java
@@ -39,6 +39,7 @@ public class ModuleDataTests extends TestCase {
msg.setAudioControlData(Test.GENERAL_AUDIOCONTROLDATA);
msg.setHmiSettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA);
msg.setLightControlData(Test.GENERAL_LIGHTCONTROLDATA);
+ msg.setModuleId(Test.GENERAL_STRING);
}
/**
@@ -53,6 +54,7 @@ public class ModuleDataTests extends TestCase {
AudioControlData audioControlData = msg.getAudioControlData();
HMISettingsControlData hmiSettingsControlData = msg.getHmiSettingsControlData();
LightControlData lightControlData = msg.getLightControlData();
+ String moduleId = msg.getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, moduleType);
@@ -62,6 +64,7 @@ public class ModuleDataTests extends TestCase {
assertTrue(Test.TRUE, Validator.validateAudioControlData(Test.GENERAL_AUDIOCONTROLDATA, audioControlData));
assertTrue(Test.TRUE, Validator.validateHMISettingsControlData(Test.GENERAL_HMISETTINGSCONTROLDATA, hmiSettingsControlData));
assertTrue(Test.TRUE, Validator.validateLightControlData(Test.GENERAL_LIGHTCONTROLDATA, lightControlData));
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, moduleId);
// Invalid/Null Tests
ModuleData msg = new ModuleData();
@@ -74,6 +77,7 @@ public class ModuleDataTests extends TestCase {
assertNull(Test.NULL, msg.getAudioControlData());
assertNull(Test.NULL, msg.getHmiSettingsControlData());
assertNull(Test.NULL, msg.getLightControlData());
+ assertNull(Test.NULL, msg.getModuleId());
}
public void testJson() {
@@ -87,6 +91,7 @@ public class ModuleDataTests extends TestCase {
reference.put(ModuleData.KEY_AUDIO_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_AUDIOCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_HMI_SETTINGS_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_HMISETTINGSCONTROLDATA.getStore()));
reference.put(ModuleData.KEY_LIGHT_CONTROL_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_LIGHTCONTROLDATA.getStore()));
+ reference.put(ModuleData.KEY_MODULE_ID, Test.GENERAL_STRING);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
new file mode 100644
index 000000000..282e43b4f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/ModuleInfoTests.java
@@ -0,0 +1,70 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ModuleInfoTests extends TestCase {
+ private ModuleInfo msg;
+
+ @Override
+ public void setUp() {
+ msg = new ModuleInfo();
+ msg.setModuleId(Test.GENERAL_STRING);
+ msg.setModuleLocation(Test.GENERAL_GRID);
+ msg.setModuleServiceArea(Test.GENERAL_GRID);
+ msg.setMultipleAccessAllowance(Test.GENERAL_BOOLEAN);
+ }
+
+ public void testRpcValues() {
+ String id = msg.getModuleId();
+ Grid loc = msg.getModuleLocation();
+ Grid area = msg.getModuleServiceArea();
+ boolean isAllowed = msg.getMultipleAccessAllowance();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, loc);
+ assertEquals(Test.MATCH, Test.GENERAL_GRID, area);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isAllowed);
+
+ //null test
+ ModuleInfo msg = new ModuleInfo();
+ assertNull(Test.NULL, msg.getModuleId());
+ assertNull(Test.NULL, msg.getModuleLocation());
+ assertNull(Test.NULL, msg.getModuleServiceArea());
+ assertNull(Test.NULL, msg.getMultipleAccessAllowance());
+
+ //test required params constructor
+ ModuleInfo msg2 = new ModuleInfo(Test.GENERAL_STRING);
+ assertEquals(Test.MATCH, msg2.getModuleId(), Test.GENERAL_STRING);
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(ModuleInfo.KEY_MODULE_ID, Test.GENERAL_STRING);
+ original.put(ModuleInfo.KEY_MODULE_LOCATION, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MODULE_SERVICE_AREA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_GRID.getStore()));
+ original.put(ModuleInfo.KEY_MULTIPLE_ACCESS_ALLOWED, Test.GENERAL_BOOLEAN);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(Test.MATCH, original.length(), serialized.length());
+
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(original);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(serialized);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
index 5fc144fea..491803317 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/PermissionItemTest.java
@@ -29,6 +29,7 @@ public class PermissionItemTest extends TestCase {
msg.setRpcName(Test.GENERAL_STRING);
msg.setHMIPermissions(Test.GENERAL_HMIPERMISSIONS);
msg.setParameterPermissions(Test.GENERAL_PARAMETERPERMISSIONS);
+ msg.setRequireEncryption(Test.GENERAL_BOOLEAN);
}
/**
@@ -39,11 +40,13 @@ public class PermissionItemTest extends TestCase {
String rpcName = msg.getRpcName();
HMIPermissions hmiPermissions = msg.getHMIPermissions();
ParameterPermissions parameterPermissions = msg.getParameterPermissions();
+ boolean isEncryptionRequired = msg.getRequireEncryption();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, rpcName);
assertTrue(Test.TRUE, Validator.validateHmiPermissions(Test.GENERAL_HMIPERMISSIONS, hmiPermissions));
assertTrue(Test.TRUE, Validator.validateParameterPermissions(Test.GENERAL_PARAMETERPERMISSIONS, parameterPermissions));
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isEncryptionRequired);
// Invalid/Null Tests
PermissionItem msg = new PermissionItem();
@@ -52,6 +55,7 @@ public class PermissionItemTest extends TestCase {
assertNull(Test.NULL, msg.getRpcName());
assertNull(Test.NULL, msg.getHMIPermissions());
assertNull(Test.NULL, msg.getParameterPermissions());
+ assertNull(Test.NULL, msg.getRequireEncryption());
}
public void testJson() {
@@ -61,6 +65,7 @@ public class PermissionItemTest extends TestCase {
reference.put(PermissionItem.KEY_RPC_NAME, Test.GENERAL_STRING);
reference.put(PermissionItem.KEY_HMI_PERMISSIONS, Test.JSON_HMIPERMISSIONS);
reference.put(PermissionItem.KEY_PARAMETER_PERMISSIONS, Test.JSON_PARAMETERPERMISSIONS);
+ reference.put(PermissionItem.KEY_REQUIRE_ENCRYPTION, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -73,6 +78,8 @@ public class PermissionItemTest extends TestCase {
assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
} else if (key.equals(PermissionItem.KEY_PARAMETER_PERMISSIONS)) {
assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else if (key.equals(PermissionItem.KEY_REQUIRE_ENCRYPTION)) {
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(reference, key), JsonUtils.readBooleanFromJsonObject(underTest, key));
} else {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
index 915e779a7..a65a7deef 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlCapabilitiesTests.java
@@ -1,14 +1,18 @@
package com.smartdevicelink.test.rpc.datatypes;
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ModuleInfo;
import com.smartdevicelink.proxy.rpc.RadioControlCapabilities;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
import org.json.JSONException;
import org.json.JSONObject;
+import java.util.Hashtable;
import java.util.Iterator;
/**
@@ -36,6 +40,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
msg.setHdRadioEnableAvailable(Test.GENERAL_BOOLEAN);
msg.setSiriusXMRadioAvailable(Test.GENERAL_BOOLEAN);
msg.setSisDataAvailable(Test.GENERAL_BOOLEAN);
+ msg.setModuleInfo(Test.GENERAL_MODULE_INFO);
+ msg.setAvailableHdChannelsAvailable(Test.GENERAL_BOOLEAN);
}
/**
@@ -56,6 +62,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
boolean hdRadioEnableAvailable = msg.getHdRadioEnableAvailable();
boolean siriusXMRadioAvailable = msg.getSiriusXMRadioAvailable();
boolean sisDataAvailable = msg.getSisDataAvailable();
+ ModuleInfo info = msg.getModuleInfo();
+ boolean availableHdChannelsAvailable = msg.getAvailableHdChannelsAvailable();
// Valid Tests
@@ -72,6 +80,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnableAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, siriusXMRadioAvailable);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, sisDataAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULE_INFO, info);
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, availableHdChannelsAvailable);
// Invalid/Null Tests
RadioControlCapabilities msg = new RadioControlCapabilities();
@@ -90,6 +100,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
assertNull(Test.NULL, msg.getHdRadioEnableAvailable());
assertNull(Test.NULL, msg.getSiriusXMRadioAvailable());
assertNull(Test.NULL, msg.getSisDataAvailable());
+ assertNull(Test.NULL, msg.getModuleInfo());
+ assertNull(Test.NULL, msg.getAvailableHdChannelsAvailable());
}
public void testJson(){
@@ -109,6 +121,8 @@ public class RadioControlCapabilitiesTests extends TestCase{
reference.put(RadioControlCapabilities.KEY_HD_RADIO_ENABLE_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIRIUS_XM_RADIO_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlCapabilities.KEY_SIS_DATA_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(RadioControlCapabilities.KEY_MODULE_INFO, Test.JSON_MODULE_INFO);
+ reference.put(RadioControlCapabilities.KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -116,8 +130,15 @@ public class RadioControlCapabilitiesTests extends TestCase{
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
-
- assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ if (key.equals(RadioControlCapabilities.KEY_MODULE_INFO)) {
+ JSONObject o1 = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject o2 = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(o1);
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(o2);
+ assertTrue(Test.TRUE, Validator.validateModuleInfo(new ModuleInfo(h1), new ModuleInfo(h2)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
}
} catch(JSONException e){
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
index a560827c4..6094b505a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/RadioControlDataTests.java
@@ -17,6 +17,7 @@ import org.json.JSONObject;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -42,6 +43,7 @@ public class RadioControlDataTests extends TestCase{
msg.setState(Test.GENERAL_RADIOSTATE);
msg.setHdRadioEnable(Test.GENERAL_BOOLEAN);
msg.setSisData(Test.GENERAL_SISDATA);
+ msg.setAvailableHdChannels(Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
}
/**
@@ -61,6 +63,7 @@ public class RadioControlDataTests extends TestCase{
RadioState state = msg.getState();
boolean hdRadioEnable = msg.getHdRadioEnable();
SisData sisData = msg.getSisData();
+ List<Integer> availableHdChannels = msg.getAvailableHdChannels();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_INT, frequencyInteger);
@@ -75,6 +78,7 @@ public class RadioControlDataTests extends TestCase{
assertEquals(Test.MATCH, Test.GENERAL_RADIOSTATE, state);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, hdRadioEnable);
assertTrue(Test.TRUE, Validator.validateSisData(Test.GENERAL_SISDATA, sisData));
+ assertEquals(Test.MATCH, Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST, availableHdChannels);
// Invalid/Null Tests
RadioControlData msg = new RadioControlData();
@@ -92,6 +96,7 @@ public class RadioControlDataTests extends TestCase{
assertNull(Test.NULL, msg.getState());
assertNull(Test.NULL, msg.getHdRadioEnable());
assertNull(Test.NULL, msg.getSisData());
+ assertNull(Test.NULL, msg.getAvailableHdChannels());
}
public void testJson(){
@@ -110,6 +115,7 @@ public class RadioControlDataTests extends TestCase{
reference.put(RadioControlData.KEY_STATE, Test.GENERAL_RADIOSTATE);
reference.put(RadioControlData.KEY_HD_RADIO_ENABLE, Test.GENERAL_BOOLEAN);
reference.put(RadioControlData.KEY_SIS_DATA, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_SISDATA.getStore()));
+ reference.put(RadioControlData.KEY_AVAILABLE_HD_CHANNELS, Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -130,6 +136,10 @@ public class RadioControlDataTests extends TestCase{
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
assertTrue(Test.TRUE, Validator.validateSisData(new SisData(hashReference), new SisData(hashTest)));
+ } else if(key.equals(RadioControlData.KEY_AVAILABLE_HD_CHANNELS)){
+ List<Integer> list1 = Test.GENERAL_AVAILABLE_HD_CHANNELS_LIST;
+ List<Integer> list2 = JsonUtils.readIntegerListFromJsonObject(underTest, key);
+ assertTrue(Test.TRUE, Validator.validateIntegerList(list1,list2));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
new file mode 100644
index 000000000..847564adb
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationCapabilityTests.java
@@ -0,0 +1,99 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.proxy.rpc.SeatLocationCapability;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+public class SeatLocationCapabilityTests extends TestCase {
+
+ private SeatLocationCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocationCapability();
+ msg.setCols(Test.GENERAL_INT);
+ msg.setRows(Test.GENERAL_INT);
+ msg.setLevels(Test.GENERAL_INT);
+ msg.setSeats(Test.GENERAL_SEAT_LIST);
+ }
+
+ public void testRpcValues() {
+ int row = msg.getRows();
+ int col = msg.getCols();
+ int level = msg.getLevels();
+ List<SeatLocation> seats = msg.getSeatLocations();
+
+ //valid tests
+ assertEquals(Test.MATCH, row, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, col, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, level, Test.GENERAL_INT);
+ assertEquals(Test.MATCH, seats.size(), Test.GENERAL_SEAT_LIST.size());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateGrid(Test.GENERAL_SEAT_LIST.get(i).getGrid(), seats.get(i).getGrid()));
+ }
+
+ //null tests
+ SeatLocationCapability msg = new SeatLocationCapability();
+ assertNull(Test.NULL, msg.getCols());
+ assertNull(Test.NULL, msg.getRows());
+ assertNull(Test.NULL, msg.getLevels());
+ assertNull(Test.NULL, msg.getSeatLocations());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocationCapability.KEY_COLS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_ROWS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_LEVELS, Test.GENERAL_INT);
+ original.put(SeatLocationCapability.KEY_SEATS, Test.JSON_SEAT_LOCATIONS);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+
+ Iterator<String> iter = original.keys();
+ String key = "";
+ while (iter.hasNext()) {
+ key = iter.next();
+ if (key.equals(SeatLocationCapability.KEY_COLS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getCols();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getCols();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_ROWS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getRows();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getRows();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_LEVELS)) {
+ int i1 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(original)).getLevels();
+ int i2 = new SeatLocationCapability(JsonRPCMarshaller.deserializeJSONObject(serialized)).getLevels();
+ assertEquals(Test.MATCH, i1, i2);
+ } else if (key.equals(SeatLocationCapability.KEY_SEATS)) {
+ JSONArray arr1 = JsonUtils.readJsonArrayFromJsonObject(original, key);
+ JSONArray arr2 = JsonUtils.readJsonArrayFromJsonObject(serialized, key);
+ assertEquals(Test.MATCH, arr1.length(), arr2.length());
+ for (int i = 0; i < Test.GENERAL_SEAT_LIST.size(); i++) {
+ Hashtable<String, Object> h1 = JsonRPCMarshaller.deserializeJSONObject(arr1.getJSONObject(i));
+ Hashtable<String, Object> h2 = JsonRPCMarshaller.deserializeJSONObject(arr2.getJSONObject(i));
+ assertTrue(Test.MATCH, Validator.validateSeatLocation(new SeatLocation(h1), new SeatLocation(h2)));
+ }
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
new file mode 100644
index 000000000..6a102fc66
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeatLocationTests.java
@@ -0,0 +1,48 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.Grid;
+import com.smartdevicelink.proxy.rpc.SeatLocation;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class SeatLocationTests extends TestCase {
+
+ private SeatLocation msg;
+
+ @Override
+ public void setUp() {
+ msg = new SeatLocation();
+ msg.setGrid(Test.GENERAL_GRID);
+ }
+
+ public void testRpcValues() {
+ Grid grid = msg.getGrid();
+
+ //valid test
+ assertTrue(Validator.validateGrid(Test.GENERAL_GRID, grid));
+
+ //null test
+ SeatLocation msg = new SeatLocation();
+ assertNull(Test.NULL, msg.getGrid());
+ }
+
+ public void testJson() {
+ JSONObject original = new JSONObject();
+ try {
+ original.put(SeatLocation.KEY_GRID, Test.GENERAL_GRID);
+
+ JSONObject serialized = msg.serializeJSON();
+ assertEquals(serialized.length(), original.length());
+ assertTrue(Test.TRUE, Validator.validateSeatLocation(new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(original)),
+ new SeatLocation(JsonRPCMarshaller.deserializeJSONObject(serialized))));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
index f5d0a9217..b422ce627 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SoftButtonCapabilitiesTest.java
@@ -27,6 +27,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
msg.setShortPressAvailable(Test.GENERAL_BOOLEAN);
msg.setLongPressAvailable(Test.GENERAL_BOOLEAN);
msg.setUpDownAvailable(Test.GENERAL_BOOLEAN);
+ msg.setTextSupported(Test.GENERAL_BOOLEAN);
}
/**
@@ -38,12 +39,14 @@ public class SoftButtonCapabilitiesTest extends TestCase {
Boolean updown = msg.getUpDownAvailable();
Boolean longPress = msg.getLongPressAvailable();
Boolean shortPress = msg.getShortPressAvailable();
+ Boolean textSupported = msg.getTextSupported();
// Valid Tests
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, imageSupp);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, updown);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, longPress);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, shortPress);
+ assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, textSupported);
// Invalid/Null Tests
SoftButtonCapabilities msg = new SoftButtonCapabilities();
@@ -53,6 +56,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
assertNull(Test.NULL, msg.getLongPressAvailable());
assertNull(Test.NULL, msg.getShortPressAvailable());
assertNull(Test.NULL, msg.getUpDownAvailable());
+ assertNull(Test.NULL, msg.getTextSupported());
}
public void testJson() {
@@ -63,6 +67,7 @@ public class SoftButtonCapabilitiesTest extends TestCase {
reference.put(SoftButtonCapabilities.KEY_UP_DOWN_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(SoftButtonCapabilities.KEY_LONG_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
reference.put(SoftButtonCapabilities.KEY_SHORT_PRESS_AVAILABLE, Test.GENERAL_BOOLEAN);
+ reference.put(SoftButtonCapabilities.KEY_TEXT_SUPPORTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
index bc50907db..203f72060 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SystemCapabilityTests.java
@@ -4,6 +4,7 @@ import android.util.Log;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.NavigationCapability;
import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.proxy.rpc.RemoteControlCapabilities;
@@ -15,11 +16,13 @@ import com.smartdevicelink.test.Validator;
import junit.framework.TestCase;
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
@@ -38,7 +41,7 @@ public class SystemCapabilityTests extends TestCase {
msg.setCapabilityForType(SystemCapabilityType.PHONE_CALL, Test.GENERAL_PHONECAPABILITY);
msg.setCapabilityForType(SystemCapabilityType.REMOTE_CONTROL, Test.GENERAL_REMOTECONTROLCAPABILITIES);
msg.setCapabilityForType(SystemCapabilityType.APP_SERVICES, Test.GENERAL_APP_SERVICE_CAPABILITIES);
-
+ msg.setCapabilityForType(SystemCapabilityType.DISPLAYS, Test.GENERAL_DISPLAYCAPABILITY_LIST);
}
/**
@@ -51,6 +54,7 @@ public class SystemCapabilityTests extends TestCase {
PhoneCapability testPhoneCapability = (PhoneCapability) msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL);
RemoteControlCapabilities testRemoteControlCapabilities = (RemoteControlCapabilities) msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL);
AppServicesCapabilities testAppServicesCapabilities = (AppServicesCapabilities) msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES);
+ List<DisplayCapability> displayCapabilities = (List<DisplayCapability>) msg.getCapabilityForType(SystemCapabilityType.DISPLAYS);
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCAPABILITYTYPE, testType);
@@ -59,6 +63,10 @@ public class SystemCapabilityTests extends TestCase {
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities(Test.GENERAL_REMOTECONTROLCAPABILITIES, testRemoteControlCapabilities));
assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities(Test.GENERAL_APP_SERVICE_CAPABILITIES, testAppServicesCapabilities));
+ for(int i = 0; i < Test.GENERAL_DISPLAYCAPABILITY_LIST.size(); i++){
+ assertTrue(Test.TRUE, Validator.validateDisplayCapability(Test.GENERAL_DISPLAYCAPABILITY_LIST.get(i), displayCapabilities.get(i)));
+ }
+
// Invalid/Null Tests
SystemCapability msg = new SystemCapability();
assertNotNull(Test.NOT_NULL, msg);
@@ -68,6 +76,7 @@ public class SystemCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.PHONE_CALL));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.REMOTE_CONTROL));
assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.APP_SERVICES));
+ assertNull(Test.NULL, msg.getCapabilityForType(SystemCapabilityType.DISPLAYS));
}
public void testJson() {
@@ -79,6 +88,7 @@ public class SystemCapabilityTests extends TestCase {
reference.put(SystemCapability.KEY_PHONE_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_PHONECAPABILITY.getStore()));
reference.put(SystemCapability.KEY_REMOTE_CONTROL_CAPABILITY, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_REMOTECONTROLCAPABILITIES.getStore()));
reference.put(SystemCapability.KEY_APP_SERVICES_CAPABILITIES, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_APP_SERVICE_CAPABILITIES.getStore()));
+ reference.put(SystemCapability.KEY_DISPLAY_CAPABILITIES, Test.JSON_DISPLAYCAPABILITY_LIST);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -105,7 +115,7 @@ public class SystemCapabilityTests extends TestCase {
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
assertTrue(Test.TRUE, Validator.validateRemoteControlCapabilities( new RemoteControlCapabilities(hashReference), new RemoteControlCapabilities(hashTest)));
- }else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
+ } else if(key.equals(SystemCapability.KEY_APP_SERVICES_CAPABILITIES)){
JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
@@ -113,6 +123,16 @@ public class SystemCapabilityTests extends TestCase {
Log.i("TEST REF", hashReference.toString());
Log.i("TEST TEST", hashTest.toString());
assertTrue(Test.TRUE, Validator.validateAppServiceCapabilities( new AppServicesCapabilities(hashReference), new AppServicesCapabilities(hashTest)));
+ } else if(key.equals(SystemCapability.KEY_DISPLAY_CAPABILITIES)){
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for(int i = 0; i < referenceArray.length(); i++){
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest= JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateDisplayCapability(new DisplayCapability(hashReference), new DisplayCapability(hashTest)));
+ }
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
new file mode 100644
index 000000000..4fc3744be
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/TemplateConfigurationTests.java
@@ -0,0 +1,94 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.TemplateConfiguration}
+ */
+public class TemplateConfigurationTests extends TestCase {
+
+ private TemplateConfiguration msg;
+
+ @Override
+ public void setUp(){
+ msg = new TemplateConfiguration();
+
+ msg.setTemplate(Test.GENERAL_STRING);
+ msg.setDayColorScheme(Test.GENERAL_DAYCOLORSCHEME);
+ msg.setNightColorScheme(Test.GENERAL_NIGHTCOLORSCHEME);
+
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String testTemplate = msg.getTemplate();
+ TemplateColorScheme testDayColorScheme = msg.getDayColorScheme();
+ TemplateColorScheme testNightColorScheme = msg.getNightColorScheme();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testTemplate);
+ assertEquals(Test.MATCH, Test.GENERAL_DAYCOLORSCHEME, testDayColorScheme);
+ assertEquals(Test.MATCH, Test.GENERAL_NIGHTCOLORSCHEME, testNightColorScheme);
+
+ // Invalid/Null Tests
+ TemplateConfiguration msg = new TemplateConfiguration();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getTemplate());
+ assertNull(Test.NULL, msg.getDayColorScheme());
+ assertNull(Test.NULL, msg.getNightColorScheme());
+ }
+
+ public void testJson(){
+ JSONObject reference = new JSONObject();
+
+ try{
+ reference.put(TemplateConfiguration.KEY_TEMPLATE, Test.GENERAL_STRING);
+ reference.put(TemplateConfiguration.KEY_DAY_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_DAYCOLORSCHEME.getStore()));
+ reference.put(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME, JsonRPCMarshaller.serializeHashtable(Test.GENERAL_NIGHTCOLORSCHEME.getStore()));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while(iterator.hasNext()){
+ String key = (String) iterator.next();
+
+ if (key.equals(TemplateConfiguration.KEY_DAY_COLOR_SCHEME)) {
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ } else if (key.equals(TemplateConfiguration.KEY_NIGHT_COLOR_SCHEME)) {
+ JSONObject objectEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(reference, key);
+ JSONObject testEquals = (JSONObject) JsonUtils.readObjectFromJsonObject(underTest, key);
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
+ assertTrue(Test.TRUE, Validator.validateTemplateColorScheme(new TemplateColorScheme(hashReference), new TemplateColorScheme(hashTest)));
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch(JSONException e){
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
index 5b982fe97..dd84c8181 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VehicleDataResultTest.java
@@ -23,6 +23,7 @@ public class VehicleDataResultTest extends TestCase {
msg.setDataType(Test.GENERAL_VEHICLEDATATYPE);
msg.setResultCode(Test.GENERAL_VEHICLEDATARESULTCODE);
+ msg.setOEMCustomVehicleDataType(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
}
/**
@@ -32,10 +33,12 @@ public class VehicleDataResultTest extends TestCase {
// Test Values
VehicleDataResultCode result = msg.getResultCode();
VehicleDataType type = msg.getDataType();
+ String oemCustomDataType = msg.getOEMCustomVehicleDataType();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATARESULTCODE, result);
assertEquals(Test.MATCH, Test.GENERAL_VEHICLEDATATYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, oemCustomDataType);
// Invalid/Null Tests
VehicleDataResult msg = new VehicleDataResult();
@@ -43,6 +46,7 @@ public class VehicleDataResultTest extends TestCase {
assertNull(Test.NULL, msg.getDataType());
assertNull(Test.NULL, msg.getResultCode());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleDataType());
}
public void testJson() {
@@ -51,6 +55,7 @@ public class VehicleDataResultTest extends TestCase {
try {
reference.put(VehicleDataResult.KEY_RESULT_CODE, Test.GENERAL_VEHICLEDATARESULTCODE);
reference.put(VehicleDataResult.KEY_DATA_TYPE, Test.GENERAL_VEHICLEDATATYPE);
+ reference.put(VehicleDataResult.KEY_OEM_CUSTOM_DATA_TYPE, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 54cfc1a22..808429d2f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -30,6 +30,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
msg.setPreferredResolution(Test.GENERAL_IMAGERESOLUTION);
msg.setMaxBitrate(Test.GENERAL_INT);
msg.setIsHapticSpatialDataSupported(Test.GENERAL_BOOLEAN);
+ msg.setDiagonalScreenSize(Test.GENERAL_DOUBLE);
+ msg.setPixelPerInch(Test.GENERAL_DOUBLE);
+ msg.setScale(Test.GENERAL_DOUBLE);
}
/**
@@ -41,12 +44,18 @@ public class VideoStreamingCapabilityTests extends TestCase {
ImageResolution res = msg.getPreferredResolution();
Integer maxBitrate = msg.getMaxBitrate();
Boolean isHapticSpatialDataSupported = msg.getIsHapticSpatialDataSupported();
+ Double diagonalScreenSize = msg.getDiagonalScreenSize();
+ Double pixelPerInch = msg.getPixelPerInch();
+ Double scale = msg.getScale();
// Valid Tests
assertEquals(Test.MATCH, (List<VideoStreamingFormat>) Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
assertEquals(Test.MATCH, (ImageResolution) Test.GENERAL_IMAGERESOLUTION, res);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, maxBitrate);
assertEquals(Test.MATCH, (Boolean) Test.GENERAL_BOOLEAN, isHapticSpatialDataSupported);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, diagonalScreenSize);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, pixelPerInch);
+ assertEquals(Test.MATCH, Test.GENERAL_DOUBLE, scale);
// Invalid/Null Tests
VideoStreamingCapability msg = new VideoStreamingCapability();
@@ -56,6 +65,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
assertNull(Test.NULL, msg.getPreferredResolution());
assertNull(Test.NULL, msg.getSupportedFormats());
assertNull(Test.NULL, msg.getIsHapticSpatialDataSupported());
+ assertNull(Test.NULL, msg.getDiagonalScreenSize());
+ assertNull(Test.NULL, msg.getPixelPerInch());
+ assertNull(Test.NULL, msg.getScale());
}
public void testJson() {
@@ -66,6 +78,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
+ reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, Test.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_SCALE, Test.GENERAL_DOUBLE);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
@@ -87,6 +102,9 @@ public class VideoStreamingCapabilityTests extends TestCase {
for(VideoStreamingFormat vsf : vsfReference){
assertTrue(Validator.validateSupportedFormats(vsf, new VideoStreamingFormat(JsonRPCMarshaller.deserializeJSONObject(vsfArray.getJSONObject(i++)))));
}
+ } else if (key.equals(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE) || key.equals(VideoStreamingCapability.KEY_PIXEL_PER_INCH) ||
+ key.equals(VideoStreamingCapability.KEY_SCALE)) {
+ assertEquals(JsonUtils.readDoubleFromJsonObject(reference, key), JsonUtils.readDoubleFromJsonObject(underTest, key), 0.0005);
}
}
} catch (JSONException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
new file mode 100644
index 000000000..550231452
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowCapabilityTests.java
@@ -0,0 +1,202 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.ImageField;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.Validator;
+
+import junit.framework.TestCase;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.WindowCapability}
+ */
+public class WindowCapabilityTests extends TestCase {
+
+ private WindowCapability msg;
+
+ @Override
+ public void setUp() {
+ msg = new WindowCapability();
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST);
+ msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST);
+ msg.setImageTypeSupported(Test.GENERAL_IMAGE_TYPE_LIST);
+ msg.setTemplatesAvailable(Test.GENERAL_STRING_LIST);
+ msg.setNumCustomPresetsAvailable(Test.GENERAL_INT);
+ msg.setButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST);
+ msg.setSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST);
+ msg.setMenuLayoutsAvailable(Test.GENERAL_MENU_LAYOUT_LIST);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int windowID = msg.getWindowID();
+ List<TextField> textFields = msg.getTextFields();
+ List<ImageField> imageFields = msg.getImageFields();
+ List<ImageType> imageTypeSupported = msg.getImageTypeSupported();
+ List<String> templatesAvailable = msg.getTemplatesAvailable();
+ int numCustomPresetsAvailable = msg.getNumCustomPresetsAvailable();
+ List<ButtonCapabilities> buttonCapabilities = msg.getButtonCapabilities();
+ List<SoftButtonCapabilities> softButtonCapabilities = msg.getSoftButtonCapabilities();
+ List<MenuLayout> menuLayouts = msg.getMenuLayoutsAvailable();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, windowID);
+ assertEquals(Test.MATCH, Test.GENERAL_TEXTFIELD_LIST.size(), textFields.size());
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGEFIELD_LIST.size(), imageFields.size());
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.size(), imageTypeSupported.size());
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.size(), templatesAvailable.size());
+ assertEquals(Test.MATCH, Test.GENERAL_INT, numCustomPresetsAvailable);
+ assertEquals(Test.MATCH, Test.GENERAL_BUTTONCAPABILITIES_LIST.size(), buttonCapabilities.size());
+ assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST.size(), softButtonCapabilities.size());
+ assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT_LIST.size(), menuLayouts.size());
+
+ for (int i = 0; i < Test.GENERAL_TEXTFIELD_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateTextFields(Test.GENERAL_TEXTFIELD_LIST.get(i), textFields.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_IMAGEFIELD_LIST.size(); i++) {
+ assertTrue(Test.TRUE, Validator.validateImageFields(Test.GENERAL_IMAGEFIELD_LIST.get(i), imageFields.get(i)));
+ }
+
+ for (int i = 0; i < Test.GENERAL_IMAGE_TYPE_LIST.size(); i++) {
+ assertEquals(Test.MATCH, Test.GENERAL_IMAGE_TYPE_LIST.get(i), imageTypeSupported.get(i));
+ }
+
+ for (int i = 0; i < Test.GENERAL_STRING_LIST.size(); i++) {
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST.get(i), templatesAvailable.get(i));
+ }
+
+ for(int i = 0; i < Test.GENERAL_MENU_LAYOUT_LIST.size(); i++){
+ assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT_LIST.get(i), menuLayouts.get(i));
+ }
+
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, buttonCapabilities));
+ assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, softButtonCapabilities));
+
+ // Invalid/Null Tests
+ WindowCapability msg = new WindowCapability();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getTextFields());
+ assertNull(Test.NULL, msg.getImageFields());
+ assertNull(Test.NULL, msg.getImageTypeSupported());
+ assertNull(Test.NULL, msg.getTemplatesAvailable());
+ assertNull(Test.NULL, msg.getNumCustomPresetsAvailable());
+ assertNull(Test.NULL, msg.getButtonCapabilities());
+ assertNull(Test.NULL, msg.getSoftButtonCapabilities());
+ assertNull(Test.NULL, msg.getMenuLayoutsAvailable());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WindowCapability.KEY_WINDOW_ID, Test.GENERAL_INT);
+ reference.put(WindowCapability.KEY_TEXT_FIELDS, Test.JSON_TEXTFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_FIELDS, Test.JSON_IMAGEFIELDS);
+ reference.put(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED, Test.JSON_IMAGE_TYPE_SUPPORTED);
+ reference.put(WindowCapability.KEY_TEMPLATES_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ reference.put(WindowCapability.KEY_NUM_CUSTOM_PRESETS_AVAILABLE, Test.GENERAL_INT);
+ reference.put(WindowCapability.KEY_BUTTON_CAPABILITIES, Test.JSON_BUTTONCAPABILITIES);
+ reference.put(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES, Test.JSON_SOFTBUTTONCAPABILITIES);
+ reference.put(WindowCapability.KEY_MENU_LAYOUTS_AVAILABLE, JsonUtils.createJsonArray(Test.GENERAL_MENU_LAYOUT_LIST));
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+
+ if (key.equals(WindowCapability.KEY_IMAGE_FIELDS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateImageFields(new ImageField(hashReference), new ImageField(hashTest)));
+ }
+ } else if (key.equals(WindowCapability.KEY_TEXT_FIELDS)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ assertTrue(Test.TRUE, Validator.validateTextFields(new TextField(hashReference), new TextField(hashTest)));
+ }
+ } else if (key.equals(WindowCapability.KEY_TEMPLATES_AVAILABLE)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+ assertTrue(Test.TRUE, Validator.validateStringList(JsonUtils.readStringListFromJsonObject(reference, key), JsonUtils.readStringListFromJsonObject(underTest, key)));
+ } else if (key.equals(WindowCapability.KEY_BUTTON_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<ButtonCapabilities> referenceList = new ArrayList<ButtonCapabilities>();
+ List<ButtonCapabilities> testList = new ArrayList<ButtonCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new ButtonCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new ButtonCapabilities(hashTest));
+ }
+ assertTrue(Test.TRUE, Validator.validateButtonCapabilities(referenceList, testList));
+ } else if (key.equals(WindowCapability.KEY_SOFT_BUTTON_CAPABILITIES)) {
+ JSONArray referenceArray = JsonUtils.readJsonArrayFromJsonObject(reference, key);
+ JSONArray underTestArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
+ assertEquals(Test.MATCH, referenceArray.length(), underTestArray.length());
+
+ List<SoftButtonCapabilities> referenceList = new ArrayList<SoftButtonCapabilities>();
+ List<SoftButtonCapabilities> testList = new ArrayList<SoftButtonCapabilities>();
+ for (int i = 0; i < referenceArray.length(); i++) {
+ Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(referenceArray.getJSONObject(i));
+ referenceList.add(new SoftButtonCapabilities(hashReference));
+ Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(underTestArray.getJSONObject(i));
+ testList.add(new SoftButtonCapabilities(hashTest));
+ }
+ assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(referenceList, testList));
+ } else if (key.equals(WindowCapability.KEY_IMAGE_TYPE_SUPPORTED) || (key.equals(WindowCapability.KEY_MENU_LAYOUTS_AVAILABLE))) {
+ List<String> referenceList = JsonUtils.readStringListFromJsonObject(reference, key);
+ List<String> underTestList = JsonUtils.readStringListFromJsonObject(underTest, key);
+
+ assertEquals(Test.MATCH, referenceList.size(), underTestList.size());
+ for (int i = 0; i < referenceList.size(); i++) {
+ assertEquals(Test.MATCH, referenceList.get(i), underTestList.get(i));
+ }
+ } else {
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
new file mode 100644
index 000000000..84d57ba52
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/WindowTypeCapabilitiesTest.java
@@ -0,0 +1,66 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class WindowTypeCapabilitiesTest extends TestCase {
+
+ private WindowTypeCapabilities msg;
+
+ @Override
+ public void setUp() {
+ msg = new WindowTypeCapabilities();
+
+ msg.setMaximumNumberOfWindows(Test.GENERAL_INT);
+ msg.setType(Test.GENERAL_WINDOWTYPE);
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int maximumNumberOfWindows = msg.getMaximumNumberOfWindows();
+ WindowType type = msg.getType();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, maximumNumberOfWindows);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOWTYPE, type);
+
+ // Invalid/Null Tests
+ WindowTypeCapabilities msg = new WindowTypeCapabilities();
+ assertNotNull(Test.NOT_NULL, msg);
+
+ assertNull(Test.NULL, msg.getMaximumNumberOfWindows());
+ assertNull(Test.NULL, msg.getType());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(WindowTypeCapabilities.KEY_MAXIMUM_NUMBER_OF_WINDOWS, Test.GENERAL_INT);
+ reference.put(WindowTypeCapabilities.KEY_TYPE, Test.GENERAL_WINDOWTYPE);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(Test.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
index 5562749ad..da768fc0d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ButtonNameTests.java
@@ -200,6 +200,22 @@ public class ButtonNameTests extends TestCase {
enumTestList.add(ButtonName.SHUFFLE);
enumTestList.add(ButtonName.REPEAT);
enumTestList.add(ButtonName.PLAY_PAUSE);
+ enumTestList.add(ButtonName.NAV_CENTER_LOCATION);
+ enumTestList.add(ButtonName.NAV_ZOOM_IN);
+ enumTestList.add(ButtonName.NAV_ZOOM_OUT);
+ enumTestList.add(ButtonName.NAV_PAN_UP);
+ enumTestList.add(ButtonName.NAV_PAN_UP_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN_RIGHT);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN);
+ enumTestList.add(ButtonName.NAV_PAN_DOWN_LEFT);
+ enumTestList.add(ButtonName.NAV_PAN_LEFT);
+ enumTestList.add(ButtonName.NAV_PAN_UP_LEFT);
+ enumTestList.add(ButtonName.NAV_TILT_TOGGLE);
+ enumTestList.add(ButtonName.NAV_ROTATE_CLOCKWISE);
+ enumTestList.add(ButtonName.NAV_ROTATE_COUNTERCLOCKWISE);
+ enumTestList.add(ButtonName.NAV_HEADING_TOGGLE);
+
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
index 422ab808c..38caad109 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/GlobalPropertyTests.java
@@ -32,6 +32,8 @@ public class GlobalPropertyTests extends TestCase {
GlobalProperty enumMenuIcon = GlobalProperty.valueForString(example);
example = "KEYBOARDPROPERTIES";
GlobalProperty enumKeyboardProperties = GlobalProperty.valueForString(example);
+ example = "USERLOCATION";
+ GlobalProperty enumUserLocation = GlobalProperty.valueForString(example);
assertNotNull("HELPPROMPT returned null", enumHelpPrompt);
assertNotNull("TIMEOUTPROMPT returned null", enumTimeoutPrompt);
@@ -40,6 +42,7 @@ public class GlobalPropertyTests extends TestCase {
assertNotNull("MENUNAME returned null", enumMenuName);
assertNotNull("MENUICON returned null", enumMenuIcon);
assertNotNull("KEYBOARDPROPERTIES returned null", enumKeyboardProperties);
+ assertNotNull("USERLOCATION returned null", enumUserLocation);
}
/**
@@ -84,6 +87,7 @@ public class GlobalPropertyTests extends TestCase {
enumTestList.add(GlobalProperty.MENUNAME);
enumTestList.add(GlobalProperty.MENUICON);
enumTestList.add(GlobalProperty.KEYBOARDPROPERTIES);
+ enumTestList.add(GlobalProperty.USERLOCATION);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
index 5c59df856..3bca4edc9 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ImageFieldNameTests.java
@@ -108,6 +108,8 @@ public class ImageFieldNameTests extends TestCase {
enumTestList.add(ImageFieldName.showConstantTBTNextTurnIcon);
enumTestList.add(ImageFieldName.locationImage);
enumTestList.add(ImageFieldName.secondaryGraphic);
+ enumTestList.add(ImageFieldName.alertIcon);
+
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java
new file mode 100644
index 000000000..f92de1f94
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MenuLayoutTests.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/17/19 12:04 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MenuLayoutTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "LIST";
+ MenuLayout enumList = MenuLayout.valueForString(example);
+ example = "TILES";
+ MenuLayout enumTiles = MenuLayout.valueForString(example);
+
+ assertNotNull("LIST returned null", enumList);
+ assertNotNull("TILES returned null", enumTiles);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "TooLs";
+ try {
+ MenuLayout temp = MenuLayout.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ MenuLayout temp = MenuLayout.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of MenuLayout.
+ */
+ public void testListEnum() {
+ List<MenuLayout> enumValueList = Arrays.asList(MenuLayout.values());
+
+ List<MenuLayout> enumTestList = new ArrayList<>();
+ enumTestList.add(MenuLayout.LIST);
+ enumTestList.add(MenuLayout.TILES);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java
new file mode 100644
index 000000000..eae294933
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PredefinedWindowsTests.java
@@ -0,0 +1,57 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.PredefinedWindows}
+ */
+public class PredefinedWindowsTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ int example = 0;
+ PredefinedWindows enumDefaultWindow = PredefinedWindows.valueForInt(example);
+ example = 1;
+ PredefinedWindows enumPrimaryWidget = PredefinedWindows.valueForInt(example);
+
+ assertNotNull("DEFAULT_WINDOW returned null", enumDefaultWindow);
+ assertNotNull("PRIMARY_WIDGET returned null", enumPrimaryWidget);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ int example = 3;
+ try {
+ PredefinedWindows temp = PredefinedWindows.valueForInt(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of PredefinedWindows.
+ */
+ public void testListEnum() {
+ List<PredefinedWindows> enumValueList = Arrays.asList(PredefinedWindows.values());
+
+ List<PredefinedWindows> enumTestList = new ArrayList<PredefinedWindows>();
+ enumTestList.add(PredefinedWindows.DEFAULT_WINDOW);
+ enumTestList.add(PredefinedWindows.PRIMARY_WIDGET);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
index 992f4e54e..f3b374b4c 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ResultTests.java
@@ -88,6 +88,8 @@ public class ResultTests extends TestCase {
Result enumReadOnly = Result.valueForString(example);
example = "CORRUPTED_DATA";
Result enumCorruptData = Result.valueForString(example);
+ example = "ENCRYPTION_NEEDED";
+ Result enumEncryptionRequired = Result.valueForString(example);
assertNotNull("SUCCESS returned null", enumSuccess);
assertNotNull("INVALID_DATA returned null", enumInvalidData);
@@ -124,6 +126,7 @@ public class ResultTests extends TestCase {
assertNotNull("DATA_NOT_AVAILABLE returned null", enumDataNotAvailable);
assertNotNull("READ_ONLY returned null", enumReadOnly);
assertNotNull("CORRUPTED_DATA", enumCorruptData);
+ assertNotNull("ENCRYPTION_NEEDED", enumEncryptionRequired);
}
/**
@@ -196,6 +199,7 @@ public class ResultTests extends TestCase {
enumTestList.add(Result.DATA_NOT_AVAILABLE);
enumTestList.add(Result.READ_ONLY);
enumTestList.add(Result.CORRUPTED_DATA);
+ enumTestList.add(Result.ENCRYPTION_NEEDED);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
index f0f876d00..f453cb985 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/SystemCapabilityTypeTests.java
@@ -48,6 +48,12 @@ public class SystemCapabilityTypeTests extends TestCase {
SystemCapabilityType enumPCM = SystemCapabilityType.valueForString(example);
example = "APP_SERVICES";
SystemCapabilityType enumAppServices = SystemCapabilityType.valueForString(example);
+ example = "SEAT_LOCATION";
+ SystemCapabilityType enumSeatLocation = SystemCapabilityType.valueForString(example);
+ example = "PRERECORDED_SPEECH";
+ SystemCapabilityType enumPrerecordedSpeech = SystemCapabilityType.valueForString(example);
+ example = "DISPLAYS";
+ SystemCapabilityType enumDisplays = SystemCapabilityType.valueForString(example);
assertNotNull("NAVIGATION returned null", enumNavigation);
assertNotNull("PHONE_CALL returned null", enumPhoneCall);
@@ -64,6 +70,9 @@ public class SystemCapabilityTypeTests extends TestCase {
assertNotNull("VOICE_RECOGNITION returned null", enumVoiceRecognition);
assertNotNull("PCM_STREAMING", enumPCM);
assertNotNull("APP_SERVICES", enumAppServices);
+ assertNotNull("SEAT_LOCATION return null", enumSeatLocation);
+ assertNotNull("PRERECORDED_SPEECH", enumPrerecordedSpeech);
+ assertNotNull("DISPLAYS", enumDisplays);
}
/**
@@ -116,6 +125,9 @@ public class SystemCapabilityTypeTests extends TestCase {
enumTestList.add(SystemCapabilityType.VOICE_RECOGNITION);
enumTestList.add(SystemCapabilityType.PCM_STREAMING);
enumTestList.add(SystemCapabilityType.APP_SERVICES);
+ enumTestList.add(SystemCapabilityType.SEAT_LOCATION);
+ enumTestList.add(SystemCapabilityType.PRERECORDED_SPEECH);
+ enumTestList.add(SystemCapabilityType.DISPLAYS);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
index 4703b6ee0..33baa6835 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TextFieldNameTests.java
@@ -11,7 +11,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.enums.TextFieldName}
+ * {@link com.smartdevicelink.proxy.rpc.enums.TextFieldName}
*/
public class TextFieldNameTests extends TestCase {
@@ -75,6 +75,8 @@ public class TextFieldNameTests extends TestCase {
TextFieldName enumAddLines = TextFieldName.valueForString(example);
example = "phoneNumber";
TextFieldName enumPhone = TextFieldName.valueForString(example);
+ example = "templateTitle";
+ TextFieldName templateTitle = TextFieldName.valueForString(example);
assertNotNull("mainField1 returned null", enumMainField1);
assertNotNull("mainField2 returned null", enumMainField2);
@@ -100,7 +102,9 @@ public class TextFieldNameTests extends TestCase {
assertNotNull("secondaryText returned null", enumSecondaryText);
assertNotNull("tertiaryText returned null", enumTertiaryText);
assertNotNull("menuTitle returned null", enumMenuTitle);
-
+ assertNotNull("templateTitle returned null", templateTitle);
+
+
assertNotNull(Test.NOT_NULL, enumLocName);
assertNotNull(Test.NOT_NULL, enumLocDesc);
assertNotNull(Test.NOT_NULL, enumAddLines);
@@ -165,12 +169,12 @@ public class TextFieldNameTests extends TestCase {
enumTestList.add(TextFieldName.menuName);
enumTestList.add(TextFieldName.secondaryText);
enumTestList.add(TextFieldName.tertiaryText);
- enumTestList.add(TextFieldName.menuTitle);
-
+ enumTestList.add(TextFieldName.menuTitle);
enumTestList.add(TextFieldName.locationName);
enumTestList.add(TextFieldName.locationDescription);
enumTestList.add(TextFieldName.addressLines);
- enumTestList.add(TextFieldName.phoneNumber);
+ enumTestList.add(TextFieldName.phoneNumber);
+ enumTestList.add(TextFieldName.templateTitle);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
index 65a7646d3..dbce8b5e7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataTypeTests.java
@@ -80,6 +80,8 @@ public class VehicleDataTypeTests extends TestCase {
VehicleDataType enumVehicleDataElectronicParkBrakeStatus = VehicleDataType.valueForString(example);
example = "VEHICLEDATA_CLOUDAPPVEHICLEID";
VehicleDataType enumVehicleCloudAppVehicleId = VehicleDataType.valueForString(example);
+ example = "VEHICLEDATA_OEM_CUSTOM_DATA";
+ VehicleDataType enumVehicleDataOemVehicleDataType= VehicleDataType.valueForString(example);
assertNotNull("VEHICLEDATA_GPS returned null", enumVehicleDataGps);
assertNotNull("VEHICLEDATA_SPEED returned null", enumVehicleDataSpeed);
@@ -112,6 +114,7 @@ public class VehicleDataTypeTests extends TestCase {
assertNotNull("VEHICLEDATA_TURNSIGNAL returned null", enumVehicleDataTurnSignal);
assertNotNull("VEHICLEDATA_ELECTRONICPARKBRAKESTATUS returned null", enumVehicleDataElectronicParkBrakeStatus);
assertNotNull("VEHICLEDATA_CLOUDAPPVEHICLEID returned null", enumVehicleCloudAppVehicleId);
+ assertNotNull("VEHICLEDATA_OEM_CUSTOM_DATA returned null", enumVehicleDataOemVehicleDataType);
}
/**
@@ -180,8 +183,9 @@ public class VehicleDataTypeTests extends TestCase {
enumTestList.add(VehicleDataType.VEHICLEDATA_TURNSIGNAL);
enumTestList.add(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS);
enumTestList.add(VehicleDataType.VEHICLEDATA_CLOUDAPPVEHICLEID);
+ enumTestList.add(VehicleDataType.VEHICLEDATA_OEM_CUSTOM_DATA);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java
new file mode 100644
index 000000000..c3c78c870
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/WindowTypeTests.java
@@ -0,0 +1,70 @@
+package com.smartdevicelink.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+
+import junit.framework.TestCase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.enums.WindowType}
+ */
+public class WindowTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ String example = "MAIN";
+ WindowType enumMain = WindowType.valueForString(example);
+ example = "WIDGET";
+ WindowType enumWidget = WindowType.valueForString(example);
+
+ assertNotNull("MAIN returned null", enumMain);
+ assertNotNull("WIDGET returned null", enumWidget);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ String example = "mAIN";
+ try {
+ WindowType temp = WindowType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+ /**
+ * Verifies that a null assignment is invalid.
+ */
+ public void testNullEnum() {
+ String example = null;
+ try {
+ WindowType temp = WindowType.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of WindowType.
+ */
+ public void testListEnum() {
+ List<WindowType> enumValueList = Arrays.asList(WindowType.values());
+
+ List<WindowType> enumTestList = new ArrayList<WindowType>();
+ enumTestList.add(WindowType.MAIN);
+ enumTestList.add(WindowType.WIDGET);
+
+ assertTrue("Enum value list does not match enum class list",
+ enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
index 46a5d1c75..56c41b213 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnHMIStatusTests.java
@@ -29,6 +29,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
msg.setFirstRun(Test.GENERAL_BOOLEAN);
msg.setHmiLevel(Test.GENERAL_HMILEVEL);
msg.setSystemContext(Test.GENERAL_SYSTEMCONTEXT);
+ msg.setWindowID(Test.GENERAL_INT);
return msg;
}
@@ -52,6 +53,7 @@ public class OnHMIStatusTests extends BaseRpcTests{
result.put(OnHMIStatus.KEY_VIDEO_STREAMING_STATE, Test.GENERAL_VIDEOSTREAMINGSTATE);
result.put(OnHMIStatus.KEY_HMI_LEVEL, Test.GENERAL_HMILEVEL);
result.put(OnHMIStatus.KEY_SYSTEM_CONTEXT, Test.GENERAL_SYSTEMCONTEXT);
+ result.put(OnHMIStatus.KEY_WINDOW_ID, Test.GENERAL_INT);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -68,12 +70,14 @@ public class OnHMIStatusTests extends BaseRpcTests{
VideoStreamingState videoStreamingState = ( (OnHMIStatus) msg ).getVideoStreamingState();
HMILevel hmiLevel = ( (OnHMIStatus) msg ).getHmiLevel();
SystemContext context = ( (OnHMIStatus) msg ).getSystemContext();
+ int testWindowID = ( (OnHMIStatus) msg ).getWindowID();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_AUDIOSTREAMINGSTATE, audioStreamingState);
assertEquals(Test.MATCH, Test.GENERAL_VIDEOSTREAMINGSTATE, videoStreamingState);
assertEquals(Test.MATCH, Test.GENERAL_HMILEVEL, hmiLevel);
assertEquals(Test.MATCH, Test.GENERAL_SYSTEMCONTEXT, context);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
// Invalid/Null Tests
OnHMIStatus msg = new OnHMIStatus();
@@ -87,5 +91,6 @@ public class OnHMIStatusTests extends BaseRpcTests{
assertEquals(Test.MATCH, VideoStreamingState.STREAMABLE, msg.getVideoStreamingState());
assertNull(Test.NULL, msg.getHmiLevel());
assertNull(Test.NULL, msg.getSystemContext());
+ assertNull(Test.NULL, msg.getWindowID());
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
index e390fc599..5064753c6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnPermissionsChangeTests.java
@@ -24,6 +24,7 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
OnPermissionsChange msg = new OnPermissionsChange();
msg.setPermissionItem(Test.GENERAL_PERMISSIONITEM_LIST);
+ msg.setRequireEncryption(Test.GENERAL_BOOLEAN);
return msg;
}
@@ -44,6 +45,7 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
try{
result.put(OnPermissionsChange.KEY_PERMISSION_ITEM, Test.JSON_PERMISSIONITEMS);
+ result.put(OnPermissionsChange.KEY_REQUIRE_ENCRYPTION, Test.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -57,17 +59,19 @@ public class OnPermissionsChangeTests extends BaseRpcTests{
public void testRpcValues () {
// Test Values
List<PermissionItem> data = ( (OnPermissionsChange) msg ).getPermissionItem();
-
+ boolean isRequired = ((OnPermissionsChange)msg).getRequireEncryption();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_PERMISSIONITEM_LIST.size(), data.size());
for(int i=0; i<data.size(); i++){
assertTrue(Test.TRUE, Validator.validatePermissionItem(Test.GENERAL_PERMISSIONITEM_LIST.get(i), data.get(i)));
}
+ assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, isRequired);
// Invalid/Null Tests
OnPermissionsChange msg = new OnPermissionsChange();
assertNotNull(Test.NOT_NULL, msg);
testNullBase(msg);
+ assertNull(Test.NULL, msg.getRequireEncryption());
assertNull(Test.NULL, msg.getPermissionItem());
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
index 9dda13715..e366e832f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/notifications/OnVehicleDataTests.java
@@ -92,6 +92,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
result.put(OnVehicleData.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -133,6 +134,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
List<FuelRange> fuelRangeList = ( (OnVehicleData) msg).getFuelRange();
TurnSignal turnSignal = ( (OnVehicleData) msg).getTurnSignal();
ElectronicParkBrakeStatus electronicParkBrakeStatus = ( (OnVehicleData) msg).getElectronicParkBrakeStatus();
+ Object oemCustomVehicleData = ( (OnVehicleData) msg).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertEquals(Test.MATCH, VehicleDataHelper.SPEED, speed);
@@ -164,6 +166,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertTrue(Test.TRUE, Validator.validateFuelRange(VehicleDataHelper.FUEL_RANGE_LIST, fuelRangeList));
assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, turnSignal);
assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, electronicParkBrakeStatus);
+ assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, oemCustomVehicleData);
// Invalid/Null Tests
OnVehicleData msg = new OnVehicleData();
@@ -199,6 +202,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
public void testJson() {
@@ -262,6 +266,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
//BELT_STATUS
beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
@@ -372,6 +377,7 @@ public class OnVehicleDataTests extends BaseRpcTests{
reference.put(OnVehicleData.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(OnVehicleData.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
reference.put(OnVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
//go inside underTest and only return the JSONObject inside the parameters key inside the notification key
@@ -496,4 +502,4 @@ public class OnVehicleDataTests extends BaseRpcTests{
fail(Test.JSON_FAIL);
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
index 4ba991c44..2ea3d2079 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AddSubmenuTests.java
@@ -5,6 +5,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.AddSubMenu;
import com.smartdevicelink.proxy.rpc.Image;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
@@ -30,6 +31,7 @@ public class AddSubmenuTests extends BaseRpcTests{
msg.setMenuName(Test.GENERAL_STRING);
msg.setPosition(Test.GENERAL_INT);
msg.setMenuIcon(Test.GENERAL_IMAGE);
+ msg.setMenuLayout(Test.GENERAL_MENU_LAYOUT);
return msg;
}
@@ -53,6 +55,7 @@ public class AddSubmenuTests extends BaseRpcTests{
result.put(AddSubMenu.KEY_MENU_NAME, Test.GENERAL_STRING);
result.put(AddSubMenu.KEY_POSITION, Test.GENERAL_INT);
result.put(AddSubMenu.KEY_MENU_ICON, Test.JSON_IMAGE);
+ result.put(AddSubMenu.KEY_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -69,12 +72,14 @@ public class AddSubmenuTests extends BaseRpcTests{
int testPosition = ( (AddSubMenu) msg ).getPosition();
String testMenuName = ( (AddSubMenu) msg ).getMenuName();
Image testMenuIcon = ( (AddSubMenu) msg ).getMenuIcon();
+ MenuLayout testMenuLayout = ( (AddSubMenu) msg ).getMenuLayout();
// Valid Tests
assertEquals("Menu ID didn't match input menu ID.", Test.GENERAL_INT, testMenuId);
assertEquals("Menu name didn't match input menu name.", Test.GENERAL_STRING, testMenuName);
assertEquals("Position didn't match input position.", Test.GENERAL_INT, testPosition);
assertTrue("Menu icon didn't match input icon.", Validator.validateImage(Test.GENERAL_IMAGE, testMenuIcon));
+ assertEquals("Menu layout didn't match input menu layout.", Test.GENERAL_MENU_LAYOUT, testMenuLayout);
// Invalid/Null Tests
@@ -86,6 +91,7 @@ public class AddSubmenuTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getMenuName());
assertNull(Test.NULL, msg.getPosition());
assertNull(Test.NULL, msg.getMenuIcon());
+ assertNull(Test.NULL, msg.getMenuLayout());
}
/**
@@ -111,10 +117,11 @@ public class AddSubmenuTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_MENU_ID), cmd.getMenuID());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, AddSubMenu.KEY_POSITION), cmd.getPosition());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, AddSubMenu.KEY_MENU_NAME), cmd.getMenuName());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_LAYOUT), cmd.getMenuLayout());
- JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_ICON);
- Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
- assertTrue(Test.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
+ JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, AddSubMenu.KEY_MENU_ICON);
+ Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
+ assertTrue(Test.TRUE, Validator.validateImage(referenceMenuIcon, cmd.getMenuIcon()));
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
index 12c440b1b..8bd229d4d 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/AlertTests.java
@@ -4,6 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Alert;
+import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.test.BaseRpcTests;
@@ -22,7 +23,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Alert}
+ * {@link com.smartdevicelink.proxy.rpc.Alert}
*/
public class AlertTests extends BaseRpcTests{
@@ -38,6 +39,8 @@ public class AlertTests extends BaseRpcTests{
msg.setProgressIndicator(Test.GENERAL_BOOLEAN);
msg.setTtsChunks(Test.GENERAL_TTSCHUNK_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
+ msg.setAlertIcon(Test.GENERAL_IMAGE);
return msg;
}
@@ -65,6 +68,8 @@ public class AlertTests extends BaseRpcTests{
result.put(Alert.KEY_PROGRESS_INDICATOR, Test.GENERAL_BOOLEAN);
result.put(Alert.KEY_TTS_CHUNKS, Test.JSON_TTSCHUNKS);
result.put(Alert.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(Alert.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ result.put(Alert.KEY_ALERT_ICON, Test.JSON_IMAGE);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -85,6 +90,8 @@ public class AlertTests extends BaseRpcTests{
boolean testProgressIndicator = ( (Alert) msg ).getProgressIndicator();
List<TTSChunk> testTtsChunks = ( (Alert) msg ).getTtsChunks();
List<SoftButton> testSoftButtons = ( (Alert) msg ).getSoftButtons();
+ Integer testCancelID = ( (Alert) msg ).getCancelID();
+ Image alertIcon = ( (Alert) msg ).getAlertIcon();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_INT, testDuration);
@@ -95,6 +102,8 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testProgressIndicator);
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTtsChunks));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+ assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, alertIcon));
// Invalid/Null Tests
Alert msg = new Alert();
@@ -109,6 +118,8 @@ public class AlertTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getProgressIndicator());
assertNull(Test.NULL, msg.getTtsChunks());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
+ assertNull(Test.NULL, msg.getAlertIcon());
}
/**
@@ -135,6 +146,7 @@ public class AlertTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_2), cmd.getAlertText2());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Alert.KEY_ALERT_TEXT_3), cmd.getAlertText3());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Alert.KEY_PROGRESS_INDICATOR), cmd.getProgressIndicator());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Alert.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray ttsChunkArray = JsonUtils.readJsonArrayFromJsonObject(parameters, Alert.KEY_TTS_CHUNKS);
List<TTSChunk> ttsChunkList = new ArrayList<TTSChunk>();
@@ -151,7 +163,11 @@ public class AlertTests extends BaseRpcTests{
softButtonList.add(chunk);
}
assertTrue(Test.TRUE, Validator.validateSoftButtons(softButtonList, cmd.getSoftButtons()));
- } catch (JSONException e) {
+
+ JSONObject alertIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, Alert.KEY_ALERT_ICON);
+ Image referenceAlertIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(alertIcon));
+ assertTrue(Test.TRUE, Validator.validateImage(referenceAlertIcon, cmd.getAlertIcon()));
+ } catch (JSONException e) {
fail(Test.JSON_FAIL);
}
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
index f16a3a87c..6f90585d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ButtonPressTests.java
@@ -30,6 +30,7 @@ public class ButtonPressTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setButtonPressMode(Test.GENERAL_BUTTONPRESSMODE);
msg.setButtonName(Test.GENERAL_BUTTONNAME);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -52,6 +53,7 @@ public class ButtonPressTests extends BaseRpcTests {
result.put(ButtonPress.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(ButtonPress.KEY_BUTTON_NAME, Test.GENERAL_BUTTONNAME);
result.put(ButtonPress.KEY_BUTTON_PRESS_MODE, Test.GENERAL_BUTTONPRESSMODE);
+ result.put(ButtonPress.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -67,11 +69,13 @@ public class ButtonPressTests extends BaseRpcTests {
ModuleType testModuleType = ( (ButtonPress) msg ).getModuleType();
ButtonName testButtonName = ( (ButtonPress) msg ).getButtonName();
ButtonPressMode testButtonPressMode = ( (ButtonPress) msg ).getButtonPressMode();
+ String testButtonId = ((ButtonPress) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONNAME, testButtonName);
assertEquals(Test.MATCH, Test.GENERAL_BUTTONPRESSMODE, testButtonPressMode);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testButtonId);
// Invalid/Null Tests
ButtonPress msg = new ButtonPress();
@@ -81,6 +85,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getButtonName());
assertNull(Test.NULL, msg.getButtonPressMode());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -106,6 +111,7 @@ public class ButtonPressTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_NAME).toString(), cmd.getButtonName().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_BUTTON_PRESS_MODE).toString(), cmd.getButtonPressMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ButtonPress.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
new file mode 100644
index 000000000..8735bea9c
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CancelInteractionTests.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/17/19 10:06 AM
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteraction}
+ */
+public class CancelInteractionTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ CancelInteraction msg = new CancelInteraction();
+ msg.setInteractionFunctionID(Test.GENERAL_INTEGER);
+ msg.setCancelID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(CancelInteraction.KEY_FUNCTION_ID, Test.GENERAL_INTEGER);
+ result.put(CancelInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer testFunctionID = ((CancelInteraction) msg).getInteractionFunctionID();
+ Integer testCancelID = ((CancelInteraction) msg).getCancelID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testFunctionID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
+ // Invalid/Null Tests
+ CancelInteraction msg = new CancelInteraction();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getInteractionFunctionID());
+ assertNull(Test.NULL, msg.getCancelID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteraction cmd = new CancelInteraction(hash);
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_FUNCTION_ID), cmd.getInteractionFunctionID());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CancelInteraction.KEY_CANCEL_ID), cmd.getCancelID());
+ }
+ catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
new file mode 100644
index 000000000..9d8debf20
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CloseApplicationTests.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/11/19 10:06 AM
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CloseApplication;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CloseApplication}
+ */
+public class CloseApplicationTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new CloseApplication();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CLOSE_APPLICATION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ CloseApplication msg = new CloseApplication();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CloseApplication cmd = new CloseApplication(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ }
+ catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
new file mode 100644
index 000000000..cb039a7d3
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/CreateWindowTests.java
@@ -0,0 +1,122 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CreateWindow;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CreateWindow}
+ */
+public class CreateWindowTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ CreateWindow msg = new CreateWindow();
+
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setWindowName(Test.GENERAL_STRING);
+ msg.setType(Test.GENERAL_WINDOWTYPE);
+ msg.setAssociatedServiceType(Test.GENERAL_STRING);
+ msg.setDuplicateUpdatesFromWindowID(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.CREATE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(CreateWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(CreateWindow.KEY_WINDOW_NAME, Test.GENERAL_STRING);
+ result.put(CreateWindow.KEY_TYPE, Test.GENERAL_WINDOWTYPE);
+ result.put(CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE, Test.GENERAL_STRING);
+ result.put(CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, Test.GENERAL_INT);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int testWindowID = ((CreateWindow) msg).getWindowID();
+ String testWindowName = ((CreateWindow) msg).getWindowName();
+ WindowType testType = ((CreateWindow) msg).getType();
+ String testAssociatedServiceType = ((CreateWindow) msg).getAssociatedServiceType();
+ int testDuplicateUpdatesFromWindowID = ((CreateWindow) msg).getDuplicateUpdatesFromWindowID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testWindowName);
+ assertEquals(Test.MATCH, Test.GENERAL_WINDOWTYPE, testType);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testAssociatedServiceType);
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testDuplicateUpdatesFromWindowID);
+
+ // Invalid/Null Tests
+ CreateWindow msg = new CreateWindow();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getWindowName());
+ assertNull(Test.NULL, msg.getType());
+ assertNull(Test.NULL, msg.getAssociatedServiceType());
+ assertNull(Test.NULL, msg.getDuplicateUpdatesFromWindowID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CreateWindow cmd = new CreateWindow(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_WINDOW_NAME).toString(), cmd.getWindowName().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_TYPE).toString(), cmd.getType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, CreateWindow.KEY_ASSOCIATED_SERVICE_TYPE).toString(), cmd.getAssociatedServiceType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, CreateWindow.KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID), cmd.getDuplicateUpdatesFromWindowID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
new file mode 100644
index 000000000..48080615f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/DeleteWindowTests.java
@@ -0,0 +1,97 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DeleteWindow;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DeleteWindow}
+ */
+public class DeleteWindowTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ DeleteWindow msg = new DeleteWindow();
+
+ msg.setWindowID(Test.GENERAL_INT);
+
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.DELETE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(DeleteWindow.KEY_WINDOW_ID, Test.GENERAL_INT);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Test Values
+ int testWindowID = ((DeleteWindow) msg).getWindowID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INT, testWindowID);
+
+ // Invalid/Null Tests
+ DeleteWindow msg = new DeleteWindow();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.NULL, msg.getWindowID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteWindow cmd = new DeleteWindow(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, DeleteWindow.KEY_WINDOW_ID), cmd.getWindowID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
new file mode 100644
index 000000000..15a902a84
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataConsentTests.java
@@ -0,0 +1,94 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsent;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleIds(Test.GENERAL_STRING_LIST);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(GetInteriorVehicleDataConsent.KEY_MODULE_ID, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((GetInteriorVehicleDataConsent) msg).getModuleType();
+ List<String> ids = ((GetInteriorVehicleDataConsent) msg).getModuleIds();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, ids);
+
+ //null tests
+ GetInteriorVehicleDataConsent msg = new GetInteriorVehicleDataConsent();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleIds());
+
+ //test require param constructor
+ GetInteriorVehicleDataConsent msg2 = new GetInteriorVehicleDataConsent(Test.GENERAL_MODULETYPE, Test.GENERAL_STRING_LIST);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
+ assertEquals(Test.MATCH, Test.GENERAL_STRING_LIST, msg2.getModuleIds());
+
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsent cmd = new GetInteriorVehicleDataConsent(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, GetInteriorVehicleDataConsent.KEY_MODULE_ID), cmd.getModuleIds());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
index 5a08d4266..dd175ae6f 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetInteriorVehicleDataTests.java
@@ -27,6 +27,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
msg.setModuleType(Test.GENERAL_MODULETYPE);
msg.setSubscribe(Test.GENERAL_BOOLEAN);
+ msg.setModuleId(Test.GENERAL_STRING);
return msg;
}
@@ -48,6 +49,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
try{
result.put(GetInteriorVehicleData.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
result.put(GetInteriorVehicleData.KEY_SUBSCRIBE, Test.GENERAL_BOOLEAN);
+ result.put(GetInteriorVehicleData.KEY_MODULE_ID, Test.GENERAL_STRING);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -62,10 +64,12 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
// Test Values
ModuleType testModuleType = ( (GetInteriorVehicleData) msg ).getModuleType();
boolean testSubscribed = ( (GetInteriorVehicleData) msg ).getSubscribe();
+ String testModuleId = ((GetInteriorVehicleData) msg).getModuleId();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, testModuleType);
assertEquals(Test.MATCH, Test.GENERAL_BOOLEAN, testSubscribed);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, testModuleId);
// Invalid/Null Tests
GetInteriorVehicleData msg = new GetInteriorVehicleData();
@@ -74,6 +78,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getModuleType());
assertNull(Test.NULL, msg.getSubscribe());
+ assertNull(Test.NULL, msg.getModuleId());
}
/**
@@ -98,6 +103,7 @@ public class GetInteriorVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_SUBSCRIBE), cmd.getSubscribe());
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, GetInteriorVehicleData.KEY_MODULE_ID), cmd.getModuleId());
}catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
index e47560a7c..99577fb46 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/GetVehicleDataTests.java
@@ -53,6 +53,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_BOOLEAN);
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -101,6 +102,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
result.put(GetVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -143,6 +145,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getFuelRange());
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getTurnSignal());
assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(Test.TRUE, ( (GetVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleData msg = new GetVehicleData();
@@ -178,6 +181,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -228,6 +232,7 @@ public class GetVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, GetVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
index e415d8382..cd3ea00b4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/PerformInteractionTests.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.PerformInteraction}
+ * {@link com.smartdevicelink.proxy.rpc.PerformInteraction}
*/
public class PerformInteractionTests extends BaseRpcTests {
@@ -41,6 +41,7 @@ public class PerformInteractionTests extends BaseRpcTests {
msg.setInitialText(Test.GENERAL_STRING);
msg.setInteractionMode(Test.GENERAL_INTERACTIONMODE);
msg.setTimeout(Test.GENERAL_INT);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -68,7 +69,8 @@ public class PerformInteractionTests extends BaseRpcTests {
result.put(PerformInteraction.KEY_INTERACTION_LAYOUT, Test.GENERAL_LAYOUTMODE);
result.put(PerformInteraction.KEY_INITIAL_TEXT, Test.GENERAL_STRING);
result.put(PerformInteraction.KEY_INTERACTION_MODE, Test.GENERAL_INTERACTIONMODE);
- result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_TIMEOUT, Test.GENERAL_INT);
+ result.put(PerformInteraction.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -90,6 +92,7 @@ public class PerformInteractionTests extends BaseRpcTests {
String testInitialText = ( (PerformInteraction) msg).getInitialText();
InteractionMode testMode = ( (PerformInteraction) msg).getInteractionMode();
Integer testTimeout = ( (PerformInteraction) msg).getTimeout();
+ Integer testCancelID = ( (PerformInteraction) msg ).getCancelID();
// Valid Tests
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testInitialPrompt));
@@ -101,6 +104,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertEquals(Test.MATCH, Test.GENERAL_STRING, testInitialText);
assertEquals(Test.MATCH, Test.GENERAL_INTERACTIONMODE, testMode);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invald/Null Tests
PerformInteraction msg = new PerformInteraction();
@@ -117,6 +121,7 @@ public class PerformInteractionTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getInitialText());
assertNull(Test.NULL, msg.getInteractionMode());
assertNull(Test.NULL, msg.getTimeout());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -140,6 +145,7 @@ public class PerformInteractionTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INITIAL_TEXT), cmd.getInitialText());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_MODE), cmd.getInteractionMode().toString());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, PerformInteraction.KEY_CANCEL_ID), cmd.getCancelID());
List<Integer> interactionIDList = JsonUtils.readIntegerListFromJsonObject(parameters, PerformInteraction.KEY_INTERACTION_CHOICE_SET_ID_LIST);
List<Integer> testIDList = cmd.getInteractionChoiceSetIDList();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
new file mode 100644
index 000000000..c2bd3b3d6
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ReleaseInteriorVehicleDataModuleTests.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModule;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ msg.setModuleType(Test.GENERAL_MODULETYPE);
+ msg.setModuleId(Test.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+ try {
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE, Test.GENERAL_MODULETYPE);
+ result.put(ReleaseInteriorVehicleDataModule.KEY_MODULE_ID, Test.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ public void testRpcValues() {
+ ModuleType type = ((ReleaseInteriorVehicleDataModule) msg).getModuleType();
+ String id = ((ReleaseInteriorVehicleDataModule) msg).getModuleId();
+
+ //valid tests
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, type);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, id);
+
+ //null tests
+ ReleaseInteriorVehicleDataModule msg = new ReleaseInteriorVehicleDataModule();
+ assertNull(Test.NULL, msg.getModuleType());
+ assertNull(Test.NULL, msg.getModuleId());
+
+ // required param tests
+ ReleaseInteriorVehicleDataModule msg2 = new ReleaseInteriorVehicleDataModule(Test.GENERAL_MODULETYPE);
+ assertEquals(Test.MATCH, Test.GENERAL_MODULETYPE, msg2.getModuleType());
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModule cmd = new ReleaseInteriorVehicleDataModule(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_TYPE).toString(), cmd.getModuleType().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringListFromJsonObject(parameters, ReleaseInteriorVehicleDataModule.KEY_MODULE_ID), cmd.getModuleId());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
index 2a4e14a6a..195cb7973 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ScrollableMessageTests.java
@@ -21,7 +21,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.ScrollableMessage}
+ * {@link com.smartdevicelink.proxy.rpc.ScrollableMessage}
*/
public class ScrollableMessageTests extends BaseRpcTests {
@@ -32,6 +32,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
msg.setScrollableMessageBody(Test.GENERAL_STRING);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -53,7 +54,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
try {
result.put(ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY, Test.GENERAL_STRING);
result.put(ScrollableMessage.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
+ result.put(ScrollableMessage.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -69,6 +71,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
String testBody = ( (ScrollableMessage) msg ).getScrollableMessageBody();
Integer testTimeout = ( (ScrollableMessage) msg ).getTimeout();
List<SoftButton> testSoftButtons = ( (ScrollableMessage) msg ).getSoftButtons();
+ Integer testCancelID = ( (ScrollableMessage) msg ).getCancelID();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testBody);
@@ -77,7 +80,8 @@ public class ScrollableMessageTests extends BaseRpcTests {
for (int i = 0; i < Test.GENERAL_SOFTBUTTON_LIST.size(); i++) {
assertEquals(Test.MATCH, Test.GENERAL_SOFTBUTTON_LIST.get(i), testSoftButtons.get(i));
}
-
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
+
// Invalid/Null Tests
ScrollableMessage msg = new ScrollableMessage();
assertNotNull(Test.NOT_NULL, msg);
@@ -87,6 +91,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getScrollableMessageBody());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getSoftButtons());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -110,6 +115,7 @@ public class ScrollableMessageTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, ScrollableMessage.KEY_SCROLLABLE_MESSAGE_BODY), cmd.getScrollableMessageBody());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, ScrollableMessage.KEY_CANCEL_ID), cmd.getCancelID());
JSONArray softButtonArray = JsonUtils.readJsonArrayFromJsonObject(parameters, ScrollableMessage.KEY_SOFT_BUTTONS);
List<SoftButton> softButtonList = new ArrayList<SoftButton>();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
index 7f08fb332..f56cab807 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetDisplayLayoutTests.java
@@ -19,7 +19,7 @@ import java.util.Hashtable;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayout}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayout}
*/
public class SetDisplayLayoutTests extends BaseRpcTests {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
index 969ae9522..1ca333e73 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SetGlobalPropertiesTests.java
@@ -8,6 +8,7 @@ import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.VrHelpItem;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.Test;
@@ -24,7 +25,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetGlobalProperties}
+ * {@link com.smartdevicelink.proxy.rpc.SetGlobalProperties}
*/
public class SetGlobalPropertiesTests extends BaseRpcTests {
@@ -39,6 +40,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
msg.setHelpPrompt(Test.GENERAL_TTSCHUNK_LIST);
msg.setTimeoutPrompt(Test.GENERAL_TTSCHUNK_LIST);
msg.setKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES);
+ msg.setMenuLayout(Test.GENERAL_MENU_LAYOUT);
return msg;
}
@@ -64,7 +66,8 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
result.put(SetGlobalProperties.KEY_TIMEOUT_PROMPT, Test.JSON_TTSCHUNKS);
result.put(SetGlobalProperties.KEY_MENU_TITLE, Test.GENERAL_STRING);
result.put(SetGlobalProperties.KEY_VR_HELP_TITLE, Test.GENERAL_STRING);
- result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, Test.JSON_KEYBOARDPROPERTIES);
+ result.put(SetGlobalProperties.KEY_KEYBOARD_PROPERTIES, Test.JSON_KEYBOARDPROPERTIES);
+ result.put(SetGlobalProperties.KEY_MENU_LAYOUT, Test.GENERAL_MENU_LAYOUT);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -84,6 +87,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
List<TTSChunk> testTimeout = ( (SetGlobalProperties) msg ).getTimeoutPrompt();
List<VrHelpItem> testVrHelpItems = ( (SetGlobalProperties) msg ).getVrHelp();
KeyboardProperties testKeyboardProperties = ( (SetGlobalProperties) msg ).getKeyboardProperties();
+ MenuLayout testMenuLayout = ( (SetGlobalProperties) msg ).getMenuLayout();
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testMenuTitle);
@@ -93,6 +97,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testHelpPrompt));
assertTrue(Test.TRUE, Validator.validateTtsChunks(Test.GENERAL_TTSCHUNK_LIST, testTimeout));
assertTrue(Test.TRUE, Validator.validateKeyboardProperties(Test.GENERAL_KEYBOARDPROPERTIES, testKeyboardProperties));
+ assertEquals(Test.MATCH, Test.GENERAL_MENU_LAYOUT, testMenuLayout);
// Invalid/Null Tests
SetGlobalProperties msg = new SetGlobalProperties();
@@ -106,6 +111,7 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getTimeoutPrompt());
assertNull(Test.NULL, msg.getKeyboardProperties());
assertNull(Test.NULL, msg.getVrHelpTitle());
+ assertNull(Test.NULL, msg.getMenuLayout());
}
/**
@@ -129,6 +135,8 @@ public class SetGlobalPropertiesTests extends BaseRpcTests {
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_VR_HELP_TITLE), cmd.getVrHelpTitle());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_TITLE), cmd.getMenuTitle());
+
+ assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_LAYOUT), cmd.getMenuLayout());
JSONObject menuIcon = JsonUtils.readJsonObjectFromJsonObject(parameters, SetGlobalProperties.KEY_MENU_ICON);
Image referenceMenuIcon = new Image(JsonRPCMarshaller.deserializeJSONObject(menuIcon));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
new file mode 100644
index 000000000..07ff2fbfc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowAppMenuTests.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/16/19 2:27 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.ShowAppMenu}
+ */
+public class ShowAppMenuTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ ShowAppMenu msg = new ShowAppMenu();
+ msg.setMenuID(Test.GENERAL_INTEGER);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(ShowAppMenu.KEY_MENU_ID, Test.GENERAL_INTEGER);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ Integer copy = ( (ShowAppMenu) msg ).getMenuID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, copy);
+
+ // Invalid/Null Tests
+ ShowAppMenu msg = new ShowAppMenu();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getMenuID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenu cmd = new ShowAppMenu(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ Integer serviceID = JsonUtils.readIntegerFromJsonObject(parameters, ShowAppMenu.KEY_MENU_ID);
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, serviceID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
index 91f4c52d7..77f6e65e7 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/ShowTests.java
@@ -7,6 +7,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
+import com.smartdevicelink.proxy.rpc.TemplateConfiguration;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.JsonUtils;
@@ -27,23 +28,26 @@ import java.util.List;
* {@link com.smartdevicelink.proxy.rpc.Show}
*/
public class ShowTests extends BaseRpcTests {
-
+
@Override
protected RPCMessage createMessage() {
Show msg = new Show();
-
+
msg.setMainField1(Test.GENERAL_STRING);
msg.setMainField2(Test.GENERAL_STRING);
msg.setMainField3(Test.GENERAL_STRING);
msg.setMainField4(Test.GENERAL_STRING);
msg.setStatusBar(Test.GENERAL_STRING);
msg.setMediaTrack(Test.GENERAL_STRING);
+ msg.setTemplateTitle(Test.GENERAL_STRING);
msg.setAlignment(Test.GENERAL_TEXTALIGNMENT);
msg.setGraphic(Test.GENERAL_IMAGE);
msg.setSecondaryGraphic(Test.GENERAL_IMAGE);
msg.setCustomPresets(Test.GENERAL_STRING_LIST);
msg.setSoftButtons(Test.GENERAL_SOFTBUTTON_LIST);
msg.setMetadataTags(Test.GENERAL_METADATASTRUCT);
+ msg.setWindowID(Test.GENERAL_INT);
+ msg.setTemplateConfiguration(Test.GENERAL_TEMPLATE_CONFIGURATION);
return msg;
}
@@ -62,29 +66,33 @@ public class ShowTests extends BaseRpcTests {
protected JSONObject getExpectedParameters(int sdlVersion) {
JSONObject result = new JSONObject();
- try {
+ try {
result.put(Show.KEY_MAIN_FIELD_1, Test.GENERAL_STRING);
result.put(Show.KEY_MAIN_FIELD_2, Test.GENERAL_STRING);
result.put(Show.KEY_MAIN_FIELD_3, Test.GENERAL_STRING);
result.put(Show.KEY_MAIN_FIELD_4, Test.GENERAL_STRING);
result.put(Show.KEY_STATUS_BAR, Test.GENERAL_STRING);
result.put(Show.KEY_MEDIA_TRACK, Test.GENERAL_STRING);
+ result.put(Show.KEY_TEMPLATE_TITLE, Test.GENERAL_STRING);
result.put(Show.KEY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_SECONDARY_GRAPHIC, Test.JSON_IMAGE);
result.put(Show.KEY_ALIGNMENT, Test.GENERAL_TEXTALIGNMENT);
result.put(Show.KEY_CUSTOM_PRESETS, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Show.KEY_SOFT_BUTTONS, Test.JSON_SOFTBUTTONS);
result.put(Show.KEY_METADATA_TAGS, Test.GENERAL_METADATASTRUCT.serializeJSON());
+ result.put(Show.KEY_WINDOW_ID, Test.GENERAL_INT);
+ result.put(Show.KEY_TEMPLATE_CONFIGURATION, Test.GENERAL_TEMPLATE_CONFIGURATION.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
return result;
}
-
+
public void testSoftButtons () {
// TestValues
String testTrack = ( (Show) msg ).getMediaTrack();
+ String templateTitle = ( (Show) msg ).getTemplateTitle();
Image testGraphic2 = ( (Show) msg ).getSecondaryGraphic();
Image testGraphic1 = ( (Show) msg ).getGraphic();
String testStatusBar = ( (Show) msg ).getStatusBar();
@@ -96,9 +104,10 @@ public class ShowTests extends BaseRpcTests {
List<SoftButton> testSoftButtons = ( (Show) msg ).getSoftButtons();
List<String> testCustomPresets = ( (Show) msg ).getCustomPresets();
MetadataTags testMetadata = ( (Show) msg ).getMetadataTags();
-
+
// Valid Tests
assertEquals(Test.MATCH, Test.GENERAL_STRING, testTrack);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, templateTitle);
assertEquals(Test.MATCH, Test.GENERAL_TEXTALIGNMENT, testAlignment);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testStatusBar);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testText1);
@@ -110,7 +119,7 @@ public class ShowTests extends BaseRpcTests {
assertTrue(Test.TRUE, Validator.validateSoftButtons(Test.GENERAL_SOFTBUTTON_LIST, testSoftButtons));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic2));
assertTrue(Test.TRUE, Validator.validateImage(Test.GENERAL_IMAGE, testGraphic1));
-
+
// Invalid/Null Tests
Show msg = new Show();
assertNotNull(Test.NOT_NULL, msg);
@@ -126,8 +135,11 @@ public class ShowTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getSecondaryGraphic());
assertNull(Test.NULL, msg.getCustomPresets());
assertNull(Test.NULL, msg.getMediaTrack());
+ assertNull(Test.NULL, msg.getTemplateTitle());
assertNull(Test.NULL, msg.getSoftButtons());
assertNull(Test.NULL, msg.getMetadataTags());
+ assertNull(Test.NULL, msg.getWindowID());
+ assertNull(Test.NULL, msg.getTemplateConfiguration());
}
/**
@@ -166,7 +178,13 @@ public class ShowTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_STATUS_BAR), cmd.getStatusBar());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_ALIGNMENT), cmd.getAlignment().toString());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_MEDIA_TRACK), cmd.getMediaTrack());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_TEMPLATE_TITLE), cmd.getTemplateTitle());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Show.KEY_METADATA_TAGS), cmd.getMetadataTags());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Show.KEY_WINDOW_ID), cmd.getWindowID());
+
+ JSONObject templateConfiguration = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_TEMPLATE_CONFIGURATION);
+ TemplateConfiguration refTemplateConfiguration = new TemplateConfiguration(JsonRPCMarshaller.deserializeJSONObject(templateConfiguration));
+ assertTrue(Test.TRUE, Validator.validateTemplateConfiguration(refTemplateConfiguration, cmd.getTemplateConfiguration()));
JSONObject secondaryGraphic = JsonUtils.readJsonObjectFromJsonObject(parameters, Show.KEY_SECONDARY_GRAPHIC);
Image referenceSecondaryGraphic = new Image(JsonRPCMarshaller.deserializeJSONObject(secondaryGraphic));
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
index 12119b847..cce913632 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SliderTests.java
@@ -18,7 +18,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.Slider}
+ * {@link com.smartdevicelink.proxy.rpc.Slider}
*/
public class SliderTests extends BaseRpcTests {
@@ -31,6 +31,7 @@ public class SliderTests extends BaseRpcTests {
msg.setTimeout(Test.GENERAL_INT);
msg.setSliderHeader(Test.GENERAL_STRING);
msg.setSliderFooter(Test.GENERAL_STRING_LIST);
+ msg.setCancelID(Test.GENERAL_INTEGER);
return msg;
}
@@ -54,7 +55,8 @@ public class SliderTests extends BaseRpcTests {
result.put(Slider.KEY_SLIDER_FOOTER, JsonUtils.createJsonArray(Test.GENERAL_STRING_LIST));
result.put(Slider.KEY_POSITION, Test.GENERAL_INT);
result.put(Slider.KEY_TIMEOUT, Test.GENERAL_INT);
- result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_NUM_TICKS, Test.GENERAL_INT);
+ result.put(Slider.KEY_CANCEL_ID, Test.GENERAL_INTEGER);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -72,13 +74,15 @@ public class SliderTests extends BaseRpcTests {
Integer testPosition = ( (Slider) msg ).getPosition();
String testSlider = ( (Slider) msg ).getSliderHeader();
List<String> testFooter = ( (Slider) msg ).getSliderFooter();
-
+ Integer testCancelID = ( (Slider) msg ).getCancelID();
+
// Valid Tests
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testNumTicks);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testTimeout);
assertEquals(Test.MATCH, (Integer) Test.GENERAL_INT, testPosition);
assertEquals(Test.MATCH, Test.GENERAL_STRING, testSlider);
assertTrue(Test.TRUE, Validator.validateStringList(Test.GENERAL_STRING_LIST, testFooter));
+ assertEquals(Test.MATCH, Test.GENERAL_INTEGER, testCancelID);
// Invalid/Null Tests
Slider msg = new Slider();
@@ -90,6 +94,7 @@ public class SliderTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getPosition());
assertNull(Test.NULL, msg.getTimeout());
assertNull(Test.NULL, msg.getNumTicks());
+ assertNull(Test.NULL, msg.getCancelID());
}
/**
@@ -121,6 +126,7 @@ public class SliderTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_POSITION), cmd.getPosition());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_TIMEOUT), cmd.getTimeout());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(parameters, Slider.KEY_CANCEL_ID), cmd.getCancelID());
}
catch (JSONException e) {
fail(Test.JSON_FAIL);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
index a629f18b8..6cfeb8816 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/SubscribeVehicleDataTests.java
@@ -52,6 +52,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_BOOLEAN);
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -99,6 +100,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
result.put(SubscribeVehicleData.KEY_FUEL_RANGE, Test.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -140,6 +142,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getFuelRange());
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getTurnSignal());
assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
+ assertTrue(Test.MATCH,( (SubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleData msg = new SubscribeVehicleData();
@@ -174,6 +177,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -223,6 +227,7 @@ public class SubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_FUEL_RANGE), cmd.getFuelRange());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, SubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
new file mode 100644
index 000000000..1bc0532f8
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnpublishAppServiceTests.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/12/19 2:12 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.requests;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.UnpublishAppService;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.UnpublishAppService}
+ */
+public class UnpublishAppServiceTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ UnpublishAppService msg = new UnpublishAppService();
+ msg.setServiceID(Test.GENERAL_STRING);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_REQUEST;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.UNPUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try {
+ result.put(UnpublishAppService.KEY_SERVICE_ID, Test.GENERAL_STRING);
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Test Values
+ String copy = ( (UnpublishAppService) msg ).getServiceID();
+
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, copy);
+
+ // Invalid/Null Tests
+ UnpublishAppService msg = new UnpublishAppService();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+
+ assertNull(Test.MATCH, msg.getServiceID());
+ }
+
+ /**
+ * Tests constructor with required params
+ */
+ public void testRequiredParamsConstructor () {
+
+ UnpublishAppService msg = new UnpublishAppService(Test.GENERAL_STRING);
+ assertNotNull(Test.NOT_NULL, msg);
+ // Valid Tests
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, msg.getServiceID());
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnpublishAppService cmd = new UnpublishAppService(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+
+ String serviceID = JsonUtils.readStringFromJsonObject(parameters, UnpublishAppService.KEY_SERVICE_ID);
+ assertEquals(Test.MATCH, Test.GENERAL_STRING, serviceID);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
index 975a452db..634bb8ee6 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/requests/UnsubscribeVehicleDataTests.java
@@ -54,6 +54,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
msg.setTurnSignal(Test.GENERAL_BOOLEAN);
msg.setElectronicParkBrakeStatus(Test.GENERAL_BOOLEAN);
msg.setCloudAppVehicleID(Test.GENERAL_BOOLEAN);
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
return msg;
}
@@ -102,6 +103,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
result.put(UnsubscribeVehicleData.KEY_TURN_SIGNAL, Test.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_BOOLEAN);
result.put(UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID, Test.GENERAL_BOOLEAN);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_BOOLEAN);
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -143,6 +145,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getTurnSignal());
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getElectronicParkBrakeStatus());
assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getCloudAppVehicleID());
+ assertTrue(Test.TRUE,( (UnsubscribeVehicleData) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleData msg = new UnsubscribeVehicleData();
@@ -178,6 +181,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
assertNull(Test.NULL, msg.getCloudAppVehicleID());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -228,6 +232,7 @@ public class UnsubscribeVehicleDataTests extends BaseRpcTests {
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_TURN_SIGNAL), cmd.getTurnSignal());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus());
assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, UnsubscribeVehicleData.KEY_CLOUD_APP_VEHICLE_ID), cmd.getCloudAppVehicleID());
+ assertEquals(Test.MATCH, JsonUtils.readBooleanFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
catch (JSONException e) {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
new file mode 100644
index 000000000..e983327f2
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CancelInteractionResponseTests.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:35 AM
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CancelInteractionResponse}
+ */
+public class CancelInteractionResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new CancelInteractionResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CANCEL_INTERACTION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ CancelInteractionResponse msg = new CancelInteractionResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CancelInteractionResponse cmd = new CancelInteractionResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
new file mode 100644
index 000000000..eb56a5293
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CloseApplicationResponseTests.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/11/19 10:47 AM
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CloseApplicationResponse}
+ */
+public class CloseApplicationResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new CloseApplicationResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.CLOSE_APPLICATION.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ CloseApplicationResponse msg = new CloseApplicationResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CloseApplicationResponse cmd = new CloseApplicationResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
new file mode 100644
index 000000000..8099a9ce7
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/CreateWindowResponseTest.java
@@ -0,0 +1,74 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.CreateWindowResponse}
+ */
+public class CreateWindowResponseTest extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new CreateWindowResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.CREATE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ CreateWindowResponse msg = new CreateWindowResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ CreateWindowResponse cmd = new CreateWindowResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
new file mode 100644
index 000000000..01bcd1491
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/DeleteWindowResponseTest.java
@@ -0,0 +1,74 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.DeleteWindowResponse}
+ */
+public class DeleteWindowResponseTest extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ return new DeleteWindowResponse();
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.DELETE_WINDOW.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues() {
+ // Invalid/Null Tests
+ DeleteWindowResponse msg = new DeleteWindowResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ DeleteWindowResponse cmd = new DeleteWindowResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
new file mode 100644
index 000000000..e100f4b86
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetInteriorVehicleDataConsentResponseTests.java
@@ -0,0 +1,82 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage() {
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse();
+ msg.setAllowances(Test.GENERAL_BOOLEAN_LIST);
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ JSONObject result = new JSONObject();
+
+ try{
+ result.put(GetInteriorVehicleDataConsentResponse.KEY_ALLOWED, JsonUtils.createJsonArray(Test.GENERAL_BOOLEAN_LIST));
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ return result;
+ }
+
+ public void testRpcValues() {
+ List<Boolean> list = ((GetInteriorVehicleDataConsentResponse) msg).getAllowances();
+ assertEquals(Test.MATCH, list, Test.GENERAL_BOOLEAN_LIST);
+ }
+
+ public void testRequiredParams(){
+ GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(true, Result.SUCCESS);
+ assertTrue(msg.getSuccess());
+ assertEquals(Test.MATCH, msg.getResultCode(), Result.SUCCESS);
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ GetInteriorVehicleDataConsentResponse cmd = new GetInteriorVehicleDataConsentResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+
+ JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
+ assertEquals(Test.MATCH, JsonUtils.readBooleanListFromJsonObject(parameters,
+ GetInteriorVehicleDataConsentResponse.KEY_ALLOWED), cmd.getAllowances());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
index 83bd72cf7..fbba38025 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/GetVehicleDataResponseTests.java
@@ -90,6 +90,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
result.put(GetVehicleDataResponse.KEY_FUEL_RANGE, VehicleDataHelper.JSON_FUEL_RANGE);
result.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, VehicleDataHelper.TURN_SIGNAL);
result.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
} catch(JSONException e){
fail(Test.JSON_FAIL);
}
@@ -157,6 +158,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
GPSDataObj.put(GPSData.KEY_ALTITUDE, VehicleDataHelper.GPS_ALTITUDE);
GPSDataObj.put(GPSData.KEY_HEADING, VehicleDataHelper.GPS_HEADING);
GPSDataObj.put(GPSData.KEY_SPEED, VehicleDataHelper.GPS_SPEED);
+ GPSDataObj.put(GPSData.KEY_SHIFTED, VehicleDataHelper.GPS_SHIFTED);
//BELT_STATUS
beltStatusObj.put(BeltStatus.KEY_DRIVER_BELT_DEPLOYED, VehicleDataHelper.BELT_STATUS_DRIVER_DEPLOYED);
@@ -267,6 +269,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
reference.put(GetVehicleDataResponse.KEY_FUEL_RANGE, fuelRangeArrayObj);
reference.put(GetVehicleDataResponse.KEY_TURN_SIGNAL, TurnSignal.OFF);
reference.put(GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS);
+ reference.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE);
JSONObject underTest = msg.serializeJSON();
@@ -449,6 +452,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(Test.MATCH, VehicleDataHelper.MY_KEY, ( (GetVehicleDataResponse) msg ).getMyKey());
assertEquals(Test.MATCH, VehicleDataHelper.TURN_SIGNAL, ( (GetVehicleDataResponse) msg ).getTurnSignal());
assertEquals(Test.MATCH, VehicleDataHelper.ELECTRONIC_PARK_BRAKE_STATUS, ( (GetVehicleDataResponse) msg ).getElectronicParkBrakeStatus());
+ assertEquals(Test.MATCH, VehicleDataHelper.OEM_CUSTOM_VEHICLE_DATA_STATE, ( (GetVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
GetVehicleDataResponse msg = new GetVehicleDataResponse();
@@ -482,6 +486,7 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertNull(Test.NULL, msg.getMyKey());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
@@ -570,8 +575,9 @@ public class GetVehicleDataResponseTests extends BaseRpcTests{
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_TURN_SIGNAL), cmd.getTurnSignal().toString());
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, GetVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS), cmd.getElectronicParkBrakeStatus().toString());
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME), cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
} catch (JSONException e) {
e.printStackTrace();
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
new file mode 100644
index 000000000..f1d2b6e5a
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ReleaseInteriorVehicleDataModuleResponseTests.java
@@ -0,0 +1,56 @@
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponseTests extends BaseRpcTests {
+ @Override
+ protected RPCMessage createMessage() {
+ ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse();
+ return msg;
+ }
+
+ @Override
+ protected String getMessageType() {
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType() {
+ return FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion) {
+ return new JSONObject();
+ }
+
+ public void testJsonConstructor() {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ReleaseInteriorVehicleDataModuleResponse cmd = new ReleaseInteriorVehicleDataModuleResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ fail(Test.JSON_FAIL);
+ }
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
index ec0bef668..f6ea2e691 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SetDisplayLayoutResponseTest.java
@@ -24,7 +24,7 @@ import java.util.List;
/**
* This is a unit test class for the SmartDeviceLink library project class :
- * {@link com.smartdevicelink.rpc.SetDisplayLayoutResponse}
+ * {@link com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse}
*/
public class SetDisplayLayoutResponseTest extends BaseRpcTests {
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
new file mode 100644
index 000000000..397bf43cc
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/ShowAppMenuResponseTests.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/16/19 2:28 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+public class ShowAppMenuResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new ShowAppMenuResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.SHOW_APP_MENU.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ ShowAppMenuResponse msg = new ShowAppMenuResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ ShowAppMenuResponse cmd = new ShowAppMenuResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
index f121d783c..88eb20221 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/SubscribeVehicleDataResponseTest.java
@@ -57,6 +57,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -109,6 +110,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -149,6 +151,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (SubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (SubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (SubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
+ VehicleDataResult testOEMCustomVehicleData = ( (SubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
@@ -179,6 +182,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(Test.TRUE, testOEMCustomVehicleData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
SubscribeVehicleDataResponse msg = new SubscribeVehicleDataResponse();
@@ -213,6 +217,7 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -346,6 +351,10 @@ public class SubscribeVehicleDataResponseTest extends BaseRpcTests {
JSONObject electronicParkBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(electronicParkBrakeStatus));
assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject oemCustomVehicleDataName = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomVehicleDataName));
+ assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
new file mode 100644
index 000000000..ce99a1a4a
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnpublishAppServiceResponseTests.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/12/19 2:12 PM
+ *
+ */
+
+package com.smartdevicelink.test.rpc.responses;
+
+import com.smartdevicelink.marshal.JsonRPCMarshaller;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
+import com.smartdevicelink.test.BaseRpcTests;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.test.json.rpc.JsonFileReader;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Hashtable;
+
+/**
+ * This is a unit test class for the SmartDeviceLink library project class :
+ * {@link com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse}
+ */
+public class UnpublishAppServiceResponseTests extends BaseRpcTests {
+
+ @Override
+ protected RPCMessage createMessage(){
+ return new UnpublishAppServiceResponse();
+ }
+
+ @Override
+ protected String getMessageType(){
+ return RPCMessage.KEY_RESPONSE;
+ }
+
+ @Override
+ protected String getCommandType(){
+ return FunctionID.UNPUBLISH_APP_SERVICE.toString();
+ }
+
+ @Override
+ protected JSONObject getExpectedParameters(int sdlVersion){
+ return new JSONObject();
+ }
+
+ /**
+ * Tests the expected values of the RPC message.
+ */
+ public void testRpcValues () {
+ // Invalid/Null Tests
+ UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse();
+ assertNotNull(Test.NOT_NULL, msg);
+ testNullBase(msg);
+ }
+
+ /**
+ * Tests a valid JSON construction of this RPC message.
+ */
+ public void testJsonConstructor () {
+ JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
+ assertNotNull(Test.NOT_NULL, commandJson);
+
+ try {
+ Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
+ UnpublishAppServiceResponse cmd = new UnpublishAppServiceResponse(hash);
+
+ JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
+ assertNotNull(Test.NOT_NULL, body);
+
+ // Test everything in the json body.
+ assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
+ assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
index 2df9250eb..c2ba6e019 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/responses/UnsubscribeVehicleDataResponseTest.java
@@ -59,6 +59,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
msg.setFuelRange(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()));
msg.setTurnSignal(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()));
msg.setElectronicParkBrakeStatus(Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()));
+ msg.setOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA);
return msg;
}
@@ -111,6 +112,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
result.put(SubscribeVehicleDataResponse.KEY_FUEL_RANGE, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_FUELRANGE.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_TURN_SIGNAL, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_TURNSIGNAL.ordinal()).serializeJSON());
result.put(SubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS, Test.GENERAL_VEHICLEDATARESULT_LIST.get(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS.ordinal()).serializeJSON());
+ result.put(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA.serializeJSON());
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
@@ -151,6 +153,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
VehicleDataResult testFuelRange = ( (UnsubscribeVehicleDataResponse) msg ).getFuelRange();
VehicleDataResult testTurnSignal = ( (UnsubscribeVehicleDataResponse) msg ).getTurnSignal();
VehicleDataResult testEBrakeStatus = ( (UnsubscribeVehicleDataResponse) msg ).getElectronicParkBrakeStatus();
+ VehicleDataResult testOemCustomData = ( (UnsubscribeVehicleDataResponse) msg ).getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
// Valid Tests
assertTrue(Test.TRUE, testGps.getDataType().equals(VehicleDataType.VEHICLEDATA_GPS));
@@ -181,6 +184,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertTrue(Test.TRUE, testFuelRange.getDataType().equals(VehicleDataType.VEHICLEDATA_FUELRANGE));
assertTrue(Test.TRUE, testTurnSignal.getDataType().equals(VehicleDataType.VEHICLEDATA_TURNSIGNAL));
assertTrue(Test.TRUE, testEBrakeStatus.getDataType().equals(VehicleDataType.VEHICLEDATA_ELECTRONICPARKBRAKESTATUS));
+ assertTrue(Test.TRUE, testOemCustomData.getOEMCustomVehicleDataType().equals(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
// Invalid/Null Tests
UnsubscribeVehicleDataResponse msg = new UnsubscribeVehicleDataResponse();
@@ -215,6 +219,7 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
assertNull(Test.NULL, msg.getFuelRange());
assertNull(Test.NULL, msg.getTurnSignal());
assertNull(Test.NULL, msg.getElectronicParkBrakeStatus());
+ assertNull(Test.NULL, msg.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME));
}
/**
@@ -348,6 +353,10 @@ public class UnsubscribeVehicleDataResponseTest extends BaseRpcTests {
JSONObject eBrakeStatus = JsonUtils.readJsonObjectFromJsonObject(parameters, UnsubscribeVehicleDataResponse.KEY_ELECTRONIC_PARK_BRAKE_STATUS);
VehicleDataResult referenceEBrakeStatus = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(eBrakeStatus));
assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceEBrakeStatus, cmd.getElectronicParkBrakeStatus()));
+
+ JSONObject oemCustomData = JsonUtils.readJsonObjectFromJsonObject(parameters, Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME);
+ VehicleDataResult referenceOemCustomData = new VehicleDataResult(JsonRPCMarshaller.deserializeJSONObject(oemCustomData));
+ assertTrue(Test.TRUE, Validator.validateVehicleDataResult(referenceOemCustomData, cmd.getOEMCustomVehicleData(Test.GENERAL_OEM_CUSTOM_VEHICLE_DATA_NAME)));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
new file mode 100644
index 000000000..a81f69eb3
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/streaming/video/VideoStreamingParametersTest.java
@@ -0,0 +1,118 @@
+package com.smartdevicelink.test.streaming.video;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.proxy.rpc.ImageResolution;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
+import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
+import java.util.Collections;
+
+
+public class VideoStreamingParametersTest extends AndroidTestCase2 {
+
+ private VideoStreamingParameters params;
+ private VideoStreamingCapability capability;
+ private ImageResolution preferredResolution;
+
+ public void setUp() {
+ params = new VideoStreamingParameters();
+ capability = new VideoStreamingCapability();
+ }
+
+ public void testUpdateNullScale() {
+ preferredResolution = new ImageResolution(800, 354);
+
+ capability.setScale(null);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(800, width);
+ assertEquals(354, height);
+ }
+
+ public void testUpdateScale_1_Resolution_800_354() {
+ preferredResolution = new ImageResolution(800, 354);
+
+ capability.setScale(1.0);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(800, width);
+ assertEquals(354, height);
+ }
+
+ public void testUpdateScale_1_25_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.25);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(1024, width);
+ assertEquals(456, height);
+ }
+
+ public void testUpdateScale_1_5_Resolution_1280_569() {
+ preferredResolution = new ImageResolution(1280, 569);
+
+ capability.setScale(1.5);
+ capability.setPreferredResolution(preferredResolution);
+
+ params.update(capability);
+
+ int width = params.getResolution().getResolutionWidth();
+ int height = params.getResolution().getResolutionHeight();
+
+ assertEquals(854, width);
+ assertEquals(380, height);
+ }
+
+ public void testUpdateCapabilityFormat(){
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setMaxBitrate(10000);
+ capability.setPreferredResolution( new ImageResolution(800,600));
+ capability.setIsHapticSpatialDataSupported(false);
+
+ VideoStreamingFormat format = new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.H264);
+ capability.setSupportedFormats(Collections.singletonList(format));
+
+ VideoStreamingParameters params = new VideoStreamingParameters();
+ params.setFormat(null);
+
+ assertNull(params.getFormat());
+
+ params.update(capability);
+
+ assertEquals(params.getFormat(), format);
+
+ format = new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H264);
+ capability.setSupportedFormats(Collections.singletonList(format));
+ params.update(capability);
+ assertEquals(params.getFormat(), format);
+
+ format = new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H265);
+ capability.setSupportedFormats(Collections.singletonList(format));
+ params.update(capability);
+ assertFalse(params.getFormat().equals(format));
+
+ format = new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.VP8);
+ capability.setSupportedFormats(Collections.singletonList(format));
+ params.update(capability);
+ assertFalse(params.getFormat().equals(format));
+
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
new file mode 100644
index 000000000..5edd95ab5
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/CompareUtilsTest.java
@@ -0,0 +1,47 @@
+package com.smartdevicelink.test.util;
+
+import com.smartdevicelink.AndroidTestCase2;
+import com.smartdevicelink.test.Test;
+import com.smartdevicelink.util.CompareUtils;
+
+public class CompareUtilsTest extends AndroidTestCase2 {
+
+ public void testAreStringsEqual(){
+
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, true, true));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, false, true));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, true, false));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING, false, false));
+
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, true, true));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, false, true));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, true, false));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_APP_ID, false, false));
+
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), false, false));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), false, true));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), true, false));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING, Test.GENERAL_STRING.toUpperCase(), true, true));
+
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING, false, false));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING, false, true));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING.toUpperCase(), true, false));
+ assertTrue(CompareUtils.areStringsEqual(Test.GENERAL_STRING.toUpperCase(), Test.GENERAL_STRING.toUpperCase(), true, true));
+
+ assertTrue(CompareUtils.areStringsEqual(null, null, true, true));
+ assertFalse(CompareUtils.areStringsEqual(null, null, true, false));
+ assertTrue(CompareUtils.areStringsEqual(null, null, false, true));
+ assertFalse(CompareUtils.areStringsEqual(null, null, false, false));
+
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, true, true));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, true, false));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, false, true));
+ assertFalse(CompareUtils.areStringsEqual(Test.GENERAL_STRING, null, false, false));
+
+ assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, false, true));
+ assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, false, false));
+ assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, true, true));
+ assertFalse(CompareUtils.areStringsEqual(null, Test.GENERAL_STRING, true, false));
+
+ }
+}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
index 4798de56b..f9d3b8e0a 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/util/VersionTest.java
@@ -5,10 +5,11 @@ import com.smartdevicelink.util.Version;
public class VersionTest extends AndroidTestCase2 {
- private static final String TEST_VERSION = "1.2.3";
+ private static final String TEST_VERSION_STRING = "1.2.3";
+ private static final Version TEST_VERSION = new Version(1,2,3);
public void testConstructorCorrect(){
- Version version = new Version(TEST_VERSION);
+ Version version = new Version(TEST_VERSION_STRING);
assertEquals(1, version.getMajor());
assertEquals(2, version.getMinor());
assertEquals(3, version.getPatch());
@@ -24,8 +25,8 @@ public class VersionTest extends AndroidTestCase2 {
}
public void testToString(){
- Version version = new Version(TEST_VERSION);
- assertEquals(version.toString(), TEST_VERSION);
+ Version version = new Version(TEST_VERSION_STRING);
+ assertEquals(version.toString(), TEST_VERSION_STRING);
}
public void testisNewerThan(){
@@ -45,4 +46,17 @@ public class VersionTest extends AndroidTestCase2 {
assertEquals(0,version1.isNewerThan( new Version(5,0,0)));
}
+
+ public void testIsBetween(){
+
+ assertEquals(TEST_VERSION.isBetween(new Version(1,0,0), new Version (2,0,0)), 1);
+ assertEquals(TEST_VERSION.isBetween(new Version(2,0,0), new Version (1,0,0)), -1);
+ assertEquals(TEST_VERSION.isBetween(new Version(2,0,0), new Version (3,0,0)), -1);
+
+ assertEquals(TEST_VERSION.isBetween(new Version(1,0,0), new Version (1,2,3)), 0);
+ assertEquals(TEST_VERSION.isBetween(new Version(1,2,3), new Version (3,2,3)), 0);
+
+ assertEquals(TEST_VERSION.isBetween(new Version(1,2,3), new Version (1,2,3)), 0);
+
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
index 58fa8d576..33f9d885e 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java
@@ -107,6 +107,7 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
StreamPacketizer mAudioPacketizer = null;
SdlEncoder mSdlEncoder = null;
VirtualDisplayEncoder virtualDisplayEncoder = null;
+ boolean sdlSecurityInitializing = false;
public static SdlSession createSession(byte wiproVersion, ISdlConnectionListener listener, BaseTransportConfig btConfig) {
@@ -450,9 +451,12 @@ public class SdlSession implements ISdlConnectionListener, IHeartbeatMonitorList
if (!serviceList.contains(serviceType))
serviceList.add(serviceType);
- sdlSecurity.initialize();
+ if (!sdlSecurityInitializing) {
+ sdlSecurityInitializing = true;
+ sdlSecurity.initialize();
+ return;
+ }
}
- return;
}
_sdlConnection.startService(serviceType, sessionID, isEncrypted);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
index 457bd9a46..14258cbfe 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession2.java
@@ -45,6 +45,7 @@ import com.smartdevicelink.protocol.heartbeat.IHeartbeatMonitor;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.MediaStreamingStatus;
import com.smartdevicelink.util.Version;
@@ -82,8 +83,14 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
}
+ public SdlSession2(ISdlConnectionListener listener, TCPTransportConfig config){ //TODO is it better to have two constructors or make it take BaseTransportConfig?
+ this.transportConfig = config;
+ this.sessionListener = listener;
+ this.sdlProtocol = new SdlProtocol(this,config);
+ }
+
boolean isAudioRequirementMet(){
- if(mediaStreamingStatus == null){
+ if(mediaStreamingStatus == null && contextWeakReference!= null && contextWeakReference.get() != null){
mediaStreamingStatus = new MediaStreamingStatus(contextWeakReference.get(), new MediaStreamingStatus.Callback() {
@Override
public void onAudioNoLongerAvailable() {
@@ -147,9 +154,12 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
if (!serviceList.contains(serviceType))
serviceList.add(serviceType);
- sdlSecurity.initialize();
+ if (!sdlSecurityInitializing) {
+ sdlSecurityInitializing = true;
+ sdlSecurity.initialize();
+ return;
+ }
}
- return;
}
sdlProtocol.startService(serviceType, sessionID, isEncrypted);
}
@@ -247,8 +257,10 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
sessionID, version, correlationID, rejectedParams);
if(serviceListeners != null && serviceListeners.containsKey(sessionType)){
CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(sessionType);
- for(ISdlServiceListener listener:listeners){
- listener.onServiceError(this, sessionType, "Start "+ sessionType.toString() +" Service NAKed");
+ if(listeners != null) {
+ for (ISdlServiceListener listener : listeners) {
+ listener.onServiceError(this, sessionType, "Start " + sessionType.toString() + " Service NAKed");
+ }
}
}
}
@@ -304,7 +316,15 @@ public class SdlSession2 extends SdlSession implements ISdlProtocol{
}else if(SessionType.PCM.equals(serviceType)){
stopAudioStream();
}
-
+ // Notify any listeners of the service being ended
+ if(serviceListeners != null && serviceListeners.containsKey(serviceType)){
+ CopyOnWriteArrayList<ISdlServiceListener> listeners = serviceListeners.get(serviceType);
+ if (listeners != null && listeners.size() > 0) {
+ for (ISdlServiceListener listener : listeners) {
+ listener.onServiceEnded(this, serviceType);
+ }
+ }
+ }
}
@Override
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
index 9a6e44897..716fc16fc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/haptic/HapticInterfaceManager.java
@@ -28,6 +28,8 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -59,8 +61,8 @@ public class HapticInterfaceManager {
*/
public void setHapticData(List<HapticRect> hapticData) {
userHapticData = hapticData;
- ISdl proxy = proxyHolder.get();
- if (proxy != null) {
+ if(proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
SendHapticData msg = new SendHapticData();
msg.setHapticRectData(userHapticData);
proxy.sendRPCRequest(msg);
@@ -75,15 +77,17 @@ public class HapticInterfaceManager {
* the root or parent View
*/
public void refreshHapticData(View root) {
- ISdl proxy = proxyHolder.get();
- if ((userHapticData == null) && (proxy != null)) {
- List<HapticRect> hapticRects = new ArrayList<>();
- findHapticRects(root, hapticRects);
+ if(proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
+ if (userHapticData == null) {
+ List<HapticRect> hapticRects = new ArrayList<>();
+ findHapticRects(root, hapticRects);
- SendHapticData msg = new SendHapticData();
- msg.setHapticRectData(hapticRects);
+ SendHapticData msg = new SendHapticData();
+ msg.setHapticRectData(hapticRects);
- proxy.sendRPCRequest(msg);
+ proxy.sendRPC(msg);
+ }
}
}
@@ -91,6 +95,17 @@ public class HapticInterfaceManager {
List<View> focusables = new ArrayList<>();
getFocusableViews(root, focusables);
+ double scale = 1.0;
+
+ if (proxyHolder.get() != null) {
+ ISdl proxy = proxyHolder.get();
+ VideoStreamingCapability videoStreamingCapability = (VideoStreamingCapability)
+ proxy.getCapability(SystemCapabilityType.VIDEO_STREAMING);
+ if (videoStreamingCapability != null && videoStreamingCapability.getScale() != null) {
+ scale = videoStreamingCapability.getScale();
+ }
+ }
+
int [] loc = new int[2];
int id = 0;
for (View view : focusables) {
@@ -99,10 +114,10 @@ public class HapticInterfaceManager {
view.getLocationOnScreen(loc);
Rectangle rect = new Rectangle();
- rect.setWidth((float) w);
- rect.setHeight((float) h);
- rect.setX((float) loc[0]);
- rect.setY((float) loc[1]);
+ rect.setWidth((float) (w * scale));
+ rect.setHeight((float) (h * scale));
+ rect.setX((float) (loc[0] * scale));
+ rect.setY((float) (loc[1] * scale));
HapticRect hapticRect = new HapticRect();
hapticRect.setId(id++);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
index e9d58a3fe..23c37bea5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/ProxyBridge.java
@@ -44,12 +44,16 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
+import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
@@ -58,6 +62,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -92,6 +97,7 @@ import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -102,6 +108,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -111,6 +118,7 @@ import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
+import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.UnregisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
@@ -572,6 +580,16 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onCreateWindowResponse(CreateWindowResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onDeleteWindowResponse(DeleteWindowResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onButtonPressResponse(ButtonPressResponse response) {
onRPCReceived(response);
@@ -607,7 +625,8 @@ public class ProxyBridge implements IProxyListener{
public void onGetCloudAppProperties(GetCloudAppPropertiesResponse response) {
onRPCReceived(response);
}
-@Override
+
+ @Override
public void onPublishAppServiceResponse(PublishAppServiceResponse response){
onRPCReceived(response);
}
@@ -633,7 +652,37 @@ public class ProxyBridge implements IProxyListener{
}
@Override
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification){
onRPCReceived(notification);
}
+
+ @Override
+ public void onCloseApplicationResponse(CloseApplicationResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onCancelInteractionResponse(CancelInteractionResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onShowAppMenuResponse(ShowAppMenuResponse response) {
+ onRPCReceived(response);
+ }
+
+ @Override
+ public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response) {
+ onRPCReceived(response);
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
index d4eda9630..4563d8295 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -35,6 +35,8 @@ package com.smartdevicelink.managers;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
@@ -43,6 +45,7 @@ import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.audio.AudioStreamManager;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lockscreen.LockScreenConfig;
import com.smartdevicelink.managers.lockscreen.LockScreenManager;
import com.smartdevicelink.managers.permission.PermissionManager;
@@ -52,6 +55,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
@@ -61,6 +65,7 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.ChangeRegistration;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
@@ -69,12 +74,14 @@ import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
@@ -86,6 +93,8 @@ import com.smartdevicelink.transport.utl.TransportRecord;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
+import org.json.JSONException;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -111,6 +120,7 @@ public class SdlManager extends BaseSdlManager{
private SdlManagerListener managerListener;
private List<Class<? extends SdlSecurityBase>> sdlSecList;
private LockScreenConfig lockScreenConfig;
+ private ServiceEncryptionListener serviceEncryptionListener;
// Managers
private PermissionManager permissionManager;
@@ -122,16 +132,20 @@ public class SdlManager extends BaseSdlManager{
// Initialize proxyBridge with anonymous lifecycleListener
- private final ProxyBridge proxyBridge= new ProxyBridge(new ProxyBridge.LifecycleListener() {
+ private final ProxyBridge proxyBridge = new ProxyBridge(new ProxyBridge.LifecycleListener() {
@Override
public void onProxyConnected() {
DebugTool.logInfo("Proxy is connected. Now initializing.");
+ changeRegistrationRetry = 0;
+ checkLifecycleConfiguration();
initialize();
}
@Override
public void onProxyClosed(String info, Exception e, SdlDisconnectedReason reason){
- dispose();
+ if (!reason.equals(SdlDisconnectedReason.LANGUAGE_CHANGE)){
+ dispose();
+ }
}
@Override
@@ -226,6 +240,71 @@ public class SdlManager extends BaseSdlManager{
}
@Override
+ protected void checkLifecycleConfiguration(){
+ final Language actualLanguage = this.getRegisterAppInterfaceResponse().getLanguage();
+
+ if (actualLanguage != null && !actualLanguage.equals(hmiLanguage)) {
+
+ final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
+
+ if (lcu != null) {
+ ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
+ changeRegistration.setAppName(lcu.getAppName());
+ changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
+ changeRegistration.setTtsName(lcu.getTtsName());
+ changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
+ changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ // go through and change sdlManager properties that were changed via the LCU update
+ hmiLanguage = actualLanguage;
+
+ if (lcu.getAppName() != null) {
+ appName = lcu.getAppName();
+ }
+
+ if (lcu.getShortAppName() != null) {
+ shortAppName = lcu.getShortAppName();
+ }
+
+ if (lcu.getTtsName() != null) {
+ ttsChunks = lcu.getTtsName();
+ }
+
+ if (lcu.getVoiceRecognitionCommandNames() != null) {
+ vrSynonyms = lcu.getVoiceRecognitionCommandNames();
+ }
+ }
+ try {
+ DebugTool.logInfo(response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Change Registration onError: " + resultCode + " | Info: " + info);
+ changeRegistrationRetry++;
+ if (changeRegistrationRetry < MAX_RETRY) {
+ final Handler handler = new Handler(Looper.getMainLooper());
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ checkLifecycleConfiguration();
+ DebugTool.logInfo("Retry Change Registration Count: " + changeRegistrationRetry);
+ }
+ }, 3000);
+ }
+ }
+ });
+ this.sendRPC(changeRegistration);
+ }
+ }
+ }
+
+ @Override
protected void initialize(){
// Instantiate sub managers
this.permissionManager = new PermissionManager(_internalInterface);
@@ -286,6 +365,14 @@ public class SdlManager extends BaseSdlManager{
this.audioStreamManager.dispose();
}
+ if (this.proxy != null) {
+ try {
+ this.proxy.dispose();
+ } catch (SdlException e) {
+ DebugTool.logError("Issue disposing proxy in SdlManager", e);
+ }
+ }
+
if(managerListener != null){
managerListener.onDestroy();
managerListener = null;
@@ -594,7 +681,7 @@ public class SdlManager extends BaseSdlManager{
proxy.setMinimumProtocolVersion(minimumProtocolVersion);
proxy.setMinimumRPCVersion(minimumRPCVersion);
if (sdlSecList != null && !sdlSecList.isEmpty()) {
- proxy.setSdlSecurityClassList(sdlSecList);
+ proxy.setSdlSecurity(sdlSecList, serviceEncryptionListener);
}
//Setup the notification queue
initNotificationQueue();
@@ -814,6 +901,13 @@ public class SdlManager extends BaseSdlManager{
}
}
+ @Override
+ public void startRPCEncryption() {
+ if (proxy != null) {
+ proxy.startProtectedRPCService();
+ }
+ }
+
};
@@ -1011,12 +1105,24 @@ public class SdlManager extends BaseSdlManager{
* Sets the Security library
* @param secList The list of security class(es)
*/
+ @Deprecated
public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> secList) {
sdlManager.sdlSecList = secList;
return this;
}
/**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public Builder setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ sdlManager.sdlSecList = secList;
+ sdlManager.serviceEncryptionListener = listener;
+ return this;
+ }
+
+ /**
* Set the SdlManager Listener
* @param listener the listener
*/
@@ -1087,4 +1193,13 @@ public class SdlManager extends BaseSdlManager{
return sdlManager;
}
}
+
+ /**
+ * Start a secured RPC service
+ */
+ public void startRPCEncryption() {
+ if (proxy != null) {
+ proxy.startProtectedRPCService();
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index 5a59604cc..d27ac27b5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -32,6 +32,9 @@
package com.smartdevicelink.managers;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+
public interface SdlManagerListener extends BaseSdlManagerListener{
/**
@@ -50,4 +53,17 @@ public interface SdlManagerListener extends BaseSdlManagerListener{
* @param e the exception
*/
void onError(String info, Exception e);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
index 857b26b92..55bff7bba 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java
@@ -56,6 +56,7 @@ import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.AudioPassThruCapabilities;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.transport.utl.TransportRecord;
@@ -160,7 +161,11 @@ public class AudioStreamManager extends BaseAudioStreamManager {
@Override
public void onNotified(RPCNotification notification) {
if(notification != null){
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
if(hmiLevel.equals(HMILevel.HMI_FULL) || hmiLevel.equals(HMILevel.HMI_LIMITED)){
checkState();
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index b1885d1a9..e7db70ee6 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
@@ -39,6 +39,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
+import com.smartdevicelink.util.DebugTool;
/**
* A class that extends SdlFile, representing artwork (JPEG, PNG, or BMP) to be uploaded to core
@@ -110,8 +111,8 @@ public class SdlArtwork extends SdlFile implements Cloneable{
}
@Override
- public void setType(@NonNull FileType fileType) {
- if(fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
+ public void setType(FileType fileType) {
+ if(fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
|| fileType.equals(FileType.GRAPHIC_BMP)){
super.setType(fileType);
}else{
@@ -144,31 +145,21 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a deep copy of the object
- * @return deep copy of the object
+ * @return deep copy of the object, null if an exception occurred
*/
@Override
public SdlArtwork clone() {
- final SdlArtwork clone;
- try {
- clone = (SdlArtwork) super.clone();
+ try{
+ SdlArtwork artwork = (SdlArtwork) super.clone();
+ if(artwork != null){
+ artwork.imageRPC = artwork.createImageRPC();
+ }
+ return artwork;
} catch (CloneNotSupportedException e) {
- throw new RuntimeException("superclass messed up", e);
- }
- clone.setName(this.getName());
- clone.setResourceId(this.getResourceId());
- clone.setUri(this.getUri() == null ? null : Uri.parse(this.getUri().toString()));
- if (this.getFileData() != null){
- byte[] data = new byte[this.getFileData().length];
- for (int i = 0; i < this.getFileData().length; i++) {
- data[i] = this.getFileData()[i];
+ if(DebugTool.isDebugEnabled()){
+ throw new RuntimeException("Clone not supported by super class");
}
- clone.setFileData(data);
}
- clone.setType(this.getType());
- clone.setPersistent(this.isPersistent());
- clone.setStaticIcon(this.isStaticIcon());
- clone.isTemplate = this.isTemplate;
- clone.imageRPC = this.createImageRPC();
- return clone;
+ return null;
}
} \ No newline at end of file
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
index 72fdff5c3..6769db0fc 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenConfig.java
@@ -32,6 +32,11 @@
package com.smartdevicelink.managers.lockscreen;
+import android.support.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* <strong>LockScreenConfig</strong> <br>
*
@@ -45,16 +50,41 @@ package com.smartdevicelink.managers.lockscreen;
* <li> appIcon - if using the default lockscreen, you can set your own app icon</li>
*
* <li> customView - If you would like to provide your own view, you can pass it in here.</li>
+ *
+ * <li> deviceLogo - On by default. If available, will show the device or OEMs logo on the lockscreen</li>
+ *
+ * <li> displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.</li>
+ *
+ * <li> enableDismissGesture - If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.</li>
*/
public class LockScreenConfig {
- private boolean enable, deviceLogo;
+ private boolean enable, deviceLogo, enableDismissGesture;
private int backgroundColor, appIconInt, customViewInt;
+ private @DisplayMode int displayMode;
+
+ /**
+ * DISPLAY_MODE_NEVER - The lock screen should never be shown. This should almost always mean that you will build your own lock screen.
+ * DISPLAY_MODE_REQUIRED_ONLY - The lock screen should only be shown when it is required by the head unit.
+ * DISPLAY_MODE_OPTIONAL_OR_REQUIRED - The lock screen should be shown when required by the head unit or when the head unit says that
+ * its optional, but *not* in other cases, such as before the user has interacted with your app on the head unit.
+ * DISPLAY_MODE_ALWAYS - The lock screen should always be shown after connection.
+ */
+ @IntDef({DISPLAY_MODE_NEVER, DISPLAY_MODE_REQUIRED_ONLY, DISPLAY_MODE_OPTIONAL_OR_REQUIRED, DISPLAY_MODE_ALWAYS})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DisplayMode {}
+ public static final int DISPLAY_MODE_NEVER = 0;
+ public static final int DISPLAY_MODE_REQUIRED_ONLY = 1;
+ public static final int DISPLAY_MODE_OPTIONAL_OR_REQUIRED = 2;
+ public static final int DISPLAY_MODE_ALWAYS = 3;
public LockScreenConfig(){
// set default values
this.enable = true;
- this.deviceLogo = false;
+ this.deviceLogo = true;
+ this.displayMode = DISPLAY_MODE_REQUIRED_ONLY;
+ this.enableDismissGesture = true;
}
/**
@@ -62,7 +92,10 @@ public class LockScreenConfig {
*
* If false, you must manage the lock screen
* @param enable boolean
+ *
+ * @deprecated to disable the lockscreen, use setDisplayMode with DISPLAY_MODE_NEVER instead
*/
+ @Deprecated
public void setEnabled(boolean enable){
this.enable = enable;
}
@@ -70,7 +103,10 @@ public class LockScreenConfig {
/**
* Gets whether the lock screen is being managed for you
* @return boolean
+ *
+ * @deprecated to disable the lockscreen, use setDisplayMode with DISPLAY_MODE_NEVER instead
*/
+ @Deprecated
public boolean isEnabled() {
return enable;
}
@@ -143,4 +179,39 @@ public class LockScreenConfig {
return deviceLogo;
}
+
+ /**
+ * Set the displayMode to be used
+ * @param displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.
+ */
+ public void setDisplayMode(@DisplayMode int displayMode){
+ this.displayMode = displayMode;
+ }
+
+ /**
+ * Get the displayMode to be used
+ * @return displayMode - Describes when the lock screen will be displayed. Defaults to `DISPLAY_MODE_REQUIRED_ONLY`.
+ */
+ public @DisplayMode int getDisplayMode(){
+ return this.displayMode;
+ }
+
+ /**
+ * If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.
+ * @param enableDismissGesture - enable or disable this feature
+ */
+ public void enableDismissGesture(boolean enableDismissGesture) {
+ this.enableDismissGesture = enableDismissGesture;
+ }
+
+ /**
+ * If true, then the lock screen can be dismissed with a downward swipe on compatible head units.
+ * Requires a connection of SDL 6.0+ and the head unit to enable the feature. Defaults to true.
+ * @return - whether or not this is enabled or disabled
+ */
+ public boolean enableDismissGesture() {
+ return enableDismissGesture;
+ }
+
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
index 43e40be6c..30ed1b575 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java
@@ -32,8 +32,10 @@
package com.smartdevicelink.managers.lockscreen;
+import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.Log;
@@ -49,6 +51,7 @@ import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.enums.DriverDistractionState;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.LockScreenStatus;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.util.AndroidTools;
@@ -68,15 +71,17 @@ public class LockScreenManager extends BaseSubManager {
private static final String TAG = "LockScreenManager";
private WeakReference<Context> context;
- private HMILevel hmiLevel;
+ HMILevel hmiLevel;
private OnRPCNotificationListener systemRequestListener, ddListener, hmiListener;
private String deviceIconUrl;
- private boolean driverDistStatus;
+ boolean driverDistStatus, mIsLockscreenDismissible, enableDismissGesture, lockScreenEnabled, deviceLogoEnabled;
private volatile boolean isApplicationForegrounded;
private android.arch.lifecycle.LifecycleObserver lifecycleObserver;
- protected boolean lockScreenEnabled, deviceLogoEnabled;
- protected int lockScreenIcon, lockScreenColor, customView;
- protected Bitmap deviceLogo;
+ int lockScreenIcon, lockScreenColor, customView, displayMode;
+ Bitmap deviceLogo;
+ private boolean mLockScreenHasBeenDismissed, lockscreenDismissReceiverRegistered, receivedFirstDDNotification;
+ private String mLockscreenWarningMsg;
+ private BroadcastReceiver mLockscreenDismissedReceiver;
public LockScreenManager(LockScreenConfig lockScreenConfig, Context context, ISdl internalInterface){
@@ -93,6 +98,14 @@ public class LockScreenManager extends BaseSubManager {
customView = lockScreenConfig.getCustomView();
lockScreenEnabled = lockScreenConfig.isEnabled();
deviceLogoEnabled = lockScreenConfig.isDeviceLogoEnabled();
+ displayMode = lockScreenConfig.getDisplayMode();
+ enableDismissGesture = lockScreenConfig.enableDismissGesture();
+
+ // for older projects that may not use DisplayMode. This can
+ // be removed in a major release
+ if (!lockScreenEnabled){
+ displayMode = LockScreenConfig.DISPLAY_MODE_NEVER;
+ }
setupListeners();
}
@@ -108,6 +121,12 @@ public class LockScreenManager extends BaseSubManager {
// send broadcast to close lock screen if open
if (context.get() != null) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
+ try {
+ context.get().unregisterReceiver(mLockscreenDismissedReceiver);
+ lockscreenDismissReceiverRegistered = false;
+ } catch (IllegalArgumentException e) {
+ //do nothing
+ }
}
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
@@ -153,7 +172,11 @@ public class LockScreenManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
launchLockScreenActivity();
}
};
@@ -166,6 +189,22 @@ public class LockScreenManager extends BaseSubManager {
// do something with the status
if (notification != null) {
OnDriverDistraction ddState = (OnDriverDistraction) notification;
+ Boolean isDismissible = ddState.getLockscreenDismissibility();
+ Log.i(TAG, "Lock screen dismissible: "+ isDismissible);
+ if (isDismissible != null) {
+ // both of these conditions must be met to be able to dismiss lockscreen
+ if (isDismissible && enableDismissGesture){
+ mIsLockscreenDismissible = true;
+
+ // if DisplayMode is set to ALWAYS, it will be shown before the first DD notification.
+ // If this is our first DD notification and we are in ALWAYS mode, send another intent to
+ // enable the dismissal
+ if (!receivedFirstDDNotification && displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS ){
+ launchLockScreenActivity();
+ }
+ }
+ }
+ mLockscreenWarningMsg = ddState.getLockscreenWarningMessage();
if (ddState.getState() == DriverDistractionState.DD_ON){
// launch lock screen
@@ -174,10 +213,9 @@ public class LockScreenManager extends BaseSubManager {
}else{
// close lock screen
driverDistStatus = false;
- if (context.get() != null) {
- context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
- }
+ closeLockScreenActivity();
}
+ receivedFirstDDNotification = true;
}
}
};
@@ -226,6 +264,15 @@ public class LockScreenManager extends BaseSubManager {
} else{
isApplicationForegrounded = true;
}
+
+ mLockscreenDismissedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED.equals(intent.getAction())) {
+ mLockScreenHasBeenDismissed = true;
+ }
+ }
+ };
}
////
@@ -240,11 +287,20 @@ public class LockScreenManager extends BaseSubManager {
* X. If the status is set to OFF, Send broadcast to close lock screen if it is open
*/
private void launchLockScreenActivity(){
+ // If the user has dismissed the lockscreen for this run or has disabled it, do not show it
+ if (mLockScreenHasBeenDismissed || displayMode == LockScreenConfig.DISPLAY_MODE_NEVER) {
+ return;
+ }
// intent to open SDLLockScreenActivity
// pass in icon, background color, and custom view
if (lockScreenEnabled && isApplicationForegrounded && context.get() != null) {
+ if (mIsLockscreenDismissible && !lockscreenDismissReceiverRegistered) {
+ context.get().registerReceiver(mLockscreenDismissedReceiver, new IntentFilter(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSED));
+ lockscreenDismissReceiverRegistered = true;
+
+ }
LockScreenStatus status = getLockScreenStatus();
- if (status == LockScreenStatus.REQUIRED) {
+ if (status == LockScreenStatus.REQUIRED || displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS || (status == LockScreenStatus.OPTIONAL && displayMode == LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED)) {
Intent showLockScreenIntent = new Intent(context.get(), SDLLockScreenActivity.class);
showLockScreenIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -254,8 +310,24 @@ public class LockScreenManager extends BaseSubManager {
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_CUSTOM_VIEW_EXTRA, customView);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_EXTRA, deviceLogoEnabled);
showLockScreenIntent.putExtra(SDLLockScreenActivity.LOCKSCREEN_DEVICE_LOGO_BITMAP, deviceLogo);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_DISMISSIBLE, mIsLockscreenDismissible);
+ showLockScreenIntent.putExtra(SDLLockScreenActivity.KEY_LOCKSCREEN_WARNING_MSG, mLockscreenWarningMsg);
context.get().startActivity(showLockScreenIntent);
} else if (status == LockScreenStatus.OFF) {
+ closeLockScreenActivity();
+ }
+ }
+ }
+
+ private void closeLockScreenActivity(){
+
+ if (displayMode == LockScreenConfig.DISPLAY_MODE_ALWAYS){
+ return;
+ }
+
+ if (context.get() != null) {
+ LockScreenStatus status = getLockScreenStatus();
+ if (status == LockScreenStatus.OFF || (status == LockScreenStatus.OPTIONAL && displayMode != LockScreenConfig.DISPLAY_MODE_OPTIONAL_OR_REQUIRED)) {
context.get().sendBroadcast(new Intent(SDLLockScreenActivity.CLOSE_LOCK_SCREEN_ACTION));
}
}
@@ -271,9 +343,9 @@ public class LockScreenManager extends BaseSubManager {
*
* @return Whether or not the Lock Screen is required
*/
- protected synchronized LockScreenStatus getLockScreenStatus() {
+ synchronized LockScreenStatus getLockScreenStatus() {
- if ( (hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
+ if ((hmiLevel == null) || (hmiLevel.equals(HMILevel.HMI_NONE))) {
return LockScreenStatus.OFF;
}
else if ( hmiLevel.equals(HMILevel.HMI_BACKGROUND)) {
@@ -284,7 +356,7 @@ public class LockScreenManager extends BaseSubManager {
return LockScreenStatus.REQUIRED;
}
}
- else if ( (hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
+ else if ((hmiLevel.equals(HMILevel.HMI_FULL)) || (hmiLevel.equals(HMILevel.HMI_LIMITED))) {
if (!driverDistStatus) {
return LockScreenStatus.OPTIONAL;
} else {
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
index 6ae10ec73..d87d27ca2 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/SDLLockScreenActivity.java
@@ -39,9 +39,12 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
import android.view.Window;
import android.widget.ImageView;
import android.widget.RelativeLayout;
+import android.widget.TextView;
import com.smartdevicelink.R;
@@ -55,6 +58,12 @@ public class SDLLockScreenActivity extends Activity {
public static final String LOCKSCREEN_CUSTOM_VIEW_EXTRA = "LOCKSCREEN_CUSTOM_VIEW_EXTRA";
public static final String LOCKSCREEN_DEVICE_LOGO_DOWNLOADED = "LOCKSCREEN_DEVICE_LOGO_DOWNLOADED";
public static final String CLOSE_LOCK_SCREEN_ACTION = "CLOSE_LOCK_SCREEN";
+ public static final String KEY_LOCKSCREEN_DISMISSED = "KEY_LOCKSCREEN_DISMISSED";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "KEY_LOCKSCREEN_DISMISSIBLE";
+ public static final String KEY_LOCKSCREEN_WARNING_MSG = "KEY_LOCKSCREEN_WARNING_MSG";
+ private static final int MIN_SWIPE_DISTANCE = 200;
+ private boolean mIsDismissible;
+ private GestureDetector mGestureDetector;
private final BroadcastReceiver lockScreenBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -81,6 +90,7 @@ public class SDLLockScreenActivity extends Activity {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ mGestureDetector = new GestureDetector(this, new SwipeUpGestureListener());
// set any parameters that came from the lock screen manager
initializeActivity(getIntent());
@@ -94,6 +104,14 @@ public class SDLLockScreenActivity extends Activity {
}
@Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mIsDismissible) {
+ return mGestureDetector.onTouchEvent(event);
+ }
+ return super.onTouchEvent(event);
+ }
+
+ @Override
protected void onDestroy() {
unregisterReceiver(lockScreenBroadcastReceiver);
super.onDestroy();
@@ -107,6 +125,9 @@ public class SDLLockScreenActivity extends Activity {
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
+ if (intent != null && intent.getBooleanExtra(KEY_LOCKSCREEN_DISMISSIBLE, false)){
+ initializeActivity(intent);
+ }
}
public void initializeActivity(Intent intent){
@@ -133,6 +154,11 @@ public class SDLLockScreenActivity extends Activity {
if (deviceLogoEnabled && deviceIcon != null){
setDeviceLogo(deviceIcon);
}
+ mIsDismissible = intent.getBooleanExtra(KEY_LOCKSCREEN_DISMISSIBLE, false);
+ String warningMsg = intent.getStringExtra(KEY_LOCKSCREEN_WARNING_MSG);
+ if (mIsDismissible) {
+ setLockscreenWarningMessage(warningMsg);
+ }
}
}
}
@@ -154,8 +180,26 @@ public class SDLLockScreenActivity extends Activity {
}
}
+ private void setLockscreenWarningMessage(String msg) {
+ TextView tv = findViewById(R.id.lockscreen_text);
+ if (tv != null) {
+ tv.setText(msg != null ? msg : getString(R.string.default_lockscreen_warning_message));
+ }
+ }
+
private void setCustomView(int customView) {
setContentView(customView);
}
+ private class SwipeUpGestureListener extends GestureDetector.SimpleOnGestureListener {
+ @Override
+ public boolean onFling(MotionEvent event1, MotionEvent event2,
+ float velocityX, float velocityY) {
+ if ((event2.getY() - event1.getY()) > MIN_SWIPE_DISTANCE) {
+ sendBroadcast(new Intent(KEY_LOCKSCREEN_DISMISSED));
+ finish();
+ }
+ return true;
+ }
+ }
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
index 49798078c..95144865e 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java
@@ -62,6 +62,7 @@ import com.smartdevicelink.proxy.rpc.TouchCoord;
import com.smartdevicelink.proxy.rpc.TouchEvent;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -92,6 +93,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
private VideoStreamingParameters parameters;
private IVideoStreamListener streamListener;
private boolean isTransportAvailable = false;
+ private boolean hasStarted;
// INTERNAL INTERFACES
@@ -114,8 +116,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
startEncoder();
stateMachine.transitionToState(StreamingStateMachine.STARTED);
-
-
+ hasStarted = true;
}
}
@@ -140,7 +141,11 @@ public class VideoStreamManager extends BaseVideoStreamManager {
@Override
public void onNotified(RPCNotification notification) {
if(notification != null){
- hmiLevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ hmiLevel = onHMIStatus.getHmiLevel();
if(hmiLevel.equals(HMILevel.HMI_FULL)){
checkState();
}
@@ -194,6 +199,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
&& hmiLevel != null
&& hmiLevel.equals(HMILevel.HMI_FULL)
&& parameters != null){
+ stateMachine.transitionToState(StreamingStateMachine.READY);
transitionToState(READY);
}
}
@@ -310,6 +316,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
//Encoder should be up and running
createRemoteDisplay(virtualDisplayEncoder.getVirtualDisplay());
stateMachine.transitionToState(StreamingStateMachine.STARTED);
+ hasStarted = true;
} catch (Exception e) {
stateMachine.transitionToState(StreamingStateMachine.ERROR);
e.printStackTrace();
@@ -354,14 +361,15 @@ public class VideoStreamManager extends BaseVideoStreamManager {
remoteDisplay = null;
parameters = null;
virtualDisplayEncoder = null;
- if(internalInterface!=null){
+ if (internalInterface != null) {
internalInterface.stopVideoService();
+ // Remove listeners
+ internalInterface.removeServiceListener(SessionType.NAV, serviceListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
+ internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
}
- // Remove listeners
- internalInterface.removeServiceListener(SessionType.NAV, serviceListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_TOUCH_EVENT, touchListener);
- internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
+
stateMachine.transitionToState(StreamingStateMachine.NONE);
super.dispose();
@@ -384,8 +392,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
* @return boolean (true = yes, false = no)
*/
public boolean isStreaming(){
- return (stateMachine.getState() == StreamingStateMachine.STARTED) ||
- (hmiLevel == HMILevel.HMI_FULL);
+ return (stateMachine.getState() == StreamingStateMachine.STARTED) && (hmiLevel == HMILevel.HMI_FULL);
}
/**
@@ -393,8 +400,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
* @return boolean (true = not paused, false = paused)
*/
public boolean isPaused(){
- return (stateMachine.getState() == StreamingStateMachine.STARTED) ||
- (hmiLevel != HMILevel.HMI_FULL);
+ return (hasStarted && stateMachine.getState() == StreamingStateMachine.STOPPED) || (hmiLevel != HMILevel.HMI_FULL);
}
/**
@@ -451,9 +457,8 @@ public class VideoStreamManager extends BaseVideoStreamManager {
if(resolution != null){
DisplayMetrics displayMetrics = new DisplayMetrics();
disp.getMetrics(displayMetrics);
- touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
- touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
- }
+ createTouchScalar(resolution, displayMetrics);
+ }
}
@@ -499,6 +504,11 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
+ void createTouchScalar(ImageResolution resolution, DisplayMetrics displayMetrics) {
+ touchScalar[0] = ((float)displayMetrics.widthPixels) / resolution.getResolutionWidth();
+ touchScalar[1] = ((float)displayMetrics.heightPixels) / resolution.getResolutionHeight();
+ }
+
List<MotionEvent> convertTouchEvent(OnTouchEvent onTouchEvent){
List<MotionEvent> motionEventList = new ArrayList<MotionEvent>();
@@ -677,4 +687,4 @@ public class VideoStreamManager extends BaseVideoStreamManager {
}
}
-} \ No newline at end of file
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
index 00becb062..6b4a2b467 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/AbstractProtocol.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.protocol;
@@ -127,15 +127,17 @@ public abstract class AbstractProtocol {
protected void handlePacketToSend(SdlPacket header) {
//FIXME SdlTrace.logProtocolEvent(InterfaceActivityDirection.Transmit, header, data,
// offset, length, SDL_LIB_TRACE_KEY);
- resetOutgoingHeartbeat(SessionType.valueOf((byte)header.getServiceType()), (byte)header.getSessionId());
+ if(header == null){
+ return;
+ }
+
+ resetOutgoingHeartbeat(SessionType.valueOf((byte)header.getServiceType()), (byte)header.getSessionId());
synchronized(_frameLock) {
//byte[] frameHeader = header.constructPacket();
- if(header!=null){
- _protocolListener.onProtocolMessageBytesToSend(header);
- }//TODO else log out error
-
+ _protocolListener.onProtocolMessageBytesToSend(header);
+
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
index c06709b52..c443abfc6 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/protocol/SdlProtocol.java
@@ -36,7 +36,12 @@ import android.support.annotation.NonNull;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.transport.MultiplexTransportConfig;
+import com.smartdevicelink.transport.TCPTransportConfig;
+import com.smartdevicelink.transport.TCPTransportManager;
import com.smartdevicelink.transport.TransportManager;
+import com.smartdevicelink.transport.enums.TransportType;
+
+import java.util.Collections;
@SuppressWarnings("WeakerAccess")
@@ -54,17 +59,26 @@ public class SdlProtocol extends SdlProtocolBase {
}
+ public SdlProtocol(@NonNull ISdlProtocol iSdlProtocol, @NonNull TCPTransportConfig config) {
+ super(iSdlProtocol,config);
+ this.requestedPrimaryTransports = Collections.singletonList(TransportType.TCP);
+ this.requestedSecondaryTransports = null;
+ this.requiresHighBandwidth =false;
+ this.setTransportManager(new TCPTransportManager(config,transportEventListener));
+ }
+
/**
* If there was a TransportListener attached to the supplied multiplex config, this method will
* call the onTransportEvent method.
*/
@Override
void notifyDevTransportListener (){
- MultiplexTransportConfig transportConfig = (MultiplexTransportConfig)this.transportConfig;
- if(transportConfig.getTransportListener() != null && transportManager != null) {
- transportConfig.getTransportListener().onTransportEvent(transportManager.getConnectedTransports(), isTransportForServiceAvailable(SessionType.PCM),isTransportForServiceAvailable(SessionType.NAV));
+ if(TransportType.MULTIPLEX.equals(transportConfig.getTransportType() )) {
+ MultiplexTransportConfig transportConfig = (MultiplexTransportConfig) this.transportConfig;
+ if (transportConfig.getTransportListener() != null && transportManager != null) {
+ transportConfig.getTransportListener().onTransportEvent(transportManager.getConnectedTransports(), isTransportForServiceAvailable(SessionType.PCM), isTransportForServiceAvailable(SessionType.NAV));
+ }
}
}
-
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
index 76f92487f..d94372740 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/LockScreenManager.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy;
import android.graphics.Bitmap;
@@ -40,6 +40,7 @@ import com.smartdevicelink.util.AndroidTools;
import java.io.IOException;
+@Deprecated
public class LockScreenManager {
public interface OnLockScreenIconDownloadedListener{
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
index a48376751..763c139e9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyALM.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy;
import android.app.Service;
@@ -67,7 +67,13 @@ import java.util.Vector;
import static com.smartdevicelink.proxy.SystemCapabilityManager.convertToList;
-
+/**
+ * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
+ *
+ * The guide created for the initial transition of SdlProxyBase/ALM to SdlManager can be found at
+ * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
+ */
+@Deprecated
public class SdlProxyALM extends SdlProxyBase<IProxyListenerALM> {
private static final String SDL_LIB_TRACE_KEY = "42baba60-eb57-11df-98cf-0800200c9a66";
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
index 56e1c8544..30ebb6cb5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java
@@ -61,6 +61,7 @@ import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
import com.smartdevicelink.haptic.HapticInterfaceManager;
+import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.managers.lifecycle.RpcConverter;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
@@ -123,6 +124,7 @@ import com.smartdevicelink.trace.enums.InterfaceActivityDirection;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.MultiplexTransportConfig;
import com.smartdevicelink.transport.SiphonServer;
+import com.smartdevicelink.transport.TCPTransportConfig;
import com.smartdevicelink.transport.USBTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.CorrelationIdGenerator;
@@ -148,8 +150,10 @@ import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
+import java.util.Set;
import java.util.Vector;
import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -158,8 +162,14 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.ScheduledExecutorService;
-
+/**
+ * @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
+ *
+ * The guide created for the initial transition of SdlProxyBase to SdlManager can be found at
+ * <a href="https://smartdevicelink.com/en/guides/android/migrating-to-newer-sdl-versions/updating-to-v47/">Migrating to SDL Manager</a>
+ */
@SuppressWarnings({"WeakerAccess", "Convert2Diamond"})
+@Deprecated
public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase> {
// Used for calls to Android Log class.
public static final String TAG = "SdlProxy";
@@ -167,7 +177,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private static final int PROX_PROT_VER_ONE = 1;
private static final int RESPONSE_WAIT_TIME = 2000;
- public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("5.1.0");
+ public static final com.smartdevicelink.util.Version MAX_SUPPORTED_RPC_VERSION = new com.smartdevicelink.util.Version("6.0.0");
private SdlSession sdlSession = null;
private proxyListenerType _proxyListener = null;
@@ -246,6 +256,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private OnSystemRequest lockScreenIconRequest = null;
private TelephonyManager telephonyManager = null;
private DeviceInfo deviceInfo = null;
+ private ISdlServiceListener navServiceListener;
/**
* Contains current configuration for the transport that was selected during
@@ -299,6 +310,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private Version minimumProtocolVersion;
private Version minimumRPCVersion;
+ private Set<String> encryptionRequiredRPCs = new HashSet<>();
+ private boolean rpcSecuredServiceStarted;
+ private ServiceEncryptionListener serviceEncryptionListener;
// Interface broker
private SdlInterfaceBroker _interfaceBroker = null;
@@ -342,6 +356,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if(isConnected()){
sdlSession.setDesiredVideoParams(parameters);
sdlSession.startService(SessionType.NAV,sdlSession.getSessionId(),encrypted);
+ addNavListener();
}
}
@@ -495,6 +510,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
AudioStreamingParams params) {
return SdlProxyBase.this.startAudioStream(isEncrypted, codec, params);
}
+
+ @Override
+ public void startRPCEncryption() {
+ SdlProxyBase.this.startProtectedRPCService();
+ }
};
private void notifyPutFileStreamError(Exception e, String info)
@@ -540,13 +560,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
@Override
public void onTransportDisconnected(String info, boolean altTransportAvailable, BaseTransportConfig transportConfig) {
+
notifyPutFileStreamError(null, info);
- if( altTransportAvailable){
+ if (altTransportAvailable){
SdlProxyBase.this._transportConfig = transportConfig;
Log.d(TAG, "notifying RPC session ended, but potential primary transport available");
cycleProxy(SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST);
-
}else{
notifyProxyClosed(info, new SdlException("Transport disconnected.", SdlExceptionCause.SDL_UNAVAILABLE), SdlDisconnectedReason.TRANSPORT_DISCONNECT);
}
@@ -1013,8 +1033,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_outgoingProxyMessageDispatcher = null;
}
throw e;
- }
-
+ }
+
+ addOnRPCNotificationListener(FunctionID.ON_PERMISSIONS_CHANGE, onPermissionsChangeListener);
+ this._internalInterface.addServiceListener(SessionType.RPC, securedServiceListener);
+ this._internalInterface.addServiceListener(SessionType.NAV, securedServiceListener);
+ this._internalInterface.addServiceListener(SessionType.PCM, securedServiceListener);
+
+
// Trace that ctor has fired
SdlTrace.logProxyEvent("SdlProxy Created, instanceID=" + this.toString(), SDL_LIB_TRACE_KEY);
}
@@ -1563,14 +1589,14 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
synchronized(CONNECTION_REFERENCE_LOCK) {
//Handle legacy USB connections
- if(_transportConfig != null
- && TransportType.USB.equals(_transportConfig.getTransportType())){
+ if (_transportConfig != null
+ && TransportType.USB.equals(_transportConfig.getTransportType())) {
//A USB transport config was provided
- USBTransportConfig usbTransportConfig = (USBTransportConfig)_transportConfig;
- if(usbTransportConfig.getUsbAccessory() == null){
+ USBTransportConfig usbTransportConfig = (USBTransportConfig) _transportConfig;
+ if (usbTransportConfig.getUsbAccessory() == null) {
DebugTool.logInfo("Legacy USB transport config was used, but received null for accessory. Attempting to connect with router service");
//The accessory was null which means it came from a router service
- MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(),_appID);
+ MultiplexTransportConfig multiplexTransportConfig = new MultiplexTransportConfig(usbTransportConfig.getUSBContext(), _appID);
multiplexTransportConfig.setRequiresHighBandwidth(true);
multiplexTransportConfig.setSecurityLevel(MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
multiplexTransportConfig.setPrimaryTransports(Collections.singletonList(TransportType.USB));
@@ -1579,9 +1605,11 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
}
- if(_transportConfig.getTransportType().equals(TransportType.MULTIPLEX)){
- this.sdlSession = new SdlSession2(_interfaceBroker,(MultiplexTransportConfig)_transportConfig);
- }else{
+ if (_transportConfig != null && _transportConfig.getTransportType().equals(TransportType.MULTIPLEX)) {
+ this.sdlSession = new SdlSession2(_interfaceBroker, (MultiplexTransportConfig) _transportConfig);
+ }else if(_transportConfig != null &&_transportConfig.getTransportType().equals(TransportType.TCP)){
+ this.sdlSession = new SdlSession2(_interfaceBroker, (TCPTransportConfig) _transportConfig);
+ }else {
this.sdlSession = SdlSession.createSession((byte)getProtocolVersion().getMajor(),_interfaceBroker, _transportConfig);
}
}
@@ -1780,6 +1808,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
_proxyDisposed = true;
+ rpcSecuredServiceStarted = false;
+ encryptionRequiredRPCs.clear();
+ serviceEncryptionListener = null;
SdlTrace.logProxyEvent("Application called dispose() method.", SDL_LIB_TRACE_KEY);
@@ -1834,6 +1865,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
try{
_cycling = true;
cleanProxy(disconnectedReason);
+
initializeProxy();
if(!SdlDisconnectedReason.LEGACY_BLUETOOTH_MODE_ENABLED.equals(disconnectedReason)
&& !SdlDisconnectedReason.PRIMARY_TRANSPORT_CYCLE_REQUEST.equals(disconnectedReason)){//We don't want to alert higher if we are just cycling for legacy bluetooth
@@ -2093,7 +2125,89 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onError("Proxy callback dispatcher is down. Proxy instance is invalid.", e);
}
/************* END Functions used by the Message Dispatching Queues ****************/
-
+
+
+ private OnRPCNotificationListener onPermissionsChangeListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ List<PermissionItem> permissionItems = ((OnPermissionsChange) notification).getPermissionItem();
+ Boolean requireEncryptionAppLevel = ((OnPermissionsChange) notification).getRequireEncryption();
+ encryptionRequiredRPCs.clear();
+ if (requireEncryptionAppLevel == null || requireEncryptionAppLevel) {
+ if (permissionItems != null && !permissionItems.isEmpty()) {
+ for (PermissionItem permissionItem : permissionItems) {
+ if (permissionItem != null && Boolean.TRUE.equals(permissionItem.getRequireEncryption())) {
+ String rpcName = permissionItem.getRpcName();
+ if (rpcName != null) {
+ encryptionRequiredRPCs.add(rpcName);
+ }
+ }
+ }
+ }
+ checkStatusAndInitSecuredService();
+ }
+ }
+ };
+
+ private ISdlServiceListener securedServiceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+ if(SessionType.RPC.equals(type)){
+ rpcSecuredServiceStarted = isEncrypted;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, isEncrypted, null);
+ }
+ DebugTool.logInfo("onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
+ }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ if (SessionType.RPC.equals(type)) {
+ rpcSecuredServiceStarted = false;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, false, null);
+ }
+ DebugTool.logInfo("onServiceEnded, session Type: " + type.getName());
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ if (SessionType.RPC.equals(type)) {
+ rpcSecuredServiceStarted = false;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, false, "onServiceError: " + reason);
+ }
+ DebugTool.logError("onServiceError, session Type: " + type.getName() + ", reason: " + reason);
+ }
+ };
+
+ /**
+ * Checks if an RPC requires encryption
+ *
+ * @param rpcName the rpc name (FunctionID) to check
+ * @return true if the given RPC requires encryption; false, otherwise
+ */
+ public boolean getRPCRequiresEncryption(@NonNull FunctionID rpcName) {
+ return encryptionRequiredRPCs.contains(rpcName.toString());
+ }
+
+ /**
+ * Gets the encryption requirement
+ * @return true if encryption is required; false otherwise
+ */
+ public boolean getRequiresEncryption() {
+ return !encryptionRequiredRPCs.isEmpty();
+ }
+
+ private void checkStatusAndInitSecuredService() {
+ if ((_hmiLevel != null && _hmiLevel != HMILevel.HMI_NONE) && getRequiresEncryption() && !rpcSecuredServiceStarted) {
+ startProtectedRPCService();
+ }
+ }
+
// Private sendRPCMessagePrivate method. All RPCMessages are funneled through this method after error checking.
protected void sendRPCMessagePrivate(RPCMessage message) throws SdlException {
try {
@@ -2137,8 +2251,24 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
pm.setMessageType(MessageType.RPC);
pm.setSessionType(SessionType.RPC);
pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
- pm.setPayloadProtected(message.isPayloadProtected());
-
+ if (rpcSecuredServiceStarted && getRPCRequiresEncryption(message.getFunctionID())) {
+ pm.setPayloadProtected(true);
+ } else {
+ pm.setPayloadProtected(message.isPayloadProtected());
+ }
+ if (pm.getPayloadProtected() && (!rpcSecuredServiceStarted || !rpcProtectedStartResponse)){
+ String errorInfo = "Trying to send an encrypted message and there is no secured service";
+ if (message.getMessageType().equals((RPCMessage.KEY_REQUEST))) {
+ RPCRequest request = (RPCRequest) message;
+ OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
+ if (listener != null) {
+ listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
+ }
+ }
+ DebugTool.logWarning(errorInfo);
+ return;
+ }
+
if (sdlSession != null) {
pm.setSessionID(sdlSession.getSessionId());
}
@@ -3551,6 +3681,36 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onGetInteriorVehicleDataResponse(msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.CREATE_WINDOW.toString())) {
+ final CreateWindowResponse msg = new CreateWindowResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCreateWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCreateWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.DELETE_WINDOW.toString())) {
+ final DeleteWindowResponse msg = new DeleteWindowResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onDeleteWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onDeleteWindowResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else if (functionName.equals(FunctionID.GET_SYSTEM_CAPABILITY.toString())) {
// GetSystemCapabilityResponse
final GetSystemCapabilityResponse msg = new GetSystemCapabilityResponse(hash);
@@ -3694,6 +3854,100 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
_proxyListener.onPerformAppServiceInteractionResponse( msg);
onRPCResponseReceived(msg);
}
+ } else if (functionName.equals(FunctionID.CLOSE_APPLICATION.toString())) {
+ final CloseApplicationResponse msg = new CloseApplicationResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCloseApplicationResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCloseApplicationResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.CANCEL_INTERACTION.toString())) {
+ final CancelInteractionResponse msg = new CancelInteractionResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onCancelInteractionResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onCancelInteractionResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.UNPUBLISH_APP_SERVICE.toString())) {
+ final UnpublishAppServiceResponse msg = new UnpublishAppServiceResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onUnpublishAppServiceResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onUnpublishAppServiceResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.SHOW_APP_MENU.toString())) {
+ final ShowAppMenuResponse msg = new ShowAppMenuResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ // Run in UI thread
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onShowAppMenuResponse( msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onShowAppMenuResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString())) {
+ final GetInteriorVehicleDataConsentResponse msg = new GetInteriorVehicleDataConsentResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onGetInteriorVehicleDataConsentResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ } else if (functionName.equals(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString())) {
+ final ReleaseInteriorVehicleDataModuleResponse msg = new ReleaseInteriorVehicleDataModuleResponse(hash);
+ msg.format(rpcSpecVersion, true);
+ if (_callbackToUIThread) {
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
+ onRPCResponseReceived(msg);
+ }
+ });
+ } else {
+ _proxyListener.onReleaseInteriorVehicleDataModuleResponse(msg);
+ onRPCResponseReceived(msg);
+ }
} else {
if (_sdlMsgVersion != null) {
DebugTool.logError("Unrecognized response Message: " + functionName +
@@ -3703,6 +3957,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
} // end-if
+
} else if (messageType.equals(RPCMessage.KEY_NOTIFICATION)) {
if (functionName.equals(FunctionID.ON_HMI_STATUS.toString())) {
// OnHMIStatus
@@ -3719,6 +3974,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (msg.getHmiLevel() == HMILevel.HMI_FULL) firstTimeFull = false;
_hmiLevel = msg.getHmiLevel();
+ if (_hmiLevel != HMILevel.HMI_NONE) {
+ checkStatusAndInitSecuredService();
+ }
_audioStreamingState = msg.getAudioStreamingState();
msg.format(rpcSpecVersion, true);
@@ -4076,7 +4334,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if (_advancedLifecycleManagementEnabled) {
// This requires the proxy to be cycled
- cycleProxy(SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(msg.getReason()));
+
+ if(_mainUIHandler == null){
+ _mainUIHandler = new Handler(Looper.getMainLooper());
+ }
+
+ //This needs to be ran on the main thread
+
+ _mainUIHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ cycleProxy(SdlDisconnectedReason.convertAppInterfaceUnregisteredReason(msg.getReason()));
+ }
+ });
} else {
if (_callbackToUIThread) {
// Run in UI thread
@@ -4781,7 +5051,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.setDesiredVideoParams(emptyParam);
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -4829,7 +5099,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.setDesiredVideoParams(emptyParam);
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -5203,7 +5473,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
navServiceStartRejectedParams = null;
sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);
-
+ addNavListener();
FutureTask<Void> fTask = createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));
ScheduledExecutorService scheduler = createScheduler();
scheduler.execute(fTask);
@@ -5268,6 +5538,35 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
sdlSession.drainEncoder(endOfStream);
}
+ private void addNavListener(){
+
+ // videos may be started and stopped. Only add this once
+ if (navServiceListener == null){
+
+ navServiceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) { }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ // reset nav flags so nav can start upon the next transport connection
+ resetNavStartFlags();
+ // propagate notification up to proxy listener so the developer will know that the service is ended
+ if (_proxyListener != null) {
+ _proxyListener.onServiceEnded(new OnServiceEnded(type));
+ }
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ // if there is an error reset the flags so that there is a chance to restart streaming
+ resetNavStartFlags();
+ }
+ };
+ this.sdlSession.addServiceListener(SessionType.NAV, navServiceListener);
+ }
+ }
+
/**
* Opens a audio service (service type 10) and subsequently provides an IAudioStreamListener
* to the app to send audio data.
@@ -5420,7 +5719,13 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
private void AudioServiceEndedNACK() {
pcmServiceEndResponseReceived = true;
pcmServiceEndResponse = false;
- }
+ }
+
+ private void resetNavStartFlags() {
+ navServiceStartResponseReceived = false;
+ navServiceStartResponse = false;
+ navServiceStartRejectedParams = null;
+ }
public void setAppService(Service mService)
{
@@ -7765,11 +8070,22 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
return sdlSession.getCurrentTransportType();
}
-
+
+ @Deprecated
public void setSdlSecurityClassList(List<Class<? extends SdlSecurityBase>> list) {
_secList = list;
- }
-
+ }
+
+ /**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public void setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ _secList = secList;
+ serviceEncryptionListener = listener;
+ }
+
private void setSdlSecurity(SdlSecurityBase sec) {
if (sdlSession != null)
{
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
index 897add3f5..5240c4813 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBuilder.java
@@ -49,6 +49,7 @@ import com.smartdevicelink.transport.MultiplexTransportConfig;
import java.util.List;
import java.util.Vector;
+@Deprecated
public class SdlProxyBuilder {
// Required parameters
private IProxyListenerALM listener;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
index c96df0f78..6e76db82a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyConfigurationResources.java
@@ -1,38 +1,39 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy;
import android.telephony.TelephonyManager;
+@Deprecated
public class SdlProxyConfigurationResources {
private String _sdlConfigurationFilePath;
private TelephonyManager _telephonyManager;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
index 8af6b1c59..c720cd22c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/video/SdlRemoteDisplay.java
@@ -35,6 +35,7 @@ package com.smartdevicelink.streaming.video;
import android.annotation.TargetApi;
import android.app.Presentation;
import android.content.Context;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -80,7 +81,9 @@ public abstract class SdlRemoteDisplay extends Presentation {
startRefreshTask();
- w.setType(WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ w.setType(WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION);
+ }
}
protected void startRefreshTask() {
@@ -173,7 +176,7 @@ public abstract class SdlRemoteDisplay extends Presentation {
public void run() {
// Want to create presentation on UI thread so it finds the right Looper
// when setting up the Dialog.
- if ((remoteDisplay == null) && (mDisplay != null))
+ if((mDisplay!=null) && (remoteDisplay == null || remoteDisplay.getDisplay() != mDisplay))
{
try {
Constructor constructor = remoteDisplayClass.getConstructor(Context.class, Display.class);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
index 70ee2b547..531f02831 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/trace/SdlTrace.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.trace;
import android.annotation.SuppressLint;
@@ -338,7 +338,7 @@ public class SdlTrace {
} else if (hdr.getFrameType() == FrameType.First ) {
int totalSize = BitConverter.intFromByteArray(hdr.getPayload(), 0);
int numFrames = BitConverter.intFromByteArray(hdr.getPayload(), 4);
- sb.append("<total>" + totalSize + "</total><numframes>" + numFrames + "</numframes>");
+ sb.append("<total>").append(totalSize).append("</total><numframes>").append(numFrames).append("</numframes>");
} else if (hdr.getFrameType() == FrameType.Single ) {
sb.append("<single/>");
}
@@ -355,8 +355,8 @@ public class SdlTrace {
sb.append("<btn>");
sb.append(SdlTrace.B64EncodeForXML(btdn));
sb.append("</btn>");
- sb.append("<bta>" + btDevice.getAddress() + "</bta>");
- sb.append("<bts>" + btDevice.getBondState() + "</bts>");
+ sb.append("<bta>").append(btDevice.getAddress()).append("</bta>");
+ sb.append("<bts>").append(btDevice.getBondState()).append("</bts>");
sb.append("</btp>");
return sb.toString();
} // end-method
@@ -452,17 +452,17 @@ public class SdlTrace {
write.append("<info>");
StringBuilder infoBlock = new StringBuilder();
String hostInfo = Build.BRAND + Sep + Build.MANUFACTURER + Sep + Build.MODEL + "(" + Build.HOST + ")";
- infoBlock.append("<host>" + SdlTrace.B64EncodeForXML(hostInfo) + "</host>");
+ infoBlock.append("<host>").append(SdlTrace.B64EncodeForXML(hostInfo)).append("</host>");
String osv = Build.VERSION.RELEASE + " (" + Build.VERSION.CODENAME + ")";
- infoBlock.append("<osv>" + SdlTrace.B64EncodeForXML(osv) + "</osv>");
+ infoBlock.append("<osv>").append(SdlTrace.B64EncodeForXML(osv)).append("</osv>");
infoBlock.append(TraceDeviceInfo.getTelephonyHeader());
long heapSize = Debug.getNativeHeapFreeSize() / 1024;
long heapAllocated = Debug.getNativeHeapAllocatedSize() / 1024;
- infoBlock.append("<mem><hf>" + heapSize + "KB</hf><ha>" + heapAllocated + "KB</ha></mem>");
- infoBlock.append("<np>" + Runtime.getRuntime().availableProcessors() + "</np>");
- infoBlock.append("<pid>" + Process.myPid() + "</pid>");
- infoBlock.append("<tid>" + Thread.currentThread().getId() + "</tid>");
+ infoBlock.append("<mem><hf>").append(heapSize).append("KB</hf><ha>").append(heapAllocated).append("KB</ha></mem>");
+ infoBlock.append("<np>").append(Runtime.getRuntime().availableProcessors()).append("</np>");
+ infoBlock.append("<pid>").append(Process.myPid()).append("</pid>");
+ infoBlock.append("<tid>").append(Thread.currentThread().getId()).append("</tid>");
// String dateStamp = (String)
// DateFormat.format("yy-MM-dd hh:mm:ss SSS", new Timestamp(baseTics));
@@ -470,7 +470,7 @@ public class SdlTrace {
String GMTtime = stamp.toGMTString().substring(0, 19);
long fracSec = stamp.getNanos() / 1000000; // divide by a million
String fracSecStr = String.format("%03d", fracSec);
- infoBlock.append("<utc>" + GMTtime + "." + fracSecStr + "</utc>");
+ infoBlock.append("<utc>").append(GMTtime).append(".").append(fracSecStr).append("</utc>");
infoBlock.append(TraceDeviceInfo.getLogHeaderBluetoothPairs());
infoBlock.append(getSmartDeviceLinkTraceRoot(dumpReason, seqNo));
@@ -486,12 +486,12 @@ public class SdlTrace {
+ "</sequencenum>" + "<dumpreason>" + dumpReason
+ "</dumpreason><tracelevel>");
- write.append("<tran>" + DiagLevel.getLevel(Mod.tran) + "</tran>");
- write.append("<proto>" + DiagLevel.getLevel(Mod.proto) + "</proto>");
- write.append("<mar>" + DiagLevel.getLevel(Mod.mar) + "</mar>");
- write.append("<rpc>" + DiagLevel.getLevel(Mod.rpc) + "</rpc>");
- write.append("<proxy>" + DiagLevel.getLevel(Mod.proxy) + "</proxy>");
- write.append("<app>" + DiagLevel.getLevel(Mod.app) + "</app>");
+ write.append("<tran>").append(DiagLevel.getLevel(Mod.tran)).append("</tran>");
+ write.append("<proto>").append(DiagLevel.getLevel(Mod.proto)).append("</proto>");
+ write.append("<mar>").append(DiagLevel.getLevel(Mod.mar)).append("</mar>");
+ write.append("<rpc>").append(DiagLevel.getLevel(Mod.rpc)).append("</rpc>");
+ write.append("<proxy>").append(DiagLevel.getLevel(Mod.proxy)).append("</proxy>");
+ write.append("<app>").append(DiagLevel.getLevel(Mod.app)).append("</app>");
write.append("</tracelevel>");
write.append("</SmartDeviceLinktraceroot>");
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
index 058fb0d7e..644cda21b 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexBluetoothTransport.java
@@ -19,6 +19,7 @@
package com.smartdevicelink.transport;
+import android.Manifest;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -28,6 +29,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.support.annotation.RequiresPermission;
import android.util.Log;
import com.smartdevicelink.protocol.SdlPacket;
@@ -40,6 +42,7 @@ import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Arrays;
import java.util.UUID;
/**
@@ -146,6 +149,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
/**
* Start the chat service. Specifically start AcceptThread to begin a
* session in listening (server) mode. Called by the Activity onResume() */
+ @SuppressLint("MissingPermission")
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public synchronized void start() {
//Log.d(TAG, "Starting up Bluetooth Server to Listen");
// Cancel any thread attempting to make a connection
@@ -202,6 +207,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
* @param socket The BluetoothSocket on which the connection was made
* @param device The BluetoothDevice that has been connected
*/
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public synchronized void connected(BluetoothSocket socket, BluetoothDevice device) {
// Cancel the thread that completed the connection
if (mConnectThread != null) {
@@ -284,7 +290,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
/**
* Write to the ConnectedThread in an unsynchronized manner
* @param out The bytes to write
- * @see ConnectedThread#write(byte[])
+ * @see ConnectedWriteThread#write(byte[],int,int)
*/
public void write(byte[] out, int offset, int count) {
// Create temporary object
@@ -356,7 +362,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
final BluetoothServerSocket mmServerSocket;
@SuppressLint("NewApi")
- public AcceptThread(boolean secure) {
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
+ public AcceptThread(boolean secure) {
synchronized(THREAD_LOCK){
//Log.d(TAG, "Creating an Accept Thread");
BluetoothServerSocket tmp = null;
@@ -379,7 +386,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//Log.d(TAG, "Accepting Connections on SDP Server Port Number: " + getChannel(mySock) + "\r\n");
}
}
-
+
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public void run() {
synchronized(THREAD_LOCK){
Log.d(TAG, "Socket Type: " + mSocketType +
@@ -454,7 +462,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
} catch (IOException e) {
- Log.e(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ e.getStackTrace());
+ Log.e(TAG, mState + " Socket Type " + mSocketType + " close() of server failed "+ Arrays.toString(e.getStackTrace()));
}
}
}
@@ -475,6 +483,7 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
}
+ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public void attemptCancelDiscovery(){
try{
mAdapter.cancelDiscovery();
@@ -482,7 +491,8 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
Log.e(TAG, "Don't have required permision to cancel discovery. Moving on");
}
}
-
+
+ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
public void run() {
setName("ConnectThread");
// Always cancel discovery because it will slow down a connection
@@ -525,7 +535,9 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//Looper.loop();
mmSocket.connect();
timeOutHandler.removeCallbacks(socketRunable);
- Looper.myLooper().quit();
+ if(Looper.myLooper() != null){
+ Looper.myLooper().quit();
+ }
success=true;
SdlRouterService.setBluetoothPrefs(1,SHARED_PREFS);
break;
@@ -554,7 +566,9 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//Looper.loop();
mmSocket.connect();
timeOutHandler.removeCallbacks(socketRunable);
- Looper.myLooper().quit();
+ if(Looper.myLooper() != null){
+ Looper.myLooper().quit();
+ }
success=true;
SdlRouterService.setBluetoothPrefs(2,SHARED_PREFS);
break;
@@ -583,7 +597,9 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//Looper.loop();
mmSocket.connect();
timeOutHandler.removeCallbacks(socketRunable);
- Looper.myLooper().quit();
+ if(Looper.myLooper() != null){
+ Looper.myLooper().quit();
+ }
success=true;
tryInsecure = false;
SdlRouterService.setBluetoothPrefs(3,SHARED_PREFS);
@@ -608,7 +624,9 @@ public class MultiplexBluetoothTransport extends MultiplexBaseTransport{
//Looper.loop();
mmSocket.connect();
timeOutHandler.removeCallbacks(socketRunable);
- Looper.myLooper().quit();
+ if(Looper.myLooper() != null){
+ Looper.myLooper().quit();
+ }
success=true;
SdlRouterService.setBluetoothPrefs(4,SHARED_PREFS);
break;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
index d5843f4c2..0fa211bd9 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexTcpTransport.java
@@ -47,6 +47,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
+import java.util.Locale;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import static com.smartdevicelink.util.DebugTool.logError;
import static com.smartdevicelink.util.NativeLogTool.logInfo;
@@ -235,7 +238,7 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}else{
if(autoReconnect){
remainingRetry--;
- logInfo(String.format("TCPTransport.connect: Socket not connected. AutoReconnect is ON. retryCount is: %d. Waiting for reconnect delay: %d"
+ logInfo(String.format(Locale.US,"TCPTransport.connect: Socket not connected. AutoReconnect is ON. retryCount is: %d. Waiting for reconnect delay: %d"
, remainingRetry, RECONNECT_DELAY));
waitFor(RECONNECT_DELAY);
} else {
@@ -354,8 +357,46 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
private class WriterThread extends Thread {
- private boolean mCancelled = false;
+ private boolean isHalted = false;
private boolean mVerbose = false;
+ final BlockingQueue<OutPacket> packetQueue = new LinkedBlockingQueue<>();
+
+ @Override
+ public void run() {
+ while(!isHalted){
+ try{
+ OutPacket packet = packetQueue.take();
+ if(packet == null){
+ continue;
+ }
+
+ OutputStream out;
+ synchronized (MultiplexTcpTransport.this) {
+ out = mOutputStream;
+ }
+
+ if ((out != null) && (!isHalted)) {
+ try {
+ out.write(packet.bytes, packet.offset, packet.count);
+ if (mVerbose) {
+ logInfo("TCPTransport.sendBytesOverTransport: successfully sent data");
+ }
+ } catch (IOException e) {
+ logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
+ }
+ } else {
+ if (isHalted) {
+ logError("TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
+ } else {
+ logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
+ }
+ }
+
+ }catch(InterruptedException e){
+ break;
+ }
+ }
+ }
public void write(byte[] msgBytes, int offset, int count) {
if ((msgBytes == null) || (msgBytes.length == 0)) {
@@ -366,32 +407,12 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
if (offset + count > msgBytes.length) {
count = msgBytes.length - offset;
}
+ packetQueue.add(new OutPacket(msgBytes, offset, count));
- OutputStream out;
- synchronized (MultiplexTcpTransport.this) {
- out = mOutputStream;
- }
-
- if ((out != null) && (!mCancelled)) {
- try {
- out.write(msgBytes, offset, count);
- if (mVerbose) {
- logInfo("TCPTransport.sendBytesOverTransport: successfully sent data");
- }
- } catch (IOException e) {
- logError("TCPTransport.sendBytesOverTransport: error during sending data: " + e.getMessage());
- }
- } else {
- if (mCancelled) {
- logError("TCPTransport: sendBytesOverTransport request accepted, thread is cancelled");
- } else {
- logError("TCPTransport: sendBytesOverTransport request accepted, but output stream is null");
- }
- }
}
public synchronized void cancel() {
- mCancelled = true;
+ isHalted = true;
if (mOutputStream != null) {
synchronized (MultiplexTcpTransport.this) {
try {
@@ -410,4 +431,18 @@ public class MultiplexTcpTransport extends MultiplexBaseTransport {
}
}
}
+
+ private final class OutPacket{
+ byte[] bytes;
+ int count;
+ int offset;
+
+ OutPacket(byte[] bytes, int offset, int count){
+ this.bytes = bytes;
+ this.offset = offset;
+ this.count = count;
+ }
+ }
+
+
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
index 187732a8e..06729d62a 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/RouterServiceValidator.java
@@ -263,14 +263,14 @@ public class RouterServiceValidator {
/**
* This method will find which router service is running. Use that info to find out more about that app and service.
* It will store the found service for later use and return the package name if found.
- * @param context
+ * @param pm An instance of a package manager. This is no longer used so null can be sent.
* @return
*/
public ComponentName componentNameForServiceRunning(PackageManager pm){
if(context==null){
return null;
}
- ActivityManager manager = (ActivityManager) context.getSystemService("activity");
+ ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//PackageManager pm = context.getPackageManager();
@@ -470,16 +470,18 @@ public class RouterServiceValidator {
final JSONObject object = new JSONObject();
JSONArray array = new JSONArray();
JSONObject jsonApp;
-
- for(SdlApp app: apps){ //Format all the apps into a JSON object and add it to the JSON array
- try{
- jsonApp = new JSONObject();
- jsonApp.put(JSON_APP_PACKAGE_TAG, app.packageName);
- jsonApp.put(JSON_APP_VERSION_TAG, app.versionCode);
- array.put(jsonApp);
- }catch(JSONException e){
- e.printStackTrace();
- continue;
+
+ if(apps != null) {
+ for (SdlApp app : apps) { //Format all the apps into a JSON object and add it to the JSON array
+ try {
+ jsonApp = new JSONObject();
+ jsonApp.put(JSON_APP_PACKAGE_TAG, app.packageName);
+ jsonApp.put(JSON_APP_VERSION_TAG, app.versionCode);
+ array.put(jsonApp);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ continue;
+ }
}
}
@@ -554,8 +556,7 @@ public class RouterServiceValidator {
}
try {
JSONObject object = new JSONObject(json);
- JSONObject trustedApps = object.getJSONObject(JSON_RESPONSE_OBJECT_TAG);
- return trustedApps;
+ return object.getJSONObject(JSON_RESPONSE_OBJECT_TAG);
} catch (JSONException e) {
e.printStackTrace();
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 94025de30..92f19e56d 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -45,13 +45,16 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.hardware.usb.UsbManager;
import android.os.Build;
+import android.os.Looper;
import android.os.Parcelable;
+import android.util.AndroidRuntimeException;
import android.util.Log;
import com.smartdevicelink.R;
import com.smartdevicelink.transport.RouterServiceValidator.TrustedListCallback;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.AndroidTools;
+import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.SdlAppInfo;
import com.smartdevicelink.util.ServiceFinder;
@@ -81,7 +84,8 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
private static final Object QUEUED_SERVICE_LOCK = new Object();
private static ComponentName queuedService = null;
-
+ private static Thread.UncaughtExceptionHandler foregroundExceptionHandler = null;
+
public int getRouterServiceVersion(){
return SdlRouterService.ROUTER_SERVICE_VERSION_NUMBER;
}
@@ -90,6 +94,10 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
public void onReceive(Context context, Intent intent) {
//Log.i(TAG, "Sdl Receiver Activated");
final String action = intent.getAction();
+ if(action == null){
+ return;
+ }
+
BluetoothDevice device = null;
if(action.equalsIgnoreCase(Intent.ACTION_PACKAGE_ADDED)
@@ -216,7 +224,7 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
private boolean wakeUpRouterService(final Context context, final boolean ping, final boolean altTransportWake, final BluetoothDevice device){
- new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
+ new ServiceFinder(context, context.getPackageName(), new ServiceFinder.ServiceFinderCallback() {
@Override
public void onComplete(Vector<ComponentName> routerServices) {
runningBluetoothServicePackage = new Vector<ComponentName>();
@@ -245,6 +253,8 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
context.startService(serviceIntent);
}else {
serviceIntent.putExtra(FOREGROUND_EXTRA, true);
+ DebugTool.logInfo("Attempting to startForegroundService - " + System.currentTimeMillis());
+ setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
context.startForegroundService(serviceIntent);
}
@@ -285,6 +295,37 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
}
/**
+ * This method will set a new UncaughtExceptionHandler for the current thread. The only
+ * purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the
+ * SdlRouterService can't be started fast enough by the system after calling
+ * startForegroundService so the onCreate method doesn't get called before the foreground promise
+ * timer expires. The new UncaughtExceptionHandler will catch that specific exception and tell the
+ * main looper to continue forward. This still leaves the SdlRouterService killed, but prevents
+ * an ANR to the app that makes the startForegroundService call.
+ */
+ static private void setForegroundExceptionHandler() {
+ final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+ if(defaultUncaughtExceptionHandler != foregroundExceptionHandler){
+ foregroundExceptionHandler = new Thread.UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ if (e != null
+ && e instanceof AndroidRuntimeException
+ && "android.app.RemoteServiceException".equals(e.getClass().getName()) //android.app.RemoteServiceException is a private class
+ && e.getMessage().contains("SdlRouterService")) {
+
+ Log.i(TAG, "Handling failed startForegroundService call");
+ Looper.loop();
+ } else if (defaultUncaughtExceptionHandler != null) { //No other exception should be handled
+ defaultUncaughtExceptionHandler.uncaughtException(t, e);
+ }
+ }
+ };
+ Thread.setDefaultUncaughtExceptionHandler(foregroundExceptionHandler);
+ }
+ }
+
+ /**
* Determines if an instance of the Router Service is currently running on the device.<p>
* <b>Note:</b> This method no longer works on Android Oreo or newer
* @param context A context to access Android system services through.
@@ -340,6 +381,8 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
intent.putExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA, true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
intent.putExtra(FOREGROUND_EXTRA, true);
+ DebugTool.logInfo("Attempting to startForegroundService - " + System.currentTimeMillis());
+ setForegroundExceptionHandler(); //Prevent ANR in case the OS takes too long to start the service
context.startForegroundService(intent);
}else {
context.startService(intent);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
index efc1fbe2e..3abd61094 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
@@ -70,6 +70,7 @@ import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.os.RemoteException;
import android.support.annotation.NonNull;
+import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseIntArray;
@@ -137,7 +138,7 @@ public class SdlRouterService extends Service{
/**
* <b> NOTE: DO NOT MODIFY THIS UNLESS YOU KNOW WHAT YOU'RE DOING.</b>
*/
- protected static final int ROUTER_SERVICE_VERSION_NUMBER = 9;
+ protected static final int ROUTER_SERVICE_VERSION_NUMBER = 10;
private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
@@ -195,6 +196,7 @@ public class SdlRouterService extends Service{
private boolean wrongProcess = false;
private boolean initPassed = false;
+ private boolean hasCalledStartForeground = false;
public static HashMap<String,RegisteredApp> registeredApps;
private SparseArray<String> bluetoothSessionMap, usbSessionMap, tcpSessionMap;
@@ -1098,14 +1100,16 @@ public class SdlRouterService extends Service{
super.onCreate();
//This must be done regardless of if this service shuts down or not
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ hasCalledStartForeground = false;
enterForeground("Waiting for connection...", FOREGROUND_TIMEOUT/1000, false);
+ hasCalledStartForeground = true;
resetForegroundTimeOut(FOREGROUND_TIMEOUT/1000);
}
if(!initCheck()){ // Run checks on process and permissions
deployNextRouterService();
- stopSelf();
+ closeSelf();
return;
}
initPassed = true;
@@ -1169,9 +1173,7 @@ public class SdlRouterService extends Service{
disconnectFilter.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
disconnectFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
- disconnectFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
- }
+ disconnectFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
registerReceiver(mListenForDisconnect,disconnectFilter );
IntentFilter filter = new IntentFilter();
@@ -1197,17 +1199,11 @@ public class SdlRouterService extends Service{
@SuppressLint({"NewApi", "MissingPermission"})
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- if(!initPassed) {
- return super.onStartCommand(intent, flags, startId);
- }
- if(registeredApps == null){
- synchronized(REGISTERED_APPS_LOCK){
- registeredApps = new HashMap<String,RegisteredApp>();
- }
- }
if(intent != null ){
if(intent.getBooleanExtra(FOREGROUND_EXTRA, false)){
- if(!this.isPrimaryTransportConnected()) { //If there is no transport connected we need to ensure the service is moved to the foreground
+ hasCalledStartForeground = false;
+
+ if (!this.isPrimaryTransportConnected()) { //If there is no transport connected we need to ensure the service is moved to the foreground
String address = null;
if(intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)){
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
@@ -1218,10 +1214,13 @@ public class SdlRouterService extends Service{
int timeout = getNotificationTimeout(address);
enterForeground("Waiting for connection...", timeout, false);
resetForegroundTimeOut(timeout);
- }else{
+ } else {
enterForeground(createConnectedNotificationText(),0,true);
}
+
+ hasCalledStartForeground = true;
}
+
if(intent.hasExtra(TransportConstants.PING_ROUTER_SERVICE_EXTRA)){
//Make sure we are listening on RFCOMM
if(startSequenceComplete){ //We only check if we are sure we are already through the start up process
@@ -1230,10 +1229,17 @@ public class SdlRouterService extends Service{
}
}
}
+
if(!shouldServiceRemainOpen(intent)){
closeSelf();
}
- return super.onStartCommand(intent, flags, startId);
+
+ if(registeredApps == null){
+ synchronized(REGISTERED_APPS_LOCK){
+ registeredApps = new HashMap<String,RegisteredApp>();
+ }
+ }
+ return START_REDELIVER_INTENT;
}
@SuppressWarnings("ConstantConditions")
@@ -1386,6 +1392,7 @@ public class SdlRouterService extends Service{
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
private void enterForeground(String content, long chronometerLength, boolean ongoing) {
+ DebugTool.logInfo("Attempting to enter the foreground - " + System.currentTimeMillis());
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB){
Log.w(TAG, "Unable to start service as foreground due to OS SDK version being lower than 11");
isForeground = false;
@@ -1459,6 +1466,7 @@ public class SdlRouterService extends Service{
} else {
Log.e(TAG, "Unable to retrieve notification Manager service");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
+ safeStartForeground(FOREGROUND_SERVICE_ID, builder.build());
stopSelf(); //A valid notification channel must be supplied for SDK 27+
}
}
@@ -1467,17 +1475,43 @@ public class SdlRouterService extends Service{
notification = builder.build();
}
if (notification == null) {
+ safeStartForeground(FOREGROUND_SERVICE_ID, builder.build());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
stopSelf(); //A valid notification must be supplied for SDK 27+
}
return;
}
- startForeground(FOREGROUND_SERVICE_ID, notification);
+ safeStartForeground(FOREGROUND_SERVICE_ID, notification);
isForeground = true;
+
}
}
+ /**
+ * This is a simple wrapper around the startForeground method. In the case that the notification
+ * is null, or a notification was unable to be created we will still attempt to call the
+ * startForeground method in hopes that Android will not throw the System Exception.
+ * @param id notification channel id
+ * @param notification the notification to display when in the foreground
+ */
+ private void safeStartForeground(int id, Notification notification){
+ try{
+ if(notification == null){
+ //Try the NotificationCompat this time in case there was a previous error
+ NotificationCompat.Builder builder =
+ new NotificationCompat.Builder(this, SDL_NOTIFICATION_CHANNEL_ID)
+ .setContentTitle("SmartDeviceLink")
+ .setContentText("Service Running");
+ notification = builder.build();
+ }
+ startForeground(id, notification);
+ DebugTool.logInfo("Entered the foreground - " + System.currentTimeMillis());
+ }catch (Exception e){
+ DebugTool.logError("Unable to start service in foreground", e);
+ }
+ }
+
private void exitForeground(){
synchronized (NOTIFICATION_LOCK) {
if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
@@ -1613,8 +1647,13 @@ public class SdlRouterService extends Service{
*/
public void closeSelf(){
closing = true;
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !hasCalledStartForeground ){
+ //This must be called before stopping self
+ safeStartForeground(FOREGROUND_SERVICE_ID, null);
+ exitForeground();
+ }
- if(getBaseContext()!=null){
+ if(getBaseContext()!= null){
stopSelf();
}
@@ -1754,40 +1793,42 @@ public class SdlRouterService extends Service{
master.alert();
}
}
- //Ensure the associated transport is dealt with
- switch (record.getType()){
- case BLUETOOTH:
- synchronized(SESSION_LOCK){
- if(bluetoothSessionMap!= null){
- bluetoothSessionMap.clear();
+ if(record != null) {
+ //Ensure the associated transport is dealt with
+ switch (record.getType()) {
+ case BLUETOOTH:
+ synchronized (SESSION_LOCK) {
+ if (bluetoothSessionMap != null) {
+ bluetoothSessionMap.clear();
+ }
}
- }
- if(!connectAsClient ){
- if(!legacyModeEnabled && !closing){
- initBluetoothSerialService();
+ if (!connectAsClient) {
+ if (!legacyModeEnabled && !closing) {
+ initBluetoothSerialService();
+ }
}
- }
- break;
- case USB:
- if(usbTransport != null){
- usbTransport = null;
- }
- synchronized(SESSION_LOCK){
- if(usbSessionMap!= null){
- usbSessionMap.clear();
+ break;
+ case USB:
+ if (usbTransport != null) {
+ usbTransport = null;
}
- }
- break;
- case TCP:
- if(tcpTransport != null){
- tcpTransport = null;
- }
- synchronized(SESSION_LOCK){
- if(tcpSessionMap!=null){
- tcpSessionMap.clear();
+ synchronized (SESSION_LOCK) {
+ if (usbSessionMap != null) {
+ usbSessionMap.clear();
+ }
}
- }
- break;
+ break;
+ case TCP:
+ if (tcpTransport != null) {
+ tcpTransport = null;
+ }
+ synchronized (SESSION_LOCK) {
+ if (tcpSessionMap != null) {
+ tcpSessionMap.clear();
+ }
+ }
+ break;
+ }
}
if(!getConnectedTransports().isEmpty()){
@@ -1926,26 +1967,28 @@ public class SdlRouterService extends Service{
int offset = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_OFFSET, 0); //If nothing, start at the beginning of the array
int count = bundle.getInt(TransportConstants.BYTES_TO_SEND_EXTRA_COUNT, packet.length); //In case there isn't anything just send the whole packet.
TransportType transportType = TransportType.valueForString(bundle.getString(TransportConstants.TRANSPORT_TYPE));
- switch ((transportType)){
- case BLUETOOTH:
- if(bluetoothTransport !=null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
- bluetoothTransport.write(packet, offset, count);
- return true;
- }
- case USB:
- if(usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- usbTransport.write(packet, offset, count);
- return true;
- }
- case TCP:
- if(tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
- tcpTransport.write(packet, offset, count);
- return true;
- }
+ if(transportType != null) {
+ switch ((transportType)) {
+ case BLUETOOTH:
+ if (bluetoothTransport != null && bluetoothTransport.getState() == MultiplexBluetoothTransport.STATE_CONNECTED) {
+ bluetoothTransport.write(packet, offset, count);
+ return true;
+ }
+ case USB:
+ if (usbTransport != null && usbTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ usbTransport.write(packet, offset, count);
+ return true;
+ }
+ case TCP:
+ if (tcpTransport != null && tcpTransport.getState() == MultiplexBaseTransport.STATE_CONNECTED) {
+ tcpTransport.write(packet, offset, count);
+ return true;
+ }
default:
- if(sendThroughAltTransport(bundle)){
+ if (sendThroughAltTransport(bundle)) {
return true;
}
+ }
}
Log.e(TAG, "Can't send data, no transport of specified type connected");
return false;
@@ -3133,9 +3176,11 @@ public class SdlRouterService extends Service{
}
protected boolean unregisterTransport(int sessionId, @NonNull TransportType transportType){
- if(queues != null && queues.containsValue(transportType)){
+ if(queues != null && queues.containsKey(transportType)){
PacketWriteTaskBlockingQueue queue = queues.remove(transportType);
- queue.clear();
+ if(queue != null){
+ queue.clear();
+ }
}
synchronized (TRANSPORT_LOCK){
if(sessionId == -1){
@@ -3173,10 +3218,10 @@ public class SdlRouterService extends Service{
* @return
*/
private TransportType getCompatPrimaryTransport(){
- if(this.registeredTransports != null){
+ if(this.registeredTransports != null && this.registeredTransports.size() > 0) {
List<TransportType> transportTypes = this.registeredTransports.valueAt(0);
- if(transportTypes != null){
- if(transportTypes.get(0) != null){
+ if (transportTypes != null) {
+ if (transportTypes.get(0) != null) {
return transportTypes.get(0);
}
}
@@ -3199,7 +3244,9 @@ public class SdlRouterService extends Service{
int flags = receivedBundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
TransportType transportType = TransportType.valueForString(receivedBundle.getString(TransportConstants.TRANSPORT_TYPE));
if(transportType == null){
- transportType = getCompatPrimaryTransport();
+ synchronized (TRANSPORT_LOCK){
+ transportType = getCompatPrimaryTransport();
+ }
receivedBundle.putString(TransportConstants.TRANSPORT_TYPE, transportType.name());
}
@@ -3217,10 +3264,12 @@ public class SdlRouterService extends Service{
queues.put(transportType,queue);
}
queue.add(new PacketWriteTask(receivedBundle));
- PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
- if(packetWriteTaskMaster!=null){
- packetWriteTaskMaster.alert();
- }
+ if(packetWriteTaskMasterMap != null) {
+ PacketWriteTaskMaster packetWriteTaskMaster = packetWriteTaskMasterMap.get(transportType);
+ if (packetWriteTaskMaster != null) {
+ packetWriteTaskMaster.alert();
+ }
+ } //If this is null, it is likely the service is closing
}
return true;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
index 4e9f4ffba..4ae010a8c 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransport.java
@@ -1,36 +1,37 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.transport;
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.NetworkOnMainThreadException;
@@ -136,11 +137,10 @@ public class TCPTransport extends SdlTransport {
/**
* Performs actual work of sending array of bytes over the transport
- * @param msgBytes Bytes to send
- * @param offset Offset in the bytes array to send data from
- * @param length Number of bytes to send
+ * @param packet The SdlPacket that should be sent over the transport
* @return True if data was sent successfully, False otherwise
*/
+ @SuppressLint("DefaultLocale")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected boolean sendBytesOverTransport(SdlPacket packet) {
@@ -350,6 +350,7 @@ public class TCPTransport extends SdlTransport {
*
* @return true if connection established and false otherwise
*/
+ @SuppressLint("DefaultLocale")
private boolean connect() {
boolean bConnected;
int remainingRetry = RECONNECT_RETRY_COUNT;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
new file mode 100644
index 000000000..29e0c3aa1
--- /dev/null
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TCPTransportManager.java
@@ -0,0 +1,135 @@
+package com.smartdevicelink.transport;
+
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+import com.smartdevicelink.protocol.SdlPacket;
+import com.smartdevicelink.transport.enums.TransportType;
+import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
+
+import java.lang.ref.WeakReference;
+
+public class TCPTransportManager extends TransportManagerBase{
+
+ private static final String TAG = "TCPTransportManager";
+
+ private TCPHandler tcpHandler;
+ private MultiplexTcpTransport transport;
+ private TCPTransportConfig config;
+
+ public TCPTransportManager(TCPTransportConfig config, TransportEventListener transportEventListener){
+ super(config,transportEventListener);
+ Log.d(TAG, "USING THE TCP TRANSPORT MANAGER");
+ this.config = config;
+ tcpHandler = new TCPHandler(this);
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(),tcpHandler, null);
+ }
+
+ @Override
+ public void start() {
+ transport.start();
+
+ }
+
+ @Override
+ public void close(long sessionId) {
+ transport.stop();
+ }
+
+ @Override
+ public void resetSession() {
+ if(transport != null){
+ transport.stop();
+ }
+ //TODO make sure this makes sense
+ transport = new MultiplexTcpTransport(config.getPort(), config.getIPAddress(),config.getAutoReconnect(), tcpHandler, null);
+
+ }
+
+ @Override
+ public boolean isConnected(TransportType transportType, String address) {
+ return (transportType == null || TransportType.TCP.equals(transportType)) && transport.isConnected();
+ }
+
+ @Override
+ public TransportRecord getTransportRecord(TransportType transportType, String address) {
+ if(transport != null){
+ return transport.getTransportRecord();
+ }else{
+ return null;
+ }
+ }
+
+ @Override
+ public void sendPacket(SdlPacket packet) {
+ if(packet != null){
+ byte[] rawBytes = packet.constructPacket();
+ if(rawBytes != null && rawBytes.length >0){
+ transport.write(rawBytes, 0, rawBytes.length);
+ }
+ }
+
+ }
+
+
+ protected static class TCPHandler extends Handler {
+
+ final WeakReference<TCPTransportManager> provider;
+
+ public TCPHandler(TCPTransportManager provider){
+ this.provider = new WeakReference<>(provider);
+ }
+ @Override
+ public void handleMessage(Message msg) {
+ if(this.provider.get() == null){
+ return;
+ }
+ TCPTransportManager service = this.provider.get();
+ if(service.transportListener == null){
+ return;
+ }
+ switch (msg.what) {
+ case SdlRouterService.MESSAGE_STATE_CHANGE:
+ switch (msg.arg1) {
+ case MultiplexBaseTransport.STATE_CONNECTED:
+ synchronized (service.TRANSPORT_STATUS_LOCK){
+ service.transportStatus.clear();
+ service.transportStatus.add(service.transport.getTransportRecord());
+ }
+ DebugTool.logInfo("TCP transport has connected");
+ service.transportListener.onTransportConnected(service.transportStatus);
+ break;
+ case MultiplexBaseTransport.STATE_CONNECTING:
+ // Currently attempting to connect - update UI?
+ break;
+ case MultiplexBaseTransport.STATE_LISTEN:
+ if(service.transport != null){
+ service.transport.stop();
+ service.transport = null;
+ }
+ break;
+ case MultiplexBaseTransport.STATE_NONE:
+ // We've just lost the connection
+ if(service.transport != null){
+ service.transportListener.onTransportDisconnected("TCP transport disconnected", service.transport.transportRecord, null);
+ }else{
+ service.transportListener.onTransportDisconnected("TCP transport disconnected", null, null);
+
+ }
+ break;
+ case MultiplexBaseTransport.STATE_ERROR:
+ Log.d(TAG, "TCP transport encountered an error");
+ service.transportListener.onError("TCP transport encountered an error" );
+ break;
+ }
+ break;
+
+ case SdlRouterService.MESSAGE_READ:
+ service.transportListener.onPacketReceived((SdlPacket) msg.obj);
+ break;
+ }
+ }
+ }
+}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
index 0ab335bf9..710e9d610 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportBroker.java
@@ -55,6 +55,7 @@ import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.transport.utl.ByteAraryMessageAssembler;
import com.smartdevicelink.transport.utl.ByteArrayMessageSpliter;
import com.smartdevicelink.transport.utl.TransportRecord;
+import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
@@ -119,7 +120,6 @@ public class TransportBroker {
Log.d(TAG, "Unbound from service " + className.getClassName());
routerServiceMessenger = null;
registeredWithRouterService = false;
- unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
}
@@ -145,7 +145,7 @@ public class TransportBroker {
} catch (RemoteException e) {
e.printStackTrace();
//Let's check to see if we should retry
- if (e instanceof TransactionTooLargeException
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 && e instanceof TransactionTooLargeException )
|| (retryCount < 5 && routerServiceMessenger.getBinder().isBinderAlive() && routerServiceMessenger.getBinder().pingBinder())) { //We probably just failed on a small transaction =\
try {
Thread.sleep(100);
@@ -158,6 +158,7 @@ public class TransportBroker {
Log.d(TAG, "Dead object while attempting to send packet");
routerServiceMessenger = null;
registeredWithRouterService = false;
+ unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
return false;
@@ -166,6 +167,7 @@ public class TransportBroker {
Log.d(TAG, "Null messenger while attempting to send packet"); // NPE, routerServiceMessenger is null
routerServiceMessenger = null;
registeredWithRouterService = false;
+ unBindFromRouterService();
isBound = false;
onHardwareDisconnected(null, null);
return false;
@@ -264,6 +266,10 @@ public class TransportBroker {
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
+ if(bundle == null){
+ DebugTool.logWarning("Received packet message from router service with no bundle");
+ return;
+ }
//So the intent has a packet with it. PEFRECT! Let's send it through the library
int flags = bundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS, TransportConstants.BYTES_TO_SEND_FLAG_NONE);
@@ -318,6 +324,10 @@ public class TransportBroker {
}
break;
case TransportConstants.HARDWARE_CONNECTION_EVENT:
+ if(bundle == null){
+ DebugTool.logWarning("Received hardware connection message from router service with no bundle");
+ return;
+ }
if (bundle.containsKey(TransportConstants.TRANSPORT_DISCONNECTED)
|| bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
//We should shut down, so call
@@ -448,7 +458,7 @@ public class TransportBroker {
* This method will end our communication with the router service.
*/
public void stop() {
- //Log.d(TAG, "STOPPING transport broker for " + whereToReply);
+ DebugTool.logInfo("Stopping transport broker for " + whereToReply);
synchronized (INIT_LOCK) {
unregisterWithRouterService();
unBindFromRouterService();
@@ -461,15 +471,13 @@ public class TransportBroker {
private synchronized void unBindFromRouterService() {
try {
- if (isBound && getContext() != null && routerConnection != null) {
- getContext().unbindService(routerConnection);
- isBound = false;
- } else {
- Log.w(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
- }
+ getContext().unbindService(routerConnection);
- } catch (IllegalArgumentException e) {
+ } catch (Exception e) {
//This is ok
+ Log.w(TAG, "Unable to unbind from router service. bound? " + isBound + " context? " + (getContext()!=null) + " router connection?" + (routerConnection != null));
+ }finally {
+ isBound = false;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
index 051736dce..9a300fa08 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/TransportManager.java
@@ -32,6 +32,7 @@
package com.smartdevicelink.transport;
+import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -312,7 +313,7 @@ public class TransportManager extends TransportManagerBase{
//Might check connectedTransports vs transportStatus to ensure they are equal
//If the transport wasn't removed, check RS version for corner case
- if(!wasRemoved && getRouterServiceVersion() == 8){
+ if(!wasRemoved && record != null &&getRouterServiceVersion() == 8){
boolean foundMatch = false;
//There is an issue in the first gen of multi transport router services that
//will remove certain extras from messages to the TransportBroker if older apps
@@ -413,7 +414,10 @@ public class TransportManager extends TransportManagerBase{
legacyBluetoothHandler = new LegacyBluetoothHandler(this);
legacyBluetoothTransport = new MultiplexBluetoothTransport(legacyBluetoothHandler);
if(contextWeakReference.get() != null){
- contextWeakReference.get().registerReceiver(legacyDisconnectReceiver,new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED) );
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
+ intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ contextWeakReference.get().registerReceiver(legacyDisconnectReceiver, intentFilter );
}
}else{
new Handler().postDelayed(new Runnable() {
@@ -451,8 +455,15 @@ public class TransportManager extends TransportManagerBase{
@Override
public void onReceive(Context context, Intent intent) {
if(intent != null){
- if(BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(intent.getAction())){
+ String action = intent.getAction();
+ if(BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)){
exitLegacyMode("Bluetooth disconnected");
+ }else if(action.equalsIgnoreCase(BluetoothAdapter.ACTION_STATE_CHANGED)){
+ int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+ if(bluetoothState == BluetoothAdapter.STATE_TURNING_OFF || bluetoothState == BluetoothAdapter.STATE_OFF){
+ Log.d(TAG, "Bluetooth is shutting off, exiting legacy mode.");
+ exitLegacyMode("Bluetooth adapter shutting off");
+ }
}
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
index 878715147..b724377ed 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBAccessoryAttachmentActivity.java
@@ -103,7 +103,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
- checkUsbAccessoryIntent("Resume");
+ checkUsbAccessoryIntent();
}
@Override
@@ -112,13 +112,13 @@ public class USBAccessoryAttachmentActivity extends Activity {
this.setIntent(intent);
}
- private synchronized void checkUsbAccessoryIntent(String sourceAction) {
+ private synchronized void checkUsbAccessoryIntent() {
if(usbAccessory != null){
return;
}
final Intent intent = getIntent();
String action = intent.getAction();
- Log.d(TAG, sourceAction + " with action: " + action);
+ Log.d(TAG, "Received intent with action: " + action);
if (UsbManager.ACTION_USB_ACCESSORY_ATTACHED.equals(action)) {
usbAccessory = intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
@@ -157,7 +157,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
// The most optimal router service doesn't support the USB connection
// At this point to ensure that USB connection is still possible it might be
// worth trying to use the legacy USB transport scheme
- attemptLegacyUsbConnection();
+ attemptLegacyUsbConnection(usbAccessory);
return;
}
@@ -168,7 +168,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
Log.d(TAG, "WARNING: This application has not specified its SdlRouterService correctly in the manifest. THIS WILL THROW AN EXCEPTION IN FUTURE RELEASES!!");
// At this point to ensure that USB connection is still possible it might be
// worth trying to use the legacy USB transport scheme
- attemptLegacyUsbConnection();
+ attemptLegacyUsbConnection(usbAccessory);
return;
}
serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT);
@@ -185,7 +185,7 @@ public class USBAccessoryAttachmentActivity extends Activity {
if(startedService == null){
// A router service was not started or is not running.
DebugTool.logError(TAG + " - Error starting router service. Attempting legacy connection ");
- attemptLegacyUsbConnection();
+ attemptLegacyUsbConnection(usbAccessory);
return;
}
@@ -224,12 +224,16 @@ public class USBAccessoryAttachmentActivity extends Activity {
});
}
- private void attemptLegacyUsbConnection(){
- DebugTool.logInfo("Attempting to send USB connection intent using legacy method");
- Intent usbAccessoryAttachedIntent = new Intent(USBTransport.ACTION_USB_ACCESSORY_ATTACHED);
- usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_ACCESSORY, usbAccessory);
- usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, permissionGranted);
- AndroidTools.sendExplicitBroadcast(getApplicationContext(),usbAccessoryAttachedIntent,null);
+ private void attemptLegacyUsbConnection(UsbAccessory usbAccessory){
+ if(usbAccessory != null) {
+ DebugTool.logInfo("Attempting to send USB connection intent using legacy method");
+ Intent usbAccessoryAttachedIntent = new Intent(USBTransport.ACTION_USB_ACCESSORY_ATTACHED);
+ usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_ACCESSORY, usbAccessory);
+ usbAccessoryAttachedIntent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, permissionGranted);
+ AndroidTools.sendExplicitBroadcast(getApplicationContext(), usbAccessoryAttachedIntent, null);
+ }else{
+ DebugTool.logError("Unable to start legacy USB mode as the accessory was null");
+ }
finish();
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
index 03e0fbb59..698396ae1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/USBTransport.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.transport;
import android.annotation.SuppressLint;
@@ -529,7 +529,11 @@ public class USBTransport extends SdlTransport {
* @param accessory Accessory to check
* @return true if the accessory is right
*/
- public static boolean isAccessorySupported(UsbAccessory accessory) {
+ public static boolean isAccessorySupported(final UsbAccessory accessory) {
+ if (accessory == null) {
+ return false;
+ }
+
boolean manufacturerMatches =
ACCESSORY_MANUFACTURER.equals(accessory.getManufacturer());
boolean modelMatches = ACCESSORY_MODEL.equals(accessory.getModel());
@@ -547,6 +551,11 @@ public class USBTransport extends SdlTransport {
* @param accessory Accessory to connect to
*/
private void connectToAccessory(UsbAccessory accessory) {
+
+ if (accessory == null) {
+ handleTransportError("Can't connect to null accessory", null);
+ }
+
final State state = getState();
switch (state) {
case LISTENING:
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
index 5747bbe4e..4f9c5096e 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/ByteAraryMessageAssembler.java
@@ -40,7 +40,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class ByteAraryMessageAssembler {
- private static final String TAG = "ByteAraryMessageAssembler";
+ private static final String TAG = "ByteAraryMsgAssembler";
ByteArrayOutputStream buffer;
boolean isFinished;
TransportType transportType;
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
index 6e7fd7c75..d33f4c374 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/WiFiSocketFactory.java
@@ -72,6 +72,10 @@ public class WiFiSocketFactory {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Socket createWiFiSocket(Context context) {
+ if(context == null){
+ logInfo("Context supplied was null");
+ return null;
+ }
PackageManager pm = context.getPackageManager();
if (pm == null) {
logInfo("PackageManager isn't available.");
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
index c54c8b4f2..bedc38028 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
@@ -176,6 +176,9 @@ public class AndroidTools {
*/
public static boolean isUSBCableConnected(Context context) {
Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ if (intent == null ) {
+ return false;
+ }
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB;
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
index 143b6c646..be55e1102 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/MediaStreamingStatus.java
@@ -125,16 +125,8 @@ public class MediaStreamingStatus {
return false;
}
- if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE
- && android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
-
- return audioManager.isBluetoothA2dpOn();
- }
-
- //If an acceptable audio device hasn't been found or the API level is too low, then only a
- //value of false can be returned as there is not enough information to determine if an audio
- //device is available.
- return false;
+ //This means the SDK version is < M, and our min is 8 so this API is always available
+ return audioManager.isBluetoothA2dpOn();
}
/**
@@ -203,7 +195,11 @@ public class MediaStreamingStatus {
private void setupBluetoothBroadcastReceiver(){
String[] actions = new String[4];
- actions[0] = BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ actions[0] = BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED;
+ }else{
+ actions[0] = "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED";
+ }
actions[1] = BluetoothAdapter.ACTION_STATE_CHANGED;
actions[2] = BluetoothDevice.ACTION_ACL_DISCONNECTED;
actions[3] = BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED;
@@ -213,7 +209,11 @@ public class MediaStreamingStatus {
private void setupHeadsetBroadcastReceiver(){
String[] actions = new String[1];
- actions[0] = AudioManager.ACTION_HEADSET_PLUG;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ actions[0] = AudioManager.ACTION_HEADSET_PLUG;
+ }else{
+ actions[0] = "android.intent.action.HEADSET_PLUG";
+ }
listenForIntents(actions);
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
index bdc588b1b..8172811c4 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java
@@ -35,6 +35,7 @@ package com.smartdevicelink.util;
import android.content.ComponentName;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
+import android.os.Build;
import android.os.Bundle;
import android.util.Log;
@@ -80,11 +81,13 @@ public class SdlAppInfo {
}
}
- if(packageInfo != null){
+ if(packageInfo != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD){
this.lastUpdateTime = packageInfo.lastUpdateTime;
if(this.lastUpdateTime <= 0){
this.lastUpdateTime = packageInfo.firstInstallTime;
}
+ }else{
+ this.lastUpdateTime = 0;
}
}
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java b/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
index 4e93f9a52..6f1740878 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/util/ServiceFinder.java
@@ -37,6 +37,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ResolveInfo;
+import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
@@ -163,7 +164,9 @@ public class ServiceFinder {
Intent intent = new Intent();
intent.setAction(SdlRouterService.REGISTER_WITH_ROUTER_ACTION);
intent.putExtra(SEND_PACKET_TO_APP_LOCATION_EXTRA_NAME, receiverLocation);
- intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ }
return intent;
}
diff --git a/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml b/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
index dd2c2a6bb..43b5e6840 100644
--- a/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
+++ b/android/sdl_android/src/main/res/layout/activity_sdllock_screen.xml
@@ -4,12 +4,12 @@
android:layout_height="fill_parent"
android:background="#2c3d4d">
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/lockscreen_linear_layout"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:gravity="center_horizontal|center_vertical">
+ <LinearLayout
+ android:id="@+id/lockscreen_linear_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center_horizontal|center_vertical">
<ImageView
android:id="@+id/lockscreen_image"
diff --git a/android/sdl_android/src/main/res/values/sdl.xml b/android/sdl_android/src/main/res/values/sdl.xml
index 8ee8f70cb..2b3a85a05 100644
--- a/android/sdl_android/src/main/res/values/sdl.xml
+++ b/android/sdl_android/src/main/res/values/sdl.xml
@@ -2,7 +2,7 @@
<resources>
<string name="sdl_router_service_version_name" translatable="false">sdl_router_version</string>
- <integer name="sdl_router_service_version_value">9</integer>
+ <integer name="sdl_router_service_version_value">10</integer>
<string name="sdl_router_service_is_custom_name" translatable="false">sdl_custom_router</string>
</resources>
diff --git a/android/sdl_android/src/main/res/values/strings.xml b/android/sdl_android/src/main/res/values/strings.xml
index 1d55ec24d..f74ce713b 100644
--- a/android/sdl_android/src/main/res/values/strings.xml
+++ b/android/sdl_android/src/main/res/values/strings.xml
@@ -3,4 +3,5 @@
<string name="lockscreen_text">Locked for your safety</string>
<string name="lockscreen_image_description">SDL Icon</string>
<string name="lockscreen_device_image_description">Device Icon</string>
+ <string name="default_lockscreen_warning_message">Swipe down to dismiss, acknowledging that you are not the driver.</string>
</resources> \ No newline at end of file
diff --git a/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java b/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
index 3658db561..0bf6dc34f 100644
--- a/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
+++ b/android/sdl_android/src/test/java/com/smartdevicelink/haptic/HapticInterfaceManagerTest.java
@@ -28,6 +28,8 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.HapticRect;
import com.smartdevicelink.proxy.rpc.Rectangle;
import com.smartdevicelink.proxy.rpc.SendHapticData;
+import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import junit.framework.TestCase;
@@ -46,6 +48,7 @@ import java.util.ArrayList;
import java.util.List;
import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -93,7 +96,7 @@ public class HapticInterfaceManagerTest extends TestCase {
public void testRefreshHapticData() throws Exception {
View root = createViews();
hapticMgr.refreshHapticData(root);
- verify(mockProxy).sendRPCRequest(captor.capture());
+ verify(mockProxy).sendRPC(captor.capture());
SendHapticData data = captor.getValue();
assertNotNull("SendHapticData RPC", data);
List<HapticRect> list = data.getHapticRectData();
@@ -104,7 +107,7 @@ public class HapticInterfaceManagerTest extends TestCase {
@Test
public void testRefreshHapticDataNull() throws Exception {
hapticMgr.refreshHapticData(null);
- verify(mockProxy).sendRPCRequest(captor.capture());
+ verify(mockProxy).sendRPC(captor.capture());
SendHapticData data = captor.getValue();
assertNotNull("SendHapticData RPC", data);
List<HapticRect> list = data.getHapticRectData();
@@ -112,6 +115,86 @@ public class HapticInterfaceManagerTest extends TestCase {
}
@Test
+ public void testRefreshHapticData_Scale_2_0() {
+ double scale = 2.0;
+
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(120.0f);
+ expected.setY(120.0f);
+ expected.setWidth(300.0f);
+ expected.setHeight(140.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(scale);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+
+ @Test
+ public void testRefreshHapticData_Scale_0_5() {
+ double scale = 0.5;
+
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(30.0f);
+ expected.setY(30.0f);
+ expected.setWidth(75.0f);
+ expected.setHeight(35.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(scale);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+
+
+ @Test
+ public void testRefreshHapticData_NullCapability() {
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(60.0f);
+ expected.setY(60.0f);
+ expected.setWidth(150.0f);
+ expected.setHeight(70.0f);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, null);
+ }
+
+ @Test
+ public void testRefreshHapticData_NullScale() {
+ final int buttonX = 60;
+ final int buttonY = 60;
+ final int buttonWidth = 150;
+ final int buttonHeight = 70;
+
+ Rectangle expected = new Rectangle();
+ expected.setX(60.0f);
+ expected.setY(60.0f);
+ expected.setWidth(150.0f);
+ expected.setHeight(70.0f);
+
+ VideoStreamingCapability capability = new VideoStreamingCapability();
+ capability.setScale(null);
+
+ assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability);
+ }
+
+ @Test
public void testRefreshWithUserData() throws Exception {
List<HapticRect> rects = new ArrayList<>();
Rectangle rect = new Rectangle();
@@ -170,4 +253,43 @@ public class HapticInterfaceManagerTest extends TestCase {
return parent1;
}
+
+
+ private View createView(final int x, final int y, int w, int h) {
+ View button = mock(View.class);
+ when(button.isFocusable()).thenReturn(true);
+ doAnswer(new Answer() {
+ @Override
+ public int[] answer(InvocationOnMock invocation) throws Throwable {
+ int[] args = (int[])(invocation.getArguments()[0]);
+ args[0] = x;
+ args[1] = y;
+ return args;
+ }
+ }).when(button).getLocationOnScreen(any(int[].class));
+
+ when(button.getWidth()).thenReturn(w);
+ when(button.getHeight()).thenReturn(h);
+ return button;
+ }
+
+ private void assertViewWithCapability(int x, int y, int w, int h, Rectangle expected, VideoStreamingCapability capability) {
+ when(mockProxy.getCapability(SystemCapabilityType.VIDEO_STREAMING)).thenReturn(capability);
+
+ View button = createView(x, y, w, h);
+
+
+ hapticMgr.refreshHapticData(button);
+ verify(mockProxy).sendRPC(captor.capture());
+
+ SendHapticData data = captor.getValue();
+ List<HapticRect> list = data.getHapticRectData();
+ assertEquals(1, list.size());
+ Rectangle current = list.get(0).getRect();
+
+ assertEquals(expected.getX(), current.getX(), 0.0005);
+ assertEquals(expected.getY(), current.getY(), 0.0005);
+ assertEquals(expected.getWidth(), current.getWidth(), 0.0005);
+ assertEquals(expected.getHeight(), current.getHeight(), 0.0005);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
index 5f73be39d..73a9c3dfd 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
@@ -63,6 +63,8 @@ abstract class BaseSdlManager {
final Object STATE_LOCK = new Object();
int state = -1;
+ static final int MAX_RETRY = 3;
+ int changeRegistrationRetry = 0;
String appId, appName, shortAppName;
boolean isMediaApp;
Language hmiLanguage;
@@ -179,6 +181,7 @@ abstract class BaseSdlManager {
abstract void checkState();
protected abstract void initialize();
+ protected abstract void checkLifecycleConfiguration();
//Public abstract API
public abstract void start();
diff --git a/base/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java b/base/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java
new file mode 100644
index 000000000..fedefdec2
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java
@@ -0,0 +1,10 @@
+package com.smartdevicelink.managers;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+
+import com.smartdevicelink.protocol.enums.SessionType;
+
+public interface ServiceEncryptionListener {
+ void onEncryptionServiceUpdated(@NonNull SessionType serviceType, boolean isServiceEncrypted, @Nullable String error);
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
index 12cea8c63..afb683383 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
@@ -44,12 +44,15 @@ import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteFile;
+import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.ListFiles;
import com.smartdevicelink.proxy.rpc.ListFilesResponse;
import com.smartdevicelink.proxy.rpc.PutFile;
+import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.DebugTool;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -77,7 +80,9 @@ import java.util.Map;
abstract class BaseFileManager extends BaseSubManager {
final static String TAG = "FileManager";
+ final static int SPACE_AVAILABLE_MAX_VALUE = 2000000000;
private List<String> remoteFiles, uploadedEphemeralFileNames;
+ private int bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
BaseFileManager(ISdl internalInterface) {
@@ -108,6 +113,14 @@ abstract class BaseFileManager extends BaseSubManager {
return remoteFiles;
}
+ /**
+ * Get the number of bytes still available for files for this app.
+ * @return int value representing The number of bytes still available
+ */
+ public int getBytesAvailable(){
+ return bytesAvailable;
+ }
+
private void retrieveRemoteFiles(){
remoteFiles = new ArrayList<>();
// hold list in remoteFiles class var
@@ -115,9 +128,12 @@ abstract class BaseFileManager extends BaseSubManager {
listFiles.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if(response.getSuccess()){
- if(((ListFilesResponse) response).getFilenames() != null){
- remoteFiles.addAll(((ListFilesResponse) response).getFilenames());
+ ListFilesResponse listFilesResponse = (ListFilesResponse) response;
+ if(listFilesResponse.getSuccess()){
+ bytesAvailable = listFilesResponse.getSpaceAvailable() != null ? listFilesResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
+ if(listFilesResponse.getFilenames() != null){
+ remoteFiles.addAll(listFilesResponse.getFilenames());
}
// on callback set manager to ready state
transitionToState(BaseSubManager.READY);
@@ -126,11 +142,13 @@ abstract class BaseFileManager extends BaseSubManager {
@Override
public void onError(int correlationId, Result resultCode, String info) {
- // file list could not be received
- transitionToState(BaseSubManager.ERROR);
+ // file list could not be received. assume that setting can work and allow SDLManager to start
+ DebugTool.logError("File Manager could not list files");
+ bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
+ transitionToState(BaseSubManager.READY);
}
});
- internalInterface.sendRPCRequest(listFiles);
+ internalInterface.sendRPC(listFiles);
}
// DELETION
@@ -146,16 +164,19 @@ abstract class BaseFileManager extends BaseSubManager {
deleteFile.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if(response.getSuccess()){
+ DeleteFileResponse deleteFileResponse = (DeleteFileResponse) response;
+ if(deleteFileResponse.getSuccess()){
+ bytesAvailable = deleteFileResponse.getSpaceAvailable() != null ? deleteFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
remoteFiles.remove(fileName);
uploadedEphemeralFileNames.remove(fileName);
}
if(listener != null){
- listener.onComplete(response.getSuccess());
+ listener.onComplete(deleteFileResponse.getSuccess());
}
}
});
- internalInterface.sendRPCRequest(deleteFile);
+ internalInterface.sendRPC(deleteFile);
}
/**
@@ -231,14 +252,17 @@ abstract class BaseFileManager extends BaseSubManager {
@Override
public void onError(int correlationId, Result resultCode, String info) {
- if(fileNameMap.get(correlationId) != null){
+ if(fileNameMap != null && fileNameMap.get(correlationId) != null){
errors.put(fileNameMap.get(correlationId), buildErrorString(resultCode, info));
}// else no fileName for given correlation ID
}
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if(response.getSuccess()){
+ PutFileResponse putFileResponse = (PutFileResponse) response;
+ if(putFileResponse.getSuccess()){
+ bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
if(fileNameMap.get(correlationId) != null){
if(deletionOperation){
remoteFiles.remove(fileNameMap.get(correlationId));
@@ -269,12 +293,15 @@ abstract class BaseFileManager extends BaseSubManager {
putFile.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if(response.getSuccess()){
+ PutFileResponse putFileResponse = (PutFileResponse) response;
+ if(putFileResponse.getSuccess()){
+ bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
+
remoteFiles.add(file.getName());
uploadedEphemeralFileNames.add(file.getName());
}
if(listener != null){
- listener.onComplete(response.getSuccess());
+ listener.onComplete(putFileResponse.getSuccess());
}
}
@@ -287,7 +314,7 @@ abstract class BaseFileManager extends BaseSubManager {
}
});
- internalInterface.sendRPCRequest(putFile);
+ internalInterface.sendRPC(putFile);
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
new file mode 100644
index 000000000..808f4b0cd
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseEncryptionLifecycleManager.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.support.annotation.NonNull;
+import com.smartdevicelink.SdlConnection.SdlSession;
+import com.smartdevicelink.managers.ServiceEncryptionListener;
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.protocol.enums.SessionType;
+import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
+import com.smartdevicelink.proxy.rpc.PermissionItem;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.util.DebugTool;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+abstract class BaseEncryptionLifecycleManager {
+ private ISdl internalInterface;
+ private ServiceEncryptionListener serviceEncryptionListener;
+ private HMILevel currentHMILevel;
+ private Set<String> encryptionRequiredRPCs = new HashSet<>();
+ private boolean rpcSecuredServiceStarted;
+
+ BaseEncryptionLifecycleManager(@NonNull ISdl isdl, ServiceEncryptionListener listener) {
+ internalInterface = isdl;
+ serviceEncryptionListener = listener;
+ rpcSecuredServiceStarted = false;
+
+ OnRPCNotificationListener onHMIStatusListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ currentHMILevel = onHMIStatus.getHmiLevel();
+ checkStatusAndInitSecuredService();
+ }
+ };
+
+ OnRPCNotificationListener onPermissionsChangeListener = new OnRPCNotificationListener() {
+ @Override
+ public void onNotified(RPCNotification notification) {
+ List<PermissionItem> permissionItems = ((OnPermissionsChange) notification).getPermissionItem();
+ Boolean requireEncryptionAppLevel = ((OnPermissionsChange) notification).getRequireEncryption();
+ encryptionRequiredRPCs.clear();
+ if (requireEncryptionAppLevel == null || requireEncryptionAppLevel) {
+ if (permissionItems != null && !permissionItems.isEmpty()) {
+ for (PermissionItem permissionItem : permissionItems) {
+ if (permissionItem != null && Boolean.TRUE.equals(permissionItem.getRequireEncryption())) {
+ String rpcName = permissionItem.getRpcName();
+ if (rpcName != null) {
+ encryptionRequiredRPCs.add(rpcName);
+ }
+ }
+ }
+ }
+ checkStatusAndInitSecuredService();
+ }
+ }
+ };
+
+ ISdlServiceListener securedServiceListener = new ISdlServiceListener() {
+ @Override
+ public void onServiceStarted(SdlSession session, SessionType type, boolean isEncrypted) {
+ if(SessionType.RPC.equals(type)){
+ rpcSecuredServiceStarted = isEncrypted;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, isEncrypted, null);
+ }
+ DebugTool.logInfo("onServiceStarted, session Type: " + type.getName() + ", isEncrypted: " + isEncrypted);
+ }
+
+ @Override
+ public void onServiceEnded(SdlSession session, SessionType type) {
+ if (SessionType.RPC.equals(type)) {
+ rpcSecuredServiceStarted = false;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, false, null);
+ }
+ DebugTool.logInfo("onServiceEnded, session Type: " + type.getName());
+ }
+
+ @Override
+ public void onServiceError(SdlSession session, SessionType type, String reason) {
+ if (SessionType.RPC.equals(type)) {
+ rpcSecuredServiceStarted = false;
+ }
+ if (serviceEncryptionListener != null) {
+ serviceEncryptionListener.onEncryptionServiceUpdated(type, false, "onServiceError: " + reason);
+ }
+ DebugTool.logError("onServiceError, session Type: " + type.getName() + ", reason: " + reason);
+ }
+ };
+
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
+ internalInterface.addOnRPCNotificationListener(FunctionID.ON_PERMISSIONS_CHANGE, onPermissionsChangeListener);
+ internalInterface.addServiceListener(SessionType.RPC, securedServiceListener);
+ }
+
+ /**
+ * Gets the app level encryption requirement
+ *
+ * @return true if encryption is required for app level; false otherwise
+ */
+ private boolean getRequiresEncryption() {
+ return !encryptionRequiredRPCs.isEmpty();
+ }
+
+ /**
+ * Checks if an RPC requires encryption
+ *
+ * @param rpcName the rpc name to check
+ * @return true if the given RPC requires encryption; false, otherwise
+ */
+ boolean getRPCRequiresEncryption(@NonNull FunctionID rpcName) {
+ return encryptionRequiredRPCs.contains(rpcName.toString());
+ }
+
+ /**
+ * Checks the current state and make the call back to initiate secured service flow
+ */
+ private void checkStatusAndInitSecuredService() {
+ if ((currentHMILevel != null && currentHMILevel != HMILevel.HMI_NONE) && getRequiresEncryption() && !isEncryptionReady() ) {
+ internalInterface.startRPCEncryption();
+ }
+ }
+
+ /**
+ * Check to see if a secured service is ready to use
+ *
+ * @return true if there is a secured service; false otherwise
+ */
+ boolean isEncryptionReady() {
+ return rpcSecuredServiceStarted;
+ }
+
+ /**
+ * Clean up everything after the manager is no longer needed
+ */
+ void dispose() {
+ rpcSecuredServiceStarted = false;
+ encryptionRequiredRPCs.clear();
+ serviceEncryptionListener = null;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
new file mode 100644
index 000000000..031918d3b
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 8/1/19 3:11 PM
+ *
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.support.annotation.Nullable;
+
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+
+import java.util.Vector;
+
+/**
+ * Configuration update options for SDLManager. This class can be used to update the lifecycle configuration in
+ * cases the language of the head unit changes or does not match the app language.
+ */
+public class LifecycleConfigurationUpdate {
+
+ private String appName, shortAppName;
+ private Vector<TTSChunk> ttsName;
+ private Vector<String> voiceRecognitionCommandNames;
+
+ // default constructor
+ public LifecycleConfigurationUpdate(){}
+
+ /**
+ * Initializes and returns a newly allocated lifecycle configuration update object with the specified app data.
+ * @param appName The full name of the app to that the configuration should be updated to.
+ * @param shortAppName An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ * @param ttsName A Text to Speech String for voice recognition of the mobile application name.
+ * @param voiceRecognitionCommandNames Additional voice recognition commands. May not interfere with any other app name or global commands.
+ */
+ public LifecycleConfigurationUpdate(@Nullable String appName, @Nullable String shortAppName, @Nullable Vector<TTSChunk> ttsName, @Nullable Vector<String> voiceRecognitionCommandNames){
+ setAppName(appName);
+ setShortAppName(shortAppName);
+ setTtsName(ttsName);
+ setVoiceRecognitionCommandNames(voiceRecognitionCommandNames);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * The full name of the app to that the configuration should be updated to.
+ */
+ public void setAppName(String appName) {
+ this.appName = appName;
+ }
+
+ /**
+ * The full name of the app to that the configuration should be updated to.
+ */
+ public String getAppName() {
+ return appName;
+ }
+
+ /**
+ * An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ */
+ public void setShortAppName(String shortAppName) {
+ this.shortAppName = shortAppName;
+ }
+
+ /**
+ * An abbreviated application name that will be used on the app launching screen if the full one would be truncated.
+ */
+ public String getShortAppName() {
+ return shortAppName;
+ }
+
+ /**
+ * A Text to Speech String for voice recognition of the mobile application name.
+ */
+ public void setTtsName(Vector<TTSChunk> ttsName) {
+ this.ttsName = ttsName;
+ }
+
+ /**
+ * A Text to Speech String for voice recognition of the mobile application name.
+ */
+ public Vector<TTSChunk> getTtsName() {
+ return ttsName;
+ }
+
+ public void setVoiceRecognitionCommandNames(Vector<String> voiceRecognitionCommandNames) {
+ this.voiceRecognitionCommandNames = voiceRecognitionCommandNames;
+ }
+
+ /**
+ * Additional voice recognition commands. May not interfere with any other app name or global commands.
+ */
+ public Vector<String> getVoiceRecognitionCommandNames() {
+ return voiceRecognitionCommandNames;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
index 8b705bb75..c8e234504 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/RpcConverter.java
@@ -137,7 +137,7 @@ public class RpcConverter {
}
}
- if(params.containsKey(RPCMessage.KEY_FUNCTION_NAME)){
+ if(params != null && params.containsKey(RPCMessage.KEY_FUNCTION_NAME)){
StringBuilder rpcClassName = new StringBuilder();
String functionName = (String)params.get(RPCMessage.KEY_FUNCTION_NAME);
if(FunctionID.SHOW_CONSTANT_TBT.toString().equals(functionName)) {
diff --git a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
index 6b9e198c2..5e242e21e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/permission/BasePermissionManager.java
@@ -43,14 +43,17 @@ import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.OnPermissionsChange;
import com.smartdevicelink.proxy.rpc.PermissionItem;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
/**
@@ -66,6 +69,7 @@ abstract class BasePermissionManager extends BaseSubManager{
private Map<FunctionID, PermissionItem> currentPermissionItems;
private OnRPCNotificationListener onHMIStatusListener, onPermissionsChangeListener;
private List<PermissionFilter> filters;
+ private Set<String> encryptionRequiredRPCs = new HashSet<>();
// Permission groups status constants
@IntDef({PERMISSION_GROUP_STATUS_ALLOWED, PERMISSION_GROUP_STATUS_DISALLOWED,
@@ -97,8 +101,12 @@ abstract class BasePermissionManager extends BaseSubManager{
onHMIStatusListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel previousHMILevel = currentHMILevel;
- currentHMILevel = ((OnHMIStatus)notification).getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
checkState();
notifyListeners(currentPermissionItems, previousHMILevel, currentPermissionItems, currentHMILevel);
}
@@ -111,6 +119,8 @@ abstract class BasePermissionManager extends BaseSubManager{
public void onNotified(RPCNotification notification) {
List<PermissionItem> permissionItems = ((OnPermissionsChange)notification).getPermissionItem();
Map<FunctionID, PermissionItem> previousPermissionItems = currentPermissionItems;
+ Boolean requireEncryptionAppLevel = ((OnPermissionsChange) notification).getRequireEncryption();
+ encryptionRequiredRPCs.clear();
currentPermissionItems = new HashMap<>();
if (permissionItems != null && !permissionItems.isEmpty()) {
for (PermissionItem permissionItem : permissionItems) {
@@ -118,6 +128,14 @@ abstract class BasePermissionManager extends BaseSubManager{
if (functionID != null) {
currentPermissionItems.put(functionID, permissionItem);
}
+ if (Boolean.TRUE.equals(permissionItem.getRequireEncryption())) {
+ if (requireEncryptionAppLevel == null || requireEncryptionAppLevel) {
+ String rpcName = permissionItem.getRpcName();
+ if (rpcName != null) {
+ encryptionRequiredRPCs.add(rpcName);
+ }
+ }
+ }
}
}
notifyListeners(previousPermissionItems, currentHMILevel, currentPermissionItems, currentHMILevel);
@@ -133,6 +151,24 @@ abstract class BasePermissionManager extends BaseSubManager{
super.start(listener);
}
+ /**
+ * Checks if an RPC requires encryption
+ *
+ * @param rpcName the rpc name (FunctionID) to check
+ * @return true if the given RPC requires encryption; false, otherwise
+ */
+ public boolean getRPCRequiresEncryption(@NonNull FunctionID rpcName) {
+ return encryptionRequiredRPCs.contains(rpcName.toString());
+ }
+
+ /**
+ * Gets the encryption requirement
+ * @return true if encryption is required; false otherwise
+ */
+ public boolean getRequiresEncryption() {
+ return !encryptionRequiredRPCs.isEmpty();
+ }
+
private synchronized void checkState(){
if(this.getState() == SETTING_UP && currentHMILevel != null){
transitionToState(READY);
@@ -229,7 +265,7 @@ abstract class BasePermissionManager extends BaseSubManager{
*/
private boolean isPermissionParameterAllowed(@NonNull FunctionID rpcName, @NonNull String parameter, Map<FunctionID, PermissionItem> permissionItems, HMILevel hmiLevel){
PermissionItem permissionItem = permissionItems.get(rpcName);
- if (!isRPCAllowed(rpcName, permissionItems, hmiLevel) || permissionItem.getParameterPermissions() == null || permissionItem.getParameterPermissions().getAllowed() == null){
+ if (permissionItem == null || !isRPCAllowed(rpcName, permissionItems, hmiLevel) || permissionItem.getParameterPermissions() == null || permissionItem.getParameterPermissions().getAllowed() == null){
return false;
} else if (permissionItem.getParameterPermissions().getUserDisallowed() != null){
return permissionItem.getParameterPermissions().getAllowed().contains(parameter) && !permissionItem.getParameterPermissions().getUserDisallowed().contains(parameter);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
index cc33bae86..82e4c4131 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseScreenManager.java
@@ -45,6 +45,7 @@ import com.smartdevicelink.managers.screen.choiceset.ChoiceSetManager;
import com.smartdevicelink.managers.screen.choiceset.KeyboardListener;
import com.smartdevicelink.managers.screen.menu.DynamicMenuUpdatesMode;
import com.smartdevicelink.managers.screen.menu.MenuCell;
+import com.smartdevicelink.managers.screen.menu.MenuConfiguration;
import com.smartdevicelink.managers.screen.menu.MenuManager;
import com.smartdevicelink.managers.screen.menu.VoiceCommand;
import com.smartdevicelink.managers.screen.menu.VoiceCommandManager;
@@ -343,6 +344,23 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
+ * Sets the title of the new template that will be displayed.
+ * Sending an empty String "" will clear the field
+ * @param title the title of the new template that will be displayed. Maxlength: 100.
+ */
+ public void setTitle(String title){
+ this.textAndGraphicManager.setTitle(title);
+ }
+
+ /**
+ * Gets the title of the new template that will be displayed
+ * @return title - String value that represents the title of the new template that will be displayed
+ */
+ public String getTitle(){
+ return this.textAndGraphicManager.getTitle();
+ }
+
+ /**
* Set softButtonObjects list and upload the images to the head unit
* @param softButtonObjects the list of the SoftButtonObject values that should be displayed on the head unit
*/
@@ -392,6 +410,8 @@ abstract class BaseScreenManager extends BaseSubManager {
this.voiceCommandManager.setVoiceCommands(voiceCommands);
}
+ // MENUS
+
/**
* The list of currently set menu cells
* @return a List of the currently set menu cells
@@ -418,13 +438,47 @@ abstract class BaseScreenManager extends BaseSubManager {
}
/**
- *
* @return The currently set DynamicMenuUpdatesMode. It defaults to ON_WITH_COMPAT_MODE if not set.
*/
public DynamicMenuUpdatesMode getDynamicMenuUpdatesMode(){
return this.menuManager.getDynamicMenuUpdatesMode();
}
+ /**
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens the Main Menu.
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openMenu(){
+ return this.menuManager.openMenu();
+ }
+
+ /**
+ * Requires SDL RPC Version 6.0.0 or greater
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ * @return boolean success / failure - whether the request was able to be sent
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+ return this.menuManager.openSubMenu(cell);
+ }
+
+ /**
+ * The main menu layout. See available menu layouts on WindowCapability.menuLayoutsAvailable.
+ * @param menuConfiguration - The default menuConfiguration
+ */
+ public void setMenuConfiguration(@NonNull MenuConfiguration menuConfiguration) {
+ this.menuManager.setMenuConfiguration(menuConfiguration);
+ }
+
+ /**
+ * The main menu layout. See available menu layouts on WindowCapability.menuLayoutsAvailable.
+ * @return the currently set MenuConfiguration
+ */
+ public MenuConfiguration getMenuConfiguration(){
+ return this.menuManager.getMenuConfiguration();
+ }
+
// CHOICE SETS
/**
@@ -468,9 +522,10 @@ abstract class BaseScreenManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardProperties - the custom keyboard configuration to be used when the keyboard is displayed
* @param keyboardListener - A keyboard listener to capture user input
+ * @return A unique cancelID that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
- this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardProperties, @NonNull KeyboardListener keyboardListener){
+ return this.choiceSetManager.presentKeyboard(initialText, customKeyboardProperties, keyboardListener);
}
/**
@@ -488,6 +543,14 @@ abstract class BaseScreenManager extends BaseSubManager {
return this.choiceSetManager.getPreloadedChoices();
}
+ /**
+ * Dismisses a currently presented keyboard with the associated ID. Canceling a keyboard only works when connected to SDL Core v.6.0+. When connected to older versions of SDL Core the keyboard will not be dismissed.
+ * @param cancelID The unique ID assigned to the keyboard
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ this.choiceSetManager.dismissKeyboard(cancelID);
+ }
+
// END CHOICE SETS
/**
@@ -527,5 +590,4 @@ abstract class BaseScreenManager extends BaseSubManager {
}
});
}
-
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
index 5a6c229e7..dd20f342a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSoftButtonManager.java
@@ -42,17 +42,19 @@ import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
-import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
@@ -62,6 +64,7 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -75,14 +78,13 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
private static final String TAG = "SoftButtonManager";
private WeakReference<FileManager> fileManager;
- private DisplayCapabilities displayCapabilities;
- private SoftButtonCapabilities softButtonCapabilities;
+ WindowCapability defaultMainWindowCapability;
private CopyOnWriteArrayList<SoftButtonObject> softButtonObjects;
private HMILevel currentHMILevel;
private Show inProgressShowRPC;
private CompletionListener inProgressListener, queuedUpdateListener, cachedListener;
private boolean hasQueuedUpdate, batchUpdates, waitingOnHMILevelUpdateToSetButtons;
- private final OnSystemCapabilityListener onSoftButtonCapabilitiesListener, onDisplayCapabilitiesListener;
+ private final OnSystemCapabilityListener onDisplayCapabilityListener;
private final OnRPCNotificationListener onHMIStatusListener, onButtonPressListener, onButtonEventListener;
private final SoftButtonObject.UpdateListener updateListener;
@@ -97,7 +99,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
* @param internalInterface an instance of the ISdl interface that can be used for common SDL operations (sendRpc, addRpcListener, etc)
* @param fileManager an instance of the FileManager so that button graphics can be sent
*/
- BaseSoftButtonManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
+ BaseSoftButtonManager(@NonNull final ISdl internalInterface, @NonNull FileManager fileManager) {
super(internalInterface);
this.fileManager = new WeakReference<>(fileManager);
this.softButtonObjects = new CopyOnWriteArrayList<>();
@@ -112,48 +114,40 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
// Add OnSoftButtonCapabilitiesListener to keep softButtonCapabilities updated
- onSoftButtonCapabilitiesListener = new OnSystemCapabilityListener() {
+ onDisplayCapabilityListener = new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
- List<SoftButtonCapabilities> softButtonCapabilitiesList = (List<SoftButtonCapabilities>) capability;
- if (softButtonCapabilitiesList != null && !softButtonCapabilitiesList.isEmpty()) {
- softButtonCapabilities = softButtonCapabilitiesList.get(0);
- } else {
- softButtonCapabilities = null;
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
+ }else {
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
}
}
@Override
public void onError(String info) {
- Log.w(TAG, "SoftButton Capability cannot be retrieved:");
- softButtonCapabilities = null;
+ DebugTool.logError("Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
}
};
- this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.SOFTBUTTON, onSoftButtonCapabilitiesListener);
-
-
- // Add OnDisplayCapabilitiesListener to keep displayCapabilities updated
- onDisplayCapabilitiesListener = new OnSystemCapabilityListener() {
- @Override
- public void onCapabilityRetrieved(Object capability) {
- displayCapabilities = (DisplayCapabilities) capability;
- }
-
- @Override
- public void onError(String info) {
- Log.w(TAG, "Display Capability cannot be retrieved:");
- displayCapabilities = null;
- }
- };
- this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, onDisplayCapabilitiesListener);
-
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
// Add OnHMIStatusListener to keep currentHMILevel updated
this.onHMIStatusListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
-
- OnHMIStatus onHMIStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHmiLevel = currentHMILevel;
currentHMILevel = onHMIStatus.getHmiLevel();
@@ -269,17 +263,26 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
}
+ // Check if two soft button objects have the same name
if (hasTwoSoftButtonObjectsOfSameName(softButtonObjects)) {
this.softButtonObjects = new CopyOnWriteArrayList<>();
Log.e(TAG, "Attempted to set soft button objects, but two buttons had the same name");
return;
}
- // Set ids and updateListeners for soft button objects
- for (int i = 0; i < softButtonObjects.size(); i++) {
- softButtonObjects.get(i).setButtonId(i * 100);
- softButtonObjects.get(i).setUpdateListener(updateListener);
+
+ // Set updateListeners for soft button objects
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ softButtonObject.setUpdateListener(updateListener);
}
+
+
+ if (!checkAndAssignButtonIds(softButtonObjects)) {
+ Log.e(TAG, "Attempted to set soft button objects, but multiple buttons had the same id");
+ return;
+ }
+
+
this.softButtonObjects = softButtonObjects;
@@ -368,6 +371,48 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
}
/**
+ * Check if there is a collision in the ids provided by the developer and assign ids to the SoftButtonObjects that do not have ids
+ * @param softButtonObjects the list of the SoftButtonObject values that should be displayed on the head unit
+ * @return boolean representing whether the ids are unique or not
+ */
+ boolean checkAndAssignButtonIds(List<SoftButtonObject> softButtonObjects) {
+ // Check if multiple soft button objects have the same id
+ HashSet<Integer> buttonIdsSetByDevHashSet = new HashSet<>();
+ int currentSoftButtonId, numberOfButtonIdsSetByDev = 0, maxButtonIdsSetByDev = SoftButtonObject.SOFT_BUTTON_ID_MIN_VALUE;
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ currentSoftButtonId = softButtonObject.getButtonId();
+ if (currentSoftButtonId != SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE) {
+ numberOfButtonIdsSetByDev++;
+ if (currentSoftButtonId > maxButtonIdsSetByDev){
+ maxButtonIdsSetByDev = currentSoftButtonId;
+ }
+ buttonIdsSetByDevHashSet.add(softButtonObject.getButtonId());
+ }
+ }
+ if (numberOfButtonIdsSetByDev != buttonIdsSetByDevHashSet.size()){
+ return false;
+ }
+
+
+ // Set ids for soft button objects
+ int generatedSoftButtonId = maxButtonIdsSetByDev;
+ for (SoftButtonObject softButtonObject : softButtonObjects) {
+ // If the dev did not set the buttonId, the manager should set an id on the dev's behalf
+ currentSoftButtonId = softButtonObject.getButtonId();
+ if (currentSoftButtonId == SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE){
+ do {
+ if (generatedSoftButtonId >= SoftButtonObject.SOFT_BUTTON_ID_MAX_VALUE){
+ generatedSoftButtonId = SoftButtonObject.SOFT_BUTTON_ID_MIN_VALUE;
+ }
+ generatedSoftButtonId++;
+ } while (buttonIdsSetByDevHashSet.contains(generatedSoftButtonId));
+ softButtonObject.setButtonId(generatedSoftButtonId);
+ }
+ }
+ return true;
+ }
+
+ /**
* Update the SoftButtonManger by sending a new Show RPC to reflect the changes
* @param listener a CompletionListener
*/
@@ -444,9 +489,8 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
public void onError(int correlationId, Result resultCode, String info) {
super.onError(correlationId, resultCode, info);
- Log.e(TAG, "Soft button update error");
+ Log.e(TAG, "Soft button update error. resultCode: " + resultCode + ". info: " + info);
handleResponse(false);
-
}
private void handleResponse(boolean success){
@@ -471,11 +515,13 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
});
- internalInterface.sendRPCRequest(inProgressShowRPC);
+ internalInterface.sendRPC(inProgressShowRPC);
}
- private boolean softButtonImagesSupported(){
- return (displayCapabilities == null || displayCapabilities.getGraphicSupported()) && (softButtonCapabilities == null || softButtonCapabilities.getImageSupported());
+ private boolean softButtonImagesSupported() {
+ return defaultMainWindowCapability == null
+ || defaultMainWindowCapability.getSoftButtonCapabilities() == null
+ || (!defaultMainWindowCapability.getSoftButtonCapabilities().isEmpty() && defaultMainWindowCapability.getSoftButtonCapabilities().get(0).getImageSupported());
}
/**
@@ -534,8 +580,7 @@ abstract class BaseSoftButtonManager extends BaseSubManager {
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, onHMIStatusListener);
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_PRESS, onButtonPressListener);
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_BUTTON_EVENT, onButtonEventListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.SOFTBUTTON, onSoftButtonCapabilitiesListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, onDisplayCapabilitiesListener);
+ internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
index 45f1dad0b..83190d078 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -42,21 +42,25 @@ import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.MetadataTags;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
+import com.smartdevicelink.util.CompareUtils;
import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
@@ -80,17 +84,17 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
volatile Show inProgressUpdate;
Show currentScreenData, queuedImageUpdate;
HMILevel currentHMILevel;
- protected DisplayCapabilities displayCapabilities;
+ WindowCapability defaultMainWindowCapability;
private boolean pendingHMIFull, batchingUpdates;
private final WeakReference<FileManager> fileManager;
private final WeakReference<SoftButtonManager> softButtonManager;
private CompletionListener queuedUpdateListener, inProgressListener, pendingHMIListener;
SdlArtwork blankArtwork;
private OnRPCNotificationListener hmiListener;
- private OnSystemCapabilityListener onDisplayCapabilitiesListener;
+ private OnSystemCapabilityListener onDisplaysCapabilityListener;
private SdlArtwork primaryGraphic, secondaryGraphic;
private TextAlignment textAlignment;
- private String textField1, textField2, textField3, textField4, mediaTrackTextField;
+ private String textField1, textField2, textField3, textField4, mediaTrackTextField, title;
private MetadataType textField1Type, textField2Type, textField3Type, textField4Type;
//Constructors
@@ -128,11 +132,12 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
textField4 = null;
textField4Type = null;
mediaTrackTextField = null;
+ title = null;
textAlignment = null;
primaryGraphic = null;
secondaryGraphic = null;
blankArtwork = null;
- displayCapabilities = null;
+ defaultMainWindowCapability = null;
inProgressUpdate = null;
queuedImageUpdate = null;
currentScreenData = null;
@@ -145,7 +150,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, onDisplayCapabilitiesListener);
+ internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
super.dispose();
}
@@ -155,7 +160,11 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- currentHMILevel = ((OnHMIStatus)notification).getHmiLevel();
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
+ currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_FULL){
if (pendingHMIFull){
DebugTool.logInfo( "Acquired HMI_FULL with pending update. Sending now");
@@ -168,20 +177,32 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
};
internalInterface.addOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- // Add OnDisplayCapabilitiesListener to keep displayCapabilities updated
- onDisplayCapabilitiesListener = new OnSystemCapabilityListener() {
+
+ onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
- displayCapabilities = (DisplayCapabilities)capability;
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError("TextAndGraphic Manager - Capabilities sent here are null or empty");
+ }else {
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
+ }
}
@Override
public void onError(String info) {
- Log.e(TAG, "DISPLAY Capability cannot be retrieved:");
- displayCapabilities = null;
+ DebugTool.logError("Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
}
};
- this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, onDisplayCapabilitiesListener);
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
}
// Upload / Send
@@ -316,7 +337,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
if (this.softButtonManager.get() != null) {
this.softButtonManager.get().setCurrentMainField1(inProgressUpdate.getMainField1());
}
- internalInterface.sendRPCRequest(inProgressUpdate);
+ internalInterface.sendRPC(inProgressUpdate);
}
// Images
@@ -379,6 +400,10 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
show.setMediaTrack(mediaTrackTextField);
}
+ if (title != null){
+ show.setTemplateTitle(title);
+ }
+
List<String> nonNullFields = findValidMainTextFields();
if (nonNullFields.isEmpty()){
return show;
@@ -602,6 +627,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
newShow.setMainField2(show.getMainField2());
newShow.setMainField3(show.getMainField3());
newShow.setMainField4(show.getMainField4());
+ newShow.setTemplateTitle(show.getTemplateTitle());
return newShow;
}
@@ -613,6 +639,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
newShow.setMainField3("");
newShow.setMainField4("");
newShow.setMediaTrack("");
+ newShow.setTemplateTitle("");
return newShow;
}
@@ -637,6 +664,9 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
if (show.getMainField4() != null){
currentScreenData.setMainField4(show.getMainField4());
}
+ if (show.getTemplateTitle() != null){
+ currentScreenData.setTemplateTitle(show.getTemplateTitle());
+ }
if (show.getMediaTrack() != null){
currentScreenData.setMediaTrack(show.getMediaTrack());
}
@@ -703,6 +733,7 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
abstract SdlArtwork getBlankArtwork();
+ @SuppressWarnings("BooleanMethodIsAlwaysInverted")
private boolean sdlArtworkNeedsUpload(SdlArtwork artwork){
if (fileManager.get() != null) {
return artwork != null && !fileManager.get().hasUploadedFile(artwork) && !artwork.isStaticIcon();
@@ -711,39 +742,41 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
}
private boolean shouldUpdatePrimaryImage() {
- if (displayCapabilities == null || displayCapabilities.getGraphicSupported()) {
+ if (defaultMainWindowCapability == null || defaultMainWindowCapability.getImageTypeSupported() == null || defaultMainWindowCapability.getImageTypeSupported().size() > 0) {
if (currentScreenData.getGraphic() == null && primaryGraphic != null) {
return true;
} else if (currentScreenData.getGraphic() == null && primaryGraphic == null) {
return false;
}
- return currentScreenData != null && (primaryGraphic != null && !currentScreenData.getGraphic().getValue().equalsIgnoreCase(primaryGraphic.getName()));
+ return currentScreenData != null
+ && (primaryGraphic != null && !CompareUtils.areStringsEqual(currentScreenData.getGraphic().getValue(), primaryGraphic.getName(), true, true) );
}
return false;
}
private boolean shouldUpdateSecondaryImage() {
// Cannot detect if there is a secondary image, so we'll just try to detect if there's a primary image and allow it if there is.
- if (displayCapabilities == null || displayCapabilities.getGraphicSupported()) {
+ if (defaultMainWindowCapability == null || defaultMainWindowCapability.getImageTypeSupported() == null || defaultMainWindowCapability.getImageTypeSupported().size() > 0) {
if (currentScreenData.getGraphic() == null && secondaryGraphic != null) {
return true;
} else if (currentScreenData.getGraphic() == null && secondaryGraphic == null) {
return false;
}
- return currentScreenData != null && (secondaryGraphic != null && !currentScreenData.getGraphic().getValue().equalsIgnoreCase(secondaryGraphic.getName()));
+ return currentScreenData != null
+ && (secondaryGraphic != null && !CompareUtils.areStringsEqual(currentScreenData.getGraphic().getValue(), secondaryGraphic.getName(),true,true));
}
return false;
}
int getNumberOfLines() {
- if (displayCapabilities == null){
+ if (defaultMainWindowCapability == null){
return 4;
}
int linesFound = 0;
- List<TextField> textFields = displayCapabilities.getTextFields();
+ List<TextField> textFields = defaultMainWindowCapability.getTextFields();
TextFieldName name;
for (TextField field : textFields) {
if (field.getName() != null) {
@@ -890,6 +923,19 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
return textField4Type;
}
+ void setTitle(String title){
+ this.title = title;
+ if (!batchingUpdates){
+ sdlUpdate(null);
+ }else{
+ isDirty = true;
+ }
+ }
+
+ String getTitle(){
+ return title;
+ }
+
void setPrimaryGraphic(SdlArtwork primaryGraphic){
this.primaryGraphic = primaryGraphic;
if (!batchingUpdates){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
index 74f842c3a..5bb92efc2 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonObject.java
@@ -52,6 +52,9 @@ import java.util.List;
public class SoftButtonObject {
private static final String TAG = "SoftButtonObject";
+ static int SOFT_BUTTON_ID_NOT_SET_VALUE = -1;
+ static int SOFT_BUTTON_ID_MIN_VALUE = 0;
+ static int SOFT_BUTTON_ID_MAX_VALUE = 65535;
private String name;
private List<SoftButtonState> states;
private String currentStateName;
@@ -62,7 +65,7 @@ public class SoftButtonObject {
/**
* Create a new instance of the SoftButtonObject with multiple states
* @param name a String value represents name of the object
- * @param states a list of SoftButtonState represents the SoftButtonState values for the object
+ * @param states a list of SoftButtonState represents the SoftButtonState values for the object. <strong>states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.</strong>
* @param initialStateName a String value represents the name for the initial state
* @param onEventListener a listener that has a callback that will be triggered when a button event happens
* Note: the initialStateName should match exactly the name of one of the states for the object. Otherwise an exception will be thrown.
@@ -78,7 +81,7 @@ public class SoftButtonObject {
this.name = name;
this.states = states;
currentStateName = initialStateName;
- this.buttonId = 0;
+ this.buttonId = SOFT_BUTTON_ID_NOT_SET_VALUE;
this.onEventListener = onEventListener;
}
@@ -232,7 +235,7 @@ public class SoftButtonObject {
/**
* Set the the SoftButtonState list
- * @param states a list of the object's soft button states
+ * @param states a list of the object's soft button states. <strong>states should be unique for every SoftButtonObject. A SoftButtonState instance cannot be reused for multiple SoftButtonObjects.</strong>
*/
public void setStates(@NonNull List<SoftButtonState> states) {
this.states = states;
@@ -264,10 +267,15 @@ public class SoftButtonObject {
/**
* Sets the id of the SoftButtonObject <br>
- * <strong>Note: This may be overridden by the Screen Manager</strong>
+ * <strong>Note: If the developer did not set buttonId, the manager will automatically assign an id before the SoftButtons are sent to the head unit.
+ * Please note that the manager may reuse ids from previous batch of SoftButtons that were already sent to the head unit</strong>
* @param buttonId an int value that represents the id of the SoftButtonObject
*/
public void setButtonId(int buttonId) {
+ if (buttonId < SOFT_BUTTON_ID_MIN_VALUE){
+ Log.e(TAG, "buttonId has to be equal or more than " + SOFT_BUTTON_ID_MIN_VALUE);
+ return;
+ }
this.buttonId = buttonId;
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
index 874d8e436..97842a8eb 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonState.java
@@ -37,6 +37,7 @@ import android.util.Log;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
+import com.smartdevicelink.proxy.rpc.enums.SystemAction;
/**
* <strong>SoftButtonState</strong> <br>
@@ -78,7 +79,7 @@ public class SoftButtonState {
} else {
type = SoftButtonType.SBT_TEXT;
}
- this.softButton = new SoftButton(type, 0);
+ this.softButton = new SoftButton(type, SoftButtonObject.SOFT_BUTTON_ID_NOT_SET_VALUE);
// Set the SoftButton's image
@@ -109,6 +110,40 @@ public class SoftButtonState {
}
/**
+ * Get whether or not the button should be highlighted on the UI
+ * @return boolean representing whether or not the button should be highlighted
+ */
+ public boolean getHighlighted(){
+ return this.getSoftButton().getIsHighlighted();
+ }
+
+ /**
+ * Set whether or not the button should be highlighted on the UI
+ * @param highlighted boolean representing whether or not the button should be highlighted
+ */
+ public void setHighlighted(boolean highlighted){
+ this.getSoftButton().setIsHighlighted(highlighted);
+ }
+
+ /**
+ * Get whether selecting a SoftButton shall call a specific system action
+ * See {@link SystemAction}
+ * @return SystemAction value representing whether selecting a SoftButton shall call a specific action
+ */
+ public SystemAction getSystemAction(){
+ return this.getSoftButton().getSystemAction();
+ }
+
+ /**
+ * Set whether selecting a SoftButton shall call a specific system action
+ * See {@link SystemAction}
+ * @param systemAction SystemAction value representing whether selecting a SoftButton shall call a specific action
+ */
+ public void setSystemAction(SystemAction systemAction){
+ this.getSoftButton().setSystemAction(systemAction);
+ }
+
+ /**
* Get the SoftButton for the state
* @return a SoftButton object represents the SoftButton for the state
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
new file mode 100644
index 000000000..c0a1dbb25
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/AsynchronousOperation.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/25/19 8:43 AM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+import com.smartdevicelink.util.DebugTool;
+
+class AsynchronousOperation implements Runnable {
+ private static final String TAG = "AsynchronousOperation - ";
+ private Thread thread;
+ private final Object lock;
+ private boolean blocked;
+ private boolean executing;
+ private boolean finished;
+ private boolean cancelled;
+
+ AsynchronousOperation() {
+ lock = new Object();
+ blocked = false;
+ executing = false;
+ finished = false;
+ cancelled = false;
+ }
+
+ @Override
+ public void run() {
+ thread = Thread.currentThread();
+ DebugTool.logInfo(TAG + "Starting: " + toString());
+ if (isCancelled()) {
+ finished = true;
+ DebugTool.logInfo(TAG + "Operation was cancelled: " + toString());
+ return;
+ }
+
+ executing = true;
+ }
+
+ void finishOperation() {
+ unblock();
+ executing = false;
+ finished = true;
+ cancelled = false;
+ DebugTool.logInfo(TAG + "Finishing: " + toString());
+ }
+
+ boolean isExecuting() {
+ return executing;
+ }
+
+ boolean isFinished() {
+ return finished;
+ }
+
+ void cancel(){
+ cancelled = true;
+ }
+
+ boolean isCancelled() {
+ return cancelled;
+ }
+
+ void block(){
+ if (!blocked && !finished) {
+ blocked = true;
+ DebugTool.logInfo(TAG + "Blocking: " + toString());
+ try {
+ synchronized (lock) {
+ lock.wait();
+ }
+ } catch (InterruptedException e) {
+ DebugTool.logWarning(TAG + "InterruptedException: " + toString());
+ finishOperation();
+ }
+ }
+ }
+
+ void unblock(){
+ if (blocked) {
+ blocked = false;
+ DebugTool.logInfo(TAG + "Unblocking: " + toString());
+ synchronized (lock) {
+ lock.notify();
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + " (OpId: " + System.identityHashCode(this) + ", OpThread:" + (thread != null ? thread.getName() : "no operating thread") + ", currentThread:" + Thread.currentThread().getName() + ", blocked:" + blocked + ", executing:" + executing + ", finished:" + finished + ", cancelled:" + cancelled + ")";
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
index 9770898bc..591f50a84 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/BaseChoiceSetManager.java
@@ -42,16 +42,19 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardLayout;
import com.smartdevicelink.proxy.rpc.enums.KeypressMode;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
@@ -59,7 +62,6 @@ import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Future;
@@ -79,22 +81,24 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
final WeakReference<FileManager> fileManager;
OnRPCNotificationListener hmiListener;
- OnSystemCapabilityListener displayListener;
+ OnSystemCapabilityListener onDisplayCapabilityListener;
HMILevel currentHMILevel;
- DisplayCapabilities displayCapabilities;
+ WindowCapability defaultMainWindowCapability;
SystemContext currentSystemContext;
HashSet<ChoiceCell> preloadedChoices, pendingPreloadChoices;
ChoiceSet pendingPresentationSet;
- private List<ChoiceCell> waitingChoices;
- private CompletionListener waitingListener;
// We will pass operations into this to be completed
PausableThreadPoolExecutor executor;
LinkedBlockingQueue<Runnable> operationQueue;
Future pendingPresentOperation;
+ PresentKeyboardOperation currentlyPresentedKeyboardOperation;
+
int nextChoiceId;
+ int nextCancelId;
final int choiceCellIdMin = 1;
+ final int choiceCellCancelIdMin = 1;
boolean isVROptional;
BaseChoiceSetManager(@NonNull ISdl internalInterface, @NonNull FileManager fileManager) {
@@ -110,11 +114,14 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
preloadedChoices = new HashSet<>();
pendingPreloadChoices = new HashSet<>();
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
isVROptional = false;
keyboardConfiguration = defaultKeyboardConfiguration();
operationQueue = new LinkedBlockingQueue<>();
executor = new PausableThreadPoolExecutor(1, Runtime.getRuntime().availableProcessors(), 10, TimeUnit.SECONDS, operationQueue);
executor.pause(); // pause until HMI ready
+
+ currentlyPresentedKeyboardOperation = null;
}
@Override
@@ -133,18 +140,17 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
currentHMILevel = null;
currentSystemContext = null;
- displayCapabilities = null;
+ defaultMainWindowCapability = null;
pendingPresentationSet = null;
pendingPresentOperation = null;
- waitingChoices = null;
- waitingListener = null;
- isVROptional = true;
+ isVROptional = false;
nextChoiceId = choiceCellIdMin;
+ nextCancelId = choiceCellCancelIdMin;
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, displayListener);
+ internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
super.dispose();
}
@@ -161,7 +167,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
@Override
public void onError(String error) {
- // At this point, there were errors trying to send a test CICS
+ // At this point, there were errors trying to send a test PICS
// If we reach this state, we cannot use the manager
DebugTool.logError(error);
transitionToState(ERROR);
@@ -181,10 +187,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void preloadChoices(@NonNull List<ChoiceCell> choices, @Nullable final CompletionListener listener){
- if (!isReady()){
- waitingChoices = new ArrayList<>(choices);
- waitingListener = listener;
- DebugTool.logInfo("Preload pending choice set manager being ready");
+ if (getState() == ERROR){
return;
}
@@ -205,7 +208,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
pendingPreloadChoices.addAll(choicesToUpload);
if (fileManager.get() != null) {
- PreloadChoicesOperation preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager.get(), displayCapabilities, isVROptional, choicesToUpload, new CompletionListener() {
+ PreloadChoicesOperation preloadChoicesOperation = new PreloadChoicesOperation(internalInterface, fileManager.get(), defaultMainWindowCapability, isVROptional, choicesToUpload, new CompletionListener() {
@Override
public void onComplete(boolean success) {
if (success){
@@ -214,15 +217,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (listener != null){
listener.onComplete(true);
}
- waitingChoices = null;
- waitingListener = null;
}else {
DebugTool.logError("There was an error pre loading choice cells");
- if (listener != null){
+ if (listener != null) {
listener.onComplete(false);
}
- waitingChoices = null;
- waitingListener = null;
}
}
});
@@ -239,7 +238,10 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void deleteChoices(@NonNull List<ChoiceCell> choices){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Find cells to be deleted that are already uploaded or are pending upload
final HashSet<ChoiceCell> cellsToBeDeleted = choicesToBeDeletedWithArray(choices);
@@ -251,7 +253,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
if (pendingPresentOperation != null && !pendingPresentOperation.isCancelled() && !pendingPresentOperation.isDone() && (cellsToBeDeleted.retainAll(pendingPresentationChoices) || cellsToBeRemovedFromPending.retainAll(pendingPresentationChoices))){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Attempting to delete choice cells while there is a pending presentation operation. Pending presentation cancelled.");
pendingPresentOperation = null;
}
@@ -291,13 +293,16 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
*/
public void presentChoiceSet(@NonNull final ChoiceSet choiceSet, @Nullable final InteractionMode mode, @Nullable final KeyboardListener keyboardListener){
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
// Perform additional checks against the ChoiceSet
if (!setUpChoiceSet(choiceSet)){ return; }
if (this.pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
DebugTool.logWarning("Presenting a choice set while one is currently presented. Cancelling previous and continuing");
}
@@ -321,6 +326,7 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
}
findIdsOnChoiceSet(pendingPresentationSet);
+
// Pass back the information to the developer
ChoiceSetSelectionListener privateChoiceListener = new ChoiceSetSelectionListener() {
@Override
@@ -328,8 +334,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onChoiceSelected(choiceCell, triggerSource,rowIndex);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
@Override
@@ -337,8 +341,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (pendingPresentationSet.getChoiceSetSelectionListener() != null){
pendingPresentationSet.getChoiceSetSelectionListener().onError(error);
}
- pendingPresentationSet = null;
- pendingPresentOperation = null;
}
};
@@ -347,11 +349,11 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (keyboardListener == null){
// Non-searchable choice set
DebugTool.logInfo("Creating non-searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, null, null, privateChoiceListener, nextCancelId++);
} else {
// Searchable choice set
DebugTool.logInfo("Creating searchable choice set");
- presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener);
+ presentOp = new PresentChoiceSetOperation(internalInterface, pendingPresentationSet, mode, keyboardConfiguration, keyboardListener, privateChoiceListener, nextCancelId++);
}
pendingPresentOperation = executor.submit(presentOp);
@@ -362,18 +364,21 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
* @param initialText - The initial text that is used as a placeholder text. It might not work on some head units.
* @param customKeyboardConfig - the custom keyboard configuration to be used when the keyboard is displayed
* @param listener - A keyboard listener to capture user input
+ * @return - A unique id that can be used to cancel this keyboard. If `null`, no keyboard was created.
*/
- public void presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
-
+ public Integer presentKeyboard(@NonNull String initialText, @Nullable KeyboardProperties customKeyboardConfig, @NonNull KeyboardListener listener){
if (initialText == null || initialText.length() == 0){
DebugTool.logError("initialText cannot be an empty string.");
- return;
+ return null;
}
- if (!isReady()){ return; }
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return null;
+ }
if (pendingPresentationSet != null && pendingPresentOperation != null){
- pendingPresentOperation.cancel(true);
+ pendingPresentOperation.cancel(false);
pendingPresentationSet = null;
DebugTool.logWarning("There is a current or pending choice set, cancelling and continuing.");
}
@@ -388,8 +393,42 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// Present a keyboard with the choice set that we used to test VR's optional state
DebugTool.logInfo("Presenting Keyboard - Choice Set Manager");
- PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener);
+ Integer keyboardCancelID = nextCancelId++;
+ PresentKeyboardOperation keyboardOp = new PresentKeyboardOperation(internalInterface, keyboardConfiguration, initialText, customKeyboardConfig, listener, keyboardCancelID);
+ currentlyPresentedKeyboardOperation = keyboardOp;
pendingPresentOperation = executor.submit(keyboardOp);
+ return keyboardCancelID;
+ }
+
+ /**
+ * Cancels the keyboard-only interface if it is currently showing. If the keyboard has not yet been sent to Core, it will not be sent.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ *
+ * @param cancelID - The unique ID assigned to the keyboard, passed as the return value from `presentKeyboard`
+ */
+ public void dismissKeyboard(@NonNull Integer cancelID) {
+ if (getState() == ERROR) {
+ DebugTool.logWarning("Choice Manager In Error State");
+ return;
+ }
+
+ // First, attempt to cancel the currently executing keyboard operation (Once an operation has started it is removed from the operationQueue)
+ if (currentlyPresentedKeyboardOperation != null && currentlyPresentedKeyboardOperation.getCancelID().equals(cancelID)) {
+ currentlyPresentedKeyboardOperation.dismissKeyboard();
+ return;
+ }
+
+ // Next, attempt to cancel keyboard operations that have not yet started
+ for (Runnable operation : operationQueue){
+ if (!(operation instanceof PresentKeyboardOperation)){ continue; }
+
+ PresentKeyboardOperation pendingOp = (PresentKeyboardOperation) operation;
+ if (!(pendingOp.getCancelID().equals(cancelID))) { continue; }
+
+ pendingOp.dismissKeyboard();
+ break;
+ }
}
/**
@@ -471,27 +510,43 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
// LISTENERS
private void addListeners(){
- // DISPLAY CAPABILITIES - via SCM
- displayListener = new OnSystemCapabilityListener() {
+ // DISPLAY/WINDOW CAPABILITIES - via SCM
+ onDisplayCapabilityListener = new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
- displayCapabilities = (DisplayCapabilities) capability;
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
+ }else {
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
+ }
}
@Override
public void onError(String info) {
DebugTool.logError("Unable to retrieve display capabilities. Many things will probably break. Info: "+ info);
+ defaultMainWindowCapability = null;
}
};
- internalInterface.getCapability(SystemCapabilityType.DISPLAY, displayListener);
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplayCapabilityListener);
// HMI UPDATES
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus hmiStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = hmiStatus.getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
if (currentHMILevel == HMILevel.HMI_NONE){
executor.pause();
@@ -499,13 +554,9 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
- currentSystemContext = hmiStatus.getSystemContext();
+ currentSystemContext = onHMIStatus.getSystemContext();
if (currentSystemContext == SystemContext.SYSCTXT_HMI_OBSCURED || currentSystemContext == SystemContext.SYSCTXT_ALERT){
executor.pause();
@@ -513,10 +564,6 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
if (currentSystemContext == SystemContext.SYSCTXT_MAIN && currentHMILevel != HMILevel.HMI_NONE){
executor.resume();
- if (waitingChoices != null && waitingChoices.size() > 0){
- DebugTool.logInfo("Pending Preload Choices now being sent");
- preloadChoices(waitingChoices, waitingListener);
- }
}
}
@@ -586,13 +633,4 @@ abstract class BaseChoiceSetManager extends BaseSubManager {
defaultProperties.setKeypressMode(KeypressMode.RESEND_CURRENT_ENTRY);
return defaultProperties;
}
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- private boolean isReady(){
- if (getState() != READY){
- DebugTool.logWarning("Choice Manager In Not-Ready State");
- return false;
- }
- return true;
- }
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
index 4ac5cb659..1c427c16b 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
@@ -47,21 +47,24 @@ import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
import java.util.Collections;
-class CheckChoiceVROptionalOperation implements Runnable {
+class CheckChoiceVROptionalOperation extends AsynchronousOperation {
private CheckChoiceVROptionalInterface checkChoiceVROptionalInterface;
private WeakReference<ISdl> internalInterface;
private boolean isVROptional;
CheckChoiceVROptionalOperation(ISdl internalInterface, CheckChoiceVROptionalInterface checkChoiceVROptionalInterface){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.checkChoiceVROptionalInterface = checkChoiceVROptionalInterface;
}
@Override
public void run() {
+ CheckChoiceVROptionalOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing check vr optional operation");
sendTestChoiceNoVR();
+ block();
}
/**
@@ -117,6 +120,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(response.getInfo());
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
}
@@ -127,6 +132,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
@@ -147,6 +154,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
@Override
@@ -155,6 +164,8 @@ class CheckChoiceVROptionalOperation implements Runnable {
if (checkChoiceVROptionalInterface != null){
checkChoiceVROptionalInterface.onError(info);
}
+
+ CheckChoiceVROptionalOperation.super.finishOperation();
}
});
if (internalInterface.get() != null){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
index 7a1c0b138..34bdbd6a4 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSet.java
@@ -34,6 +34,7 @@ package com.smartdevicelink.managers.screen.choiceset;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+
import com.smartdevicelink.proxy.TTSChunkFactory;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.TTSChunk;
@@ -53,6 +54,7 @@ public class ChoiceSet {
private List<VrHelpItem> vrHelpList;
private ChoiceSetSelectionListener choiceSetSelectionListener;
private KeyboardProperties customKeyboardConfiguration;
+ ChoiceSetCanceledListener canceledListener;
// defaults
private Integer defaultTimeout = 10;
@@ -153,6 +155,16 @@ public class ChoiceSet {
}
/**
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be immediately dismissed. Canceling an already presented choice set will only work if connected to Core versions 6.0+. On older versions of Core, the choice set will not be dismissed.
+ */
+ public void cancel() {
+ if (canceledListener == null) {
+ return;
+ }
+ canceledListener.onChoiceSetCanceled();
+ }
+
+ /**
* Maps to PerformInteraction.initialText. The title of the choice set, and/or the initial text on a keyboard prompt.
* @return the title
*/
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
new file mode 100644
index 000000000..89e850b1e
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetCanceledListener.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/24/19 2:08 PM
+ */
+
+package com.smartdevicelink.managers.screen.choiceset;
+
+interface ChoiceSetCanceledListener {
+ /**
+ * Notifies the subscriber that the choice set should be cancelled.
+ */
+ void onChoiceSetCanceled();
+}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
index fdb01ae38..2fc6c314d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
@@ -48,13 +48,14 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-class DeleteChoicesOperation implements Runnable {
+class DeleteChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private HashSet<ChoiceCell> cellsToDelete;
private CompletionListener completionListener;
DeleteChoicesOperation(ISdl internalInterface, HashSet<ChoiceCell> cellsToDelete, CompletionListener completionListener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.cellsToDelete = cellsToDelete;
this.completionListener = completionListener;
@@ -62,8 +63,10 @@ class DeleteChoicesOperation implements Runnable {
@Override
public void run() {
+ DeleteChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing delete choices operation");
sendDeletions();
+ block();
}
private void sendDeletions(){
@@ -84,6 +87,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(true);
}
DebugTool.logInfo("Successfully deleted choices");
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
@@ -92,6 +97,8 @@ class DeleteChoicesOperation implements Runnable {
completionListener.onComplete(false);
}
DebugTool.logError("Failed to delete choice: " + info + " | Corr ID: " + correlationId);
+
+ DeleteChoicesOperation.super.finishOperation();
}
@Override
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
index a921766db..13b19238d 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/KeyboardAutocompleteCompletionListener.java
@@ -32,11 +32,21 @@
package com.smartdevicelink.managers.screen.choiceset;
+import java.util.List;
+
public interface KeyboardAutocompleteCompletionListener {
/**
* This listener is called when you wish to update your autocomplete text in response to the user's input
* @param updatedAutoCompleteText - The new autocomplete text to use
+ * @deprecated use {@link #onUpdatedAutoCompleteList(List<String>)} instead
*/
+ @Deprecated
void onUpdatedAutoCompleteText(String updatedAutoCompleteText);
+
+ /**
+ * This listener is called when you wish to update your autocomplete suggestions list in response to the user's input
+ * @param updatedAutoCompleteList - The new autocomplete suggestions list to use
+ */
+ void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList);
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
index f3d708998..70d84b4c7 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
@@ -49,6 +49,7 @@ import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.TextField;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
@@ -62,21 +63,22 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
-class PreloadChoicesOperation implements Runnable {
+class PreloadChoicesOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private WeakReference<FileManager> fileManager;
- private DisplayCapabilities displayCapabilities;
+ private WindowCapability defaultMainWindowCapability;
private HashSet<ChoiceCell> cellsToUpload;
private CompletionListener completionListener;
private boolean isRunning;
private boolean isVROptional;
- PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, DisplayCapabilities displayCapabilities,
+ PreloadChoicesOperation(ISdl internalInterface, FileManager fileManager, WindowCapability defaultMainWindowCapability,
Boolean isVROptional, HashSet<ChoiceCell> cellsToPreload, CompletionListener listener){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.fileManager = new WeakReference<>(fileManager);
- this.displayCapabilities = displayCapabilities;
+ this.defaultMainWindowCapability = defaultMainWindowCapability;
this.isVROptional = isVROptional;
this.cellsToUpload = cellsToPreload;
this.completionListener = listener;
@@ -84,6 +86,7 @@ class PreloadChoicesOperation implements Runnable {
@Override
public void run() {
+ PreloadChoicesOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing preload choices operation");
preloadCellArtworks(new CompletionListener() {
@Override
@@ -91,6 +94,7 @@ class PreloadChoicesOperation implements Runnable {
preloadCells();
}
});
+ block();
}
void removeChoicesFromUpload(HashSet<ChoiceCell> choices){
@@ -161,11 +165,15 @@ class PreloadChoicesOperation implements Runnable {
isRunning = false;
DebugTool.logInfo("Finished pre loading choice cells");
completionListener.onComplete(true);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
public void onError(int correlationId, Result resultCode, String info) {
DebugTool.logError("There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
+
+ PreloadChoicesOperation.super.finishOperation();
}
@Override
@@ -208,10 +216,10 @@ class PreloadChoicesOperation implements Runnable {
choice.setIgnoreAddingVRItems(true);
if (fileManager.get() != null){
- if (image != null && fileManager.get().hasUploadedFile(cell.getArtwork())) {
+ if (image != null && (cell.getArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getArtwork()))) {
choice.setImage(image);
}
- if (secondaryImage != null && fileManager.get().hasUploadedFile(cell.getSecondaryArtwork())) {
+ if (secondaryImage != null && (cell.getSecondaryArtwork().isStaticIcon() || fileManager.get().hasUploadedFile(cell.getSecondaryArtwork()))) {
choice.setSecondaryImage(secondaryImage);
}
}
@@ -242,10 +250,10 @@ class PreloadChoicesOperation implements Runnable {
}
boolean hasImageFieldOfName(ImageFieldName name){
- if (displayCapabilities == null ){ return false; }
- if (displayCapabilities.getGraphicSupported() == null || !displayCapabilities.getGraphicSupported()) { return false; }
- if (displayCapabilities.getImageFields() != null){
- for (ImageField field : displayCapabilities.getImageFields()){
+ if (defaultMainWindowCapability == null ){ return false; }
+ if (defaultMainWindowCapability.getImageTypeSupported() == null || defaultMainWindowCapability.getImageTypeSupported().isEmpty()) { return false; }
+ if (defaultMainWindowCapability.getImageFields() != null){
+ for (ImageField field : defaultMainWindowCapability.getImageFields()){
if (field.getName().equals(name)){
return true;
}
@@ -255,15 +263,14 @@ class PreloadChoicesOperation implements Runnable {
}
boolean hasTextFieldOfName(TextFieldName name){
- if (displayCapabilities == null ){ return false; }
- if (displayCapabilities.getTextFields() != null){
- for (TextField field : displayCapabilities.getTextFields()){
- if (field.getName().equals(name)){
+ if (defaultMainWindowCapability == null ){ return false; }
+ if (defaultMainWindowCapability.getTextFields() != null){
+ for (TextField field : defaultMainWindowCapability.getTextFields()){
+ if (field != null && field.getName() != null && field.getName().equals(name)){
return true;
}
}
}
return false;
}
-
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
index 3ff4cb4ec..af69c0926 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
@@ -40,14 +40,17 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.TriggerSource;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
@@ -57,10 +60,11 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-class PresentChoiceSetOperation implements Runnable {
+class PresentChoiceSetOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private ChoiceSet choiceSet;
+ private Integer cancelID;
private InteractionMode presentationMode;
private KeyboardProperties originalKeyboardProperties, keyboardProperties;
private ChoiceCell selectedCell;
@@ -70,27 +74,44 @@ class PresentChoiceSetOperation implements Runnable {
private ChoiceSetSelectionListener choiceSetSelectionListener;
Integer selectedCellRow;
KeyboardListener keyboardListener;
+ SdlMsgVersion sdlMsgVersion;
PresentChoiceSetOperation(ISdl internalInterface, ChoiceSet choiceSet, InteractionMode mode,
- KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener){
+ KeyboardProperties originalKeyboardProperties, KeyboardListener keyboardListener, ChoiceSetSelectionListener choiceSetSelectionListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.choiceSet = choiceSet;
+ this.choiceSet.canceledListener = new ChoiceSetCanceledListener() {
+ @Override
+ public void onChoiceSetCanceled() {
+ cancelInteraction();
+ }
+ };
this.presentationMode = mode;
+ this.cancelID = cancelID;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.selectedCellRow = null;
this.choiceSetSelectionListener = choiceSetSelectionListener;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentChoiceSetOperation.super.run();
DebugTool.logInfo("Choice Operation: Executing present choice set operation");
addListeners();
start();
+ block();
}
private void start(){
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
// Check if we're using a keyboard (searchable) choice set and setup keyboard properties if we need to
if (keyboardListener != null && choiceSet.getCustomKeyboardConfiguration() != null){
keyboardProperties = choiceSet.getCustomKeyboardConfiguration();
@@ -100,6 +121,10 @@ class PresentChoiceSetOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
presentChoiceSet();
}
});
@@ -135,6 +160,14 @@ class PresentChoiceSetOperation implements Runnable {
}
DebugTool.logInfo("Success Setting keyboard properties in present choice set operation");
}
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
+ DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
+ }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(setGlobalProperties);
@@ -167,6 +200,16 @@ class PresentChoiceSetOperation implements Runnable {
finishOperation();
}
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Presenting Choice set failed: " + resultCode + ", " + info);
+
+ if (choiceSetSelectionListener != null){
+ choiceSetSelectionListener.onError(resultCode + ", " + info);
+ }
+ finishOperation();
+ }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(pi);
@@ -175,8 +218,7 @@ class PresentChoiceSetOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -186,6 +228,13 @@ class PresentChoiceSetOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentChoiceSetOperation.super.finishOperation();
}
});
@@ -195,13 +244,56 @@ class PresentChoiceSetOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentChoiceSetOperation.super.finishOperation();
+ }
+ }
+
+ /*
+ * Cancels the choice set. If the choice set has not yet been sent to Core, it will not be sent. If the choice set is already presented on Core, the choice set will be dismissed using the `CancelInteraction` RPC.
+ */
+ private void cancelInteraction() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a presented choice set is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented choice set interaction.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented choice set " + resultCode + " " + info);
+ };
+ });
+
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for choice set");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a choice set that has not yet been sent to Core");
+ this.cancel();
}
}
// GETTERS
PerformInteraction getPerformInteraction() {
-
PerformInteraction pi = new PerformInteraction(choiceSet.getTitle(), presentationMode, getChoiceIds());
pi.setInitialPrompt(choiceSet.getInitialPrompt());
pi.setHelpPrompt(choiceSet.getHelpPrompt());
@@ -209,6 +301,7 @@ class PresentChoiceSetOperation implements Runnable {
pi.setVrHelp(choiceSet.getVrHelpList());
pi.setTimeout(choiceSet.getTimeout() * 1000);
pi.setInteractionLayout(getLayoutMode());
+ pi.setCancelID(cancelID);
return pi;
}
@@ -253,6 +346,10 @@ class PresentChoiceSetOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
@@ -273,6 +370,13 @@ class PresentChoiceSetOperation implements Runnable {
keyboardProperties.setAutoCompleteText(updatedAutoCompleteText);
updateKeyboardProperties(null);
}
+
+ @Override
+ public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
+ keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
+ keyboardProperties.setAutoCompleteText(updatedAutoCompleteList != null && !updatedAutoCompleteList.isEmpty() ? updatedAutoCompleteList.get(0) : null);
+ updateKeyboardProperties(null);
+ }
});
keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
index 3aeaca65a..5089d0c92 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
@@ -40,9 +40,11 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.rpc.CancelInteraction;
import com.smartdevicelink.proxy.rpc.KeyboardProperties;
import com.smartdevicelink.proxy.rpc.OnKeyboardInput;
import com.smartdevicelink.proxy.rpc.PerformInteraction;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.KeyboardEvent;
@@ -53,10 +55,11 @@ import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
import java.lang.ref.WeakReference;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-class PresentKeyboardOperation implements Runnable {
+class PresentKeyboardOperation extends AsynchronousOperation {
private WeakReference<ISdl> internalInterface;
private KeyboardListener keyboardListener;
@@ -64,24 +67,38 @@ class PresentKeyboardOperation implements Runnable {
private boolean updatedKeyboardProperties;
private String initialText;
private OnRPCNotificationListener keyboardRPCListener;
+ private Integer cancelID;
+ SdlMsgVersion sdlMsgVersion;
- PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener){
+ PresentKeyboardOperation(ISdl internalInterface, KeyboardProperties originalKeyboardProperties, String initialText, KeyboardProperties customConfig, KeyboardListener keyboardListener, Integer cancelID){
+ super();
this.internalInterface = new WeakReference<>(internalInterface);
this.keyboardListener = keyboardListener;
this.originalKeyboardProperties = originalKeyboardProperties;
this.keyboardProperties = originalKeyboardProperties;
this.customConfig = customConfig;
this.initialText = initialText;
+ this.cancelID = cancelID;
+ this.sdlMsgVersion = internalInterface.getSdlMsgVersion();
}
@Override
public void run() {
+ PresentKeyboardOperation.super.run();
+ DebugTool.logInfo("Keyboard Operation: Executing present keyboard operation");
addListeners();
start();
+ block();
}
private void start(){
DebugTool.logInfo("Choice Operation: Executing present keyboard operation");
+
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
if (keyboardListener != null){
keyboardProperties = customConfig;
updatedKeyboardProperties = true;
@@ -90,6 +107,11 @@ class PresentKeyboardOperation implements Runnable {
updateKeyboardProperties(new CompletionListener() {
@Override
public void onComplete(boolean success) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
+
presentKeyboard();
}
});
@@ -98,9 +120,7 @@ class PresentKeyboardOperation implements Runnable {
// SENDING REQUESTS
private void presentKeyboard(){
-
if (internalInterface.get() != null){
-
PerformInteraction pi = getPerformInteraction();
pi.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
@@ -120,11 +140,52 @@ class PresentKeyboardOperation implements Runnable {
}else{
DebugTool.logError("Internal Interface null in present keyboard operation - choice");
}
+ }
+
+ /**
+ * Cancels the keyboard-only interface if it is currently showing. If the keyboard has not yet been sent to Core, it will not be sent.
+ *
+ * This will only dismiss an already presented keyboard if connected to head units running SDL 6.0+.
+ */
+ void dismissKeyboard() {
+ if (isFinished()) {
+ DebugTool.logInfo("This operation has already finished so it can not be canceled.");
+ return;
+ } else if (isCancelled()) {
+ DebugTool.logInfo("This operation has already been canceled. It will be finished at some point during the operation.");
+ return;
+ } else if (isExecuting()) {
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Canceling a keyboard is not supported on this head unit");
+ return;
+ }
+
+ DebugTool.logInfo("Canceling the presented keyboard.");
+
+ CancelInteraction cancelInteraction = new CancelInteraction(FunctionID.PERFORM_INTERACTION.getId(), cancelID);
+ cancelInteraction.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ DebugTool.logInfo("Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
+ }
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Error canceling the presented keyboard " + resultCode + " " + info);
+ }
+ });
+ if (internalInterface.get() != null){
+ internalInterface.get().sendRPC(cancelInteraction);
+ } else {
+ DebugTool.logError("Internal interface null - could not send cancel interaction for keyboard.");
+ }
+ } else {
+ DebugTool.logInfo("Canceling a keyboard that has not yet been sent to Core.");
+ this.cancel();
+ }
}
private void updateKeyboardProperties(final CompletionListener listener){
-
if (keyboardProperties == null){
if (listener != null){
listener.onComplete(false);
@@ -153,6 +214,15 @@ class PresentKeyboardOperation implements Runnable {
}
DebugTool.logInfo("Success Setting keyboard properties in present keyboard operation - choice manager");
}
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ if (listener != null){
+ listener.onComplete(false);
+ }
+ DebugTool.logError("Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
+ super.onError(correlationId, resultCode, info);
+ }
});
if (internalInterface.get() != null){
@@ -162,8 +232,7 @@ class PresentKeyboardOperation implements Runnable {
}
}
- private void finishOperation() {
-
+ void finishOperation() {
if (updatedKeyboardProperties) {
// We need to reset the keyboard properties
SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
@@ -173,6 +242,13 @@ class PresentKeyboardOperation implements Runnable {
public void onResponse(int correlationId, RPCResponse response) {
updatedKeyboardProperties = false;
DebugTool.logInfo("Successfully reset choice keyboard properties to original config");
+ PresentKeyboardOperation.super.finishOperation();
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ PresentKeyboardOperation.super.finishOperation();
}
});
@@ -182,6 +258,8 @@ class PresentKeyboardOperation implements Runnable {
} else {
DebugTool.logError("Internal Interface null when finishing choice keyboard reset");
}
+ } else {
+ PresentKeyboardOperation.super.finishOperation();
}
}
@@ -193,9 +271,14 @@ class PresentKeyboardOperation implements Runnable {
pi.setInteractionMode(InteractionMode.MANUAL_ONLY);
pi.setInteractionChoiceSetIDList(Collections.<Integer>emptyList());
pi.setInteractionLayout(LayoutMode.KEYBOARD);
+ pi.setCancelID(cancelID);
return pi;
}
+ public Integer getCancelID() {
+ return cancelID;
+ }
+
// LISTENERS
private void addListeners(){
@@ -203,6 +286,10 @@ class PresentKeyboardOperation implements Runnable {
keyboardRPCListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ if (isCancelled()) {
+ finishOperation();
+ return;
+ }
if (keyboardListener == null){
DebugTool.logError("Received Keyboard Input But Listener is null");
@@ -223,6 +310,13 @@ class PresentKeyboardOperation implements Runnable {
keyboardProperties.setAutoCompleteText(updatedAutoCompleteText);
updateKeyboardProperties(null);
}
+
+ @Override
+ public void onUpdatedAutoCompleteList(List<String> updatedAutoCompleteList) {
+ keyboardProperties.setAutoCompleteList(updatedAutoCompleteList != null ? updatedAutoCompleteList : new ArrayList<String>());
+ keyboardProperties.setAutoCompleteText(updatedAutoCompleteList != null && !updatedAutoCompleteList.isEmpty() ? updatedAutoCompleteList.get(0) : null);
+ updateKeyboardProperties(null);
+ }
});
keyboardListener.updateCharacterSetWithInput(onKeyboard.getData(), new KeyboardCharacterSetCompletionListener() {
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index 140e4cacc..21a4eec06 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -43,25 +43,32 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.AddCommand;
import com.smartdevicelink.proxy.rpc.AddSubMenu;
import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
-import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.ImageField;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
+import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
import org.json.JSONException;
@@ -83,15 +90,17 @@ abstract class BaseMenuManager extends BaseSubManager {
List<MenuCell> menuCells, waitingUpdateMenuCells, oldMenuCells, keepsNew, keepsOld;
List<RPCRequest> inProgressUpdate;
DynamicMenuUpdatesMode dynamicMenuUpdatesMode;
- private DisplayType displayType;
+ MenuConfiguration menuConfiguration;
+ SdlMsgVersion sdlMsgVersion;
+ private String displayType;
boolean waitingOnHMIUpdate;
private boolean hasQueuedUpdate;
HMILevel currentHMILevel;
OnRPCNotificationListener hmiListener, commandListener;
- OnSystemCapabilityListener displayListener;
- DisplayCapabilities displayCapabilities;
+ OnSystemCapabilityListener onDisplaysCapabilityListener;
+ WindowCapability defaultMainWindowCapability;
private static final int MAX_ID = 2000000000;
private static final int parentIdNotFound = MAX_ID;
@@ -110,6 +119,7 @@ abstract class BaseMenuManager extends BaseSubManager {
currentHMILevel = HMILevel.HMI_NONE;
lastMenuId = menuCellIdMin;
dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
+ sdlMsgVersion = internalInterface.getSdlMsgVersion();
addListeners();
}
@@ -129,18 +139,20 @@ abstract class BaseMenuManager extends BaseSubManager {
currentHMILevel = null;
currentSystemContext = SystemContext.SYSCTXT_MAIN;
dynamicMenuUpdatesMode = DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE;
- displayCapabilities = null;
+ defaultMainWindowCapability = null;
inProgressUpdate = null;
hasQueuedUpdate = false;
waitingOnHMIUpdate = false;
waitingUpdateMenuCells = null;
keepsNew = null;
keepsOld = null;
+ menuConfiguration = null;
+ sdlMsgVersion = null;
// remove listeners
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_HMI_STATUS, hmiListener);
internalInterface.removeOnRPCNotificationListener(FunctionID.ON_COMMAND, commandListener);
- internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAY, displayListener);
+ internalInterface.removeOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
super.dispose();
}
@@ -245,6 +257,141 @@ abstract class BaseMenuManager extends BaseSubManager {
return this.dynamicMenuUpdatesMode;
}
+ // OPEN MENU RPCs
+
+ /**
+ * Opens the Main Menu
+ */
+ public boolean openMenu(){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Main Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Main Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+ internalInterface.sendRPC(showAppMenu);
+ return true;
+ }
+
+ /**
+ * Opens a subMenu. The cell you pass in must be constructed with {@link MenuCell(String,SdlArtwork,List)}
+ * @param cell - A <Strong>SubMenu</Strong> cell whose sub menu you wish to open
+ */
+ public boolean openSubMenu(@NonNull MenuCell cell){
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Sub menu opening is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return false;
+ }
+
+ if (oldMenuCells == null){
+ DebugTool.logError("open sub menu called, but no Menu cells have been set");
+ return false;
+ }
+ // We must see if we have a copy of this cell, since we clone the objects
+ for (MenuCell clonedCell : oldMenuCells){
+ if (clonedCell.equals(cell) && clonedCell.getCellId() != MAX_ID){
+ // We've found the correct sub menu cell
+ sendOpenSubMenu(clonedCell.getCellId());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void sendOpenSubMenu(Integer id){
+
+ ShowAppMenu showAppMenu = new ShowAppMenu();
+ showAppMenu.setMenuID(id);
+ showAppMenu.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()){
+ DebugTool.logInfo("Open Sub Menu Request Successful");
+ } else {
+ DebugTool.logError("Open Sub Menu Request Failed");
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info){
+ DebugTool.logError("Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
+ }
+ });
+
+ internalInterface.sendRPC(showAppMenu);
+ }
+
+ // MENU CONFIG
+
+ /**
+ * This method is called via the screen manager to set the menuConfiguration.
+ * This will be used when a menu item with sub-cells has a null value for menuConfiguration
+ * @param menuConfiguration - The default menuConfiguration
+ */
+ public void setMenuConfiguration(@NonNull final MenuConfiguration menuConfiguration) {
+
+ if (sdlMsgVersion == null) {
+ DebugTool.logError("SDL Message Version is null. Cannot set Menu Configuration");
+ return;
+ }
+
+ if (sdlMsgVersion.getMajorVersion() < 6){
+ DebugTool.logWarning("Menu configurations is only supported on head units with RPC spec version 6.0.0 or later. Currently connected head unit RPC spec version is: "+sdlMsgVersion.getMajorVersion() + "." + sdlMsgVersion.getMinorVersion()+ "." +sdlMsgVersion.getPatchVersion());
+ return;
+ }
+
+ if (currentHMILevel == null || currentHMILevel.equals(HMILevel.HMI_NONE) || currentSystemContext.equals(SystemContext.SYSCTXT_MENU)){
+ // We are in NONE or the menu is in use, bail out of here
+ DebugTool.logError("Could not set main menu configuration, HMI level: "+currentHMILevel+", required: 'Not-NONE', system context: "+currentSystemContext+", required: 'Not MENU'");
+ return;
+ }
+
+ // In the future, when the manager is switched to use queues, the menuConfiguration should be set when SetGlobalProperties response is received
+ this.menuConfiguration = menuConfiguration;
+
+ if (menuConfiguration.getMenuLayout() != null) {
+
+ SetGlobalProperties setGlobalProperties = new SetGlobalProperties();
+ setGlobalProperties.setMenuLayout(menuConfiguration.getMenuLayout());
+ setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ DebugTool.logInfo("Menu Configuration successfully set: " + menuConfiguration.toString());
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ DebugTool.logError("onError: " + resultCode + " | Info: " + info);
+ }
+ });
+ internalInterface.sendRPC(setGlobalProperties);
+ } else {
+ DebugTool.logInfo("Menu Layout is null, not sending setGlobalProperties");
+ }
+ }
+
+ public MenuConfiguration getMenuConfiguration(){
+ return this.menuConfiguration;
+ }
// UPDATING SYSTEM
// ROOT MENU
@@ -304,13 +451,13 @@ abstract class BaseMenuManager extends BaseSubManager {
}
}
- private boolean checkUpdateMode(DynamicMenuUpdatesMode updateMode, DisplayType displayType){
+ private boolean checkUpdateMode(DynamicMenuUpdatesMode updateMode, String displayType){
if (updateMode.equals(DynamicMenuUpdatesMode.ON_WITH_COMPAT_MODE)){
if (displayType == null){
return true;
}
- return (!displayType.equals(DisplayType.GEN3_8_INCH));
+ return (!displayType.equals(DisplayType.GEN3_8_INCH.toString()));
} else if (updateMode.equals(DynamicMenuUpdatesMode.FORCE_OFF)){
return false;
@@ -627,8 +774,8 @@ abstract class BaseMenuManager extends BaseSubManager {
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
private boolean supportsImages(){
- if (displayCapabilities != null && displayCapabilities.getImageFields() != null) {
- List<ImageField> imageFields = displayCapabilities.getImageFields();
+ if (defaultMainWindowCapability != null && defaultMainWindowCapability.getImageFields() != null) {
+ List<ImageField> imageFields = defaultMainWindowCapability.getImageFields();
for (ImageField field : imageFields) {
if (field.getName().equals(ImageFieldName.cmdIcon)) {
return true;
@@ -826,6 +973,11 @@ abstract class BaseMenuManager extends BaseSubManager {
private AddSubMenu subMenuCommandForMenuCell(MenuCell cell, boolean shouldHaveArtwork, int position){
AddSubMenu subMenu = new AddSubMenu(cell.getCellId(), cell.getTitle());
subMenu.setPosition(position);
+ if (cell.getSubMenuLayout() != null ) {
+ subMenu.setMenuLayout(cell.getSubMenuLayout());
+ } else if (menuConfiguration != null && menuConfiguration.getSubMenuLayout() != null) {
+ subMenu.setMenuLayout(menuConfiguration.getSubMenuLayout());
+ }
subMenu.setMenuIcon((shouldHaveArtwork && (cell.getIcon()!= null && cell.getIcon().getImageRPC() != null)) ? cell.getIcon().getImageRPC() : null);
return subMenu;
}
@@ -853,33 +1005,45 @@ abstract class BaseMenuManager extends BaseSubManager {
// LISTENERS
- @SuppressWarnings("deprecation")
private void addListeners(){
-
// DISPLAY CAPABILITIES - via SCM
- displayListener = new OnSystemCapabilityListener() {
+ onDisplaysCapabilityListener = new OnSystemCapabilityListener() {
@Override
public void onCapabilityRetrieved(Object capability) {
- displayCapabilities = (DisplayCapabilities) capability;
- if (displayCapabilities != null) {
- displayType = displayCapabilities.getDisplayType();
+ // instead of using the parameter it's more safe to use the convenience method
+ List<DisplayCapability> capabilities = SystemCapabilityManager.convertToList(capability, DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ DebugTool.logError("SoftButton Manager - Capabilities sent here are null or empty");
+ }else {
+ DisplayCapability display = capabilities.get(0);
+ displayType = display.getDisplayName();
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ defaultMainWindowCapability = windowCapability;
+ }
+ }
}
}
@Override
public void onError(String info) {
- DebugTool.logError("Unable to retrieve display capabilities: "+ info);
+ DebugTool.logError("Display Capability cannot be retrieved");
+ defaultMainWindowCapability = null;
}
};
- internalInterface.getCapability(SystemCapabilityType.DISPLAY, displayListener);
+ this.internalInterface.addOnSystemCapabilityListener(SystemCapabilityType.DISPLAYS, onDisplaysCapabilityListener);
// HMI UPDATES
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
- OnHMIStatus hmiStatus = (OnHMIStatus) notification;
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = hmiStatus.getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
// Auto-send an updated menu if we were in NONE and now we are not, and we need an update
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE && currentSystemContext != SystemContext.SYSCTXT_MENU){
@@ -894,7 +1058,7 @@ abstract class BaseMenuManager extends BaseSubManager {
// If we don't check for this and only update when not in the menu, there can be IN_USE errors, especially with submenus.
// We also don't want to encourage changing out the menu while the user is using it for usability reasons.
SystemContext oldContext = currentSystemContext;
- currentSystemContext = hmiStatus.getSystemContext();
+ currentSystemContext = onHMIStatus.getSystemContext();
if (oldContext == SystemContext.SYSCTXT_MENU && currentSystemContext != SystemContext.SYSCTXT_MENU && currentHMILevel != HMILevel.HMI_NONE){
if (waitingOnHMIUpdate){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
index 7ef2375ab..1000e3c1f 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java
@@ -45,6 +45,7 @@ import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -295,8 +296,12 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
hmiListener = new OnRPCNotificationListener() {
@Override
public void onNotified(RPCNotification notification) {
+ OnHMIStatus onHMIStatus = (OnHMIStatus)notification;
+ if (onHMIStatus.getWindowID() != null && onHMIStatus.getWindowID() != PredefinedWindows.DEFAULT_WINDOW.getValue()) {
+ return;
+ }
HMILevel oldHMILevel = currentHMILevel;
- currentHMILevel = ((OnHMIStatus) notification).getHmiLevel();
+ currentHMILevel = onHMIStatus.getHmiLevel();
// Auto-send an update if we were in NONE and now we are not
if (oldHMILevel == HMILevel.HMI_NONE && currentHMILevel != HMILevel.HMI_NONE){
if (waitingOnHMIUpdate){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
index 3ba0ee0b6..5265bb6b9 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuCell.java
@@ -36,6 +36,8 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+import com.smartdevicelink.util.DebugTool;
import java.util.ArrayList;
import java.util.List;
@@ -78,6 +80,12 @@ public class MenuCell implements Cloneable{
private int cellId;
/**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ */
+ private MenuLayout subMenuLayout;
+
+ /**
* MAX ID for cells - Cannot use Integer.MAX_INT as the value is too high.
*/
private static final int MAX_ID = 2000000000;
@@ -110,7 +118,10 @@ public class MenuCell implements Cloneable{
* @param title The cell's primary text
* @param icon The cell's image
* @param subCells The sub-cells for the sub menu that will appear when the cell is selected
+ *
+ * @deprecated use {@link #MenuCell(String, MenuLayout, SdlArtwork, List)}
*/
+ @Deprecated
public MenuCell(@NonNull String title, @Nullable SdlArtwork icon, @Nullable List<MenuCell> subCells) {
setTitle(title); // title is the only required param
setIcon(icon);
@@ -119,6 +130,24 @@ public class MenuCell implements Cloneable{
setParentCellId(MAX_ID);
}
+ /**
+ * Creates a new MenuCell Object with multiple parameters set
+ * <strong>NOTE: because this has sub-cells, there does not need to be a listener</strong>
+ * @param title The cell's primary text
+ * @param subMenuLayout The submenu's layout that the subCells will be shown in. If `null`, the
+ * default submenu layout in the screen manager's `MenuConfiguration` will be used.
+ * @param icon The cell's image
+ * @param subCells The sub-cells for the sub menu that will appear when the cell is selected
+ */
+ public MenuCell(@NonNull String title, @Nullable MenuLayout subMenuLayout, @Nullable SdlArtwork icon, @Nullable List<MenuCell> subCells) {
+ setTitle(title); // title is the only required param
+ setSubMenuLayout(subMenuLayout);
+ setIcon(icon);
+ setSubCells(subCells);
+ setCellId(MAX_ID);
+ setParentCellId(MAX_ID);
+ }
+
// SETTERS / GETTERS
// PUBLIC METHODS
@@ -203,6 +232,24 @@ public class MenuCell implements Cloneable{
return menuSelectionListener;
}
+ /**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ * @param subMenuLayout - the layout used for the sub menu
+ */
+ public void setSubMenuLayout(MenuLayout subMenuLayout) {
+ this.subMenuLayout = subMenuLayout;
+ }
+
+ /**
+ * The submenu's layout that the subCells will be shown in. If `null`, the default submenu
+ * layout set via the screen manager's `MenuConfiguration` will be used.
+ * @return - the layout used for the sub menu
+ */
+ public MenuLayout getSubMenuLayout() {
+ return this.subMenuLayout;
+ }
+
// INTERNALLY USED METHODS
/**
@@ -276,35 +323,30 @@ public class MenuCell implements Cloneable{
/**
* Creates a deep copy of the object
- * @return deep copy of the object
+ * @return deep copy of the object, null if an exception occurred
*/
@Override
public MenuCell clone() {
- final MenuCell clone;
try {
- clone = (MenuCell) super.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException("superclass messed up", e);
- }
- clone.title = this.title;
- clone.icon = this.icon == null ? null : this.icon.clone();
- clone.voiceCommands = null;
- if (this.voiceCommands != null){
- clone.voiceCommands = new ArrayList<>();
- for (String voiceCommand : this.voiceCommands) {
- clone.voiceCommands.add(voiceCommand);
+ MenuCell clone = (MenuCell) super.clone();
+ if(this.icon != null){
+ clone.icon = this.icon.clone();
}
- }
- clone.subCells = null;
- if (this.subCells != null) {
- clone.subCells = new ArrayList<>();
- for (MenuCell subCell : this.subCells) {
- clone.subCells.add(subCell == null ? null : subCell.clone());
+ if(this.subCells != null){
+ ArrayList<MenuCell> cloneSubCells = new ArrayList<>();
+ for(MenuCell subCell : subCells){
+ cloneSubCells.add(subCell.clone());
+ }
+ clone.subCells = cloneSubCells;
+ }
+
+ return clone;
+ } catch (CloneNotSupportedException e) {
+ if(DebugTool.isDebugEnabled()){
+ throw new RuntimeException("Clone not supported by super class");
}
}
- clone.menuSelectionListener = this.menuSelectionListener;
- clone.parentCellId = this.parentCellId;
- clone.cellId = this.cellId;
- return clone;
+
+ return null;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java
new file mode 100644
index 000000000..13e1f92e2
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/MenuConfiguration.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/18/19 3:28 PM
+ *
+ */
+
+package com.smartdevicelink.managers.screen.menu;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+
+public class MenuConfiguration {
+
+ private MenuLayout mainMenuLayout, submenuLayout;
+
+ /**
+ * Create a MenuConfiguration Object
+ * @param mainMenuLayout - the layout of the main menu. If `null`, it will default to whatever the head unit uses
+ * @param submenuLayout - the layout of the main menu. If `null`, it will default to whatever the head unit uses
+ */
+ public MenuConfiguration(MenuLayout mainMenuLayout, MenuLayout submenuLayout){
+ setMenuLayout(mainMenuLayout);
+ setSubMenuLayout(submenuLayout);
+ }
+
+ /**
+ * Changes the default main menu layout.
+ * @param mainMenuLayout - the layout of the main menu
+ */
+ private void setMenuLayout(MenuLayout mainMenuLayout){
+ this.mainMenuLayout = mainMenuLayout;
+ }
+
+ /**
+ * Changes the default main menu layout.
+ * @return - the layout of the main menu
+ */
+ public MenuLayout getMenuLayout() {
+ return this.mainMenuLayout;
+ }
+
+ /**
+ * Changes the default submenu layout. To change this for an individual submenu, set the
+ * `menuLayout` property on the `MenuCell` constructor for creating a cell with sub-cells.
+ * @param submenuLayout - the MenuLayout for this sub menu
+ */
+ private void setSubMenuLayout(MenuLayout submenuLayout){
+ this.submenuLayout = submenuLayout;
+ }
+
+ /**
+ * Changes the default submenu layout. To change this for an individual submenu, set the
+ * `menuLayout` property on the `MenuCell` constructor for creating a cell with sub-cells.
+ * @return - the MenuLayout for this sub menu
+ */
+ public MenuLayout getSubMenuLayout() {
+ return submenuLayout;
+ }
+
+ /**
+ * @return A string description of the cell, useful for debugging.
+ */
+ @Override @NonNull
+ public String toString() {
+ return "MenuConfiguration: MenuLayout = "+ this.mainMenuLayout + " | SubMenuLayout = "+ this.submenuLayout;
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java b/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
index 6c4d89671..edc860a42 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlPacket.java
@@ -340,15 +340,15 @@ public class SdlPacket implements Parcelable{
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("***** Sdl Packet ******");
- builder.append( "\nVersion: " +version);
- builder.append( "\nEncryption: " +encryption);
- builder.append( "\nFrameType: " +frameType);
- builder.append( "\nServiceType: " +serviceType);
- builder.append( "\nFrameInfo: " +frameInfo);
- builder.append( "\nSessionId: " +sessionId);
- builder.append( "\nDataSize: " +dataSize);
+ builder.append("\nVersion: ").append(version);
+ builder.append("\nEncryption: ").append(encryption);
+ builder.append("\nFrameType: ").append(frameType);
+ builder.append("\nServiceType: ").append(serviceType);
+ builder.append("\nFrameInfo: ").append(frameInfo);
+ builder.append("\nSessionId: ").append(sessionId);
+ builder.append("\nDataSize: ").append(dataSize);
if(version>1){
- builder.append( "\nMessageId: " +messageId);
+ builder.append("\nMessageId: ").append(messageId);
}
builder.append("\n***** Sdl Packet End******");
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java b/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
index 14ecc029d..306d94c2c 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlPacketFactory.java
@@ -44,11 +44,10 @@ public class SdlPacketFactory {
int dataSize, int messageId, byte[] payload) {
*/
public static SdlPacket createStartSession(SessionType serviceType, int messageID, byte version, byte sessionID, boolean encrypted) {
- SdlPacket packet = new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_CONTROL,
+
+ return new SdlPacket(version,encrypted,SdlPacket.FRAME_TYPE_CONTROL,
serviceType.getValue(),SdlPacket.FRAME_INFO_START_SERVICE,sessionID,
0,messageID,null);
-
- return packet;
}
public static SdlPacket createHeartbeat(SessionType serviceType, byte sessionID, byte version) {
diff --git a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
index 929e2873a..99b93c780 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/SdlProtocolBase.java
@@ -171,14 +171,17 @@ public class SdlProtocolBase {
* @return the max transfer unit
*/
public int getMtu(){
- return mtus.get(SessionType.RPC).intValue();
+ return Long.valueOf(getMtu(SessionType.RPC)).intValue();
}
public long getMtu(SessionType type){
Long mtu = mtus.get(type);
- if(mtu == null){
+ if (mtu == null) {
mtu = mtus.get(SessionType.RPC);
}
+ if (mtu == null) { //If MTU is still null, use the oldest/smallest
+ mtu = (long) V1_V2_MTU_SIZE;
+ }
return mtu;
}
@@ -306,13 +309,16 @@ public class SdlProtocolBase {
// If this service type has extra information from the RPC StartServiceACK
// parse through it to find which transport should be used to start this
// specific service type
- for(int transportNum : transportPriorityForServiceMap.get(secondaryService)){
- if(transportNum == PRIMARY_TRANSPORT_ID){
- break; // Primary is favored for this service type, break out...
- }else if(transportNum == SECONDARY_TRANSPORT_ID){
- // The secondary transport can be used to start this service
- activeTransports.put(secondaryService, transportRecord);
- break;
+ List<Integer> transportNumList = transportPriorityForServiceMap.get(secondaryService);
+ if (transportNumList != null){
+ for (int transportNum : transportNumList) {
+ if (transportNum == PRIMARY_TRANSPORT_ID) {
+ break; // Primary is favored for this service type, break out...
+ } else if (transportNum == SECONDARY_TRANSPORT_ID) {
+ // The secondary transport can be used to start this service
+ activeTransports.put(secondaryService, transportRecord);
+ break;
+ }
}
}
}
@@ -529,6 +535,9 @@ public class SdlProtocolBase {
public void endSession(byte sessionID, int hashId) {
SdlPacket header = SdlPacketFactory.createEndSession(SessionType.RPC, sessionID, hashId, (byte)protocolVersion.getMajor(), hashId);
handlePacketToSend(header);
+ if(transportManager != null) {
+ transportManager.close(sessionID);
+ }
} // end-method
@@ -598,7 +607,7 @@ public class SdlProtocolBase {
}
synchronized(messageLock) {
- if (data.length > getMtu(sessionType)) {
+ if (data != null && data.length > getMtu(sessionType)) {
messageID++;
@@ -990,7 +999,8 @@ public class SdlProtocolBase {
notifyDevTransportListener();
} else {
- Log.w(TAG, "Received a start service ack for RPC service while already active on a different transport.");
+ DebugTool.logInfo("Received a start service ack for RPC service while already active on a different transport.");
+ iSdlProtocol.onProtocolSessionStarted(serviceType, (byte) packet.getSessionId(), (byte)protocolVersion.getMajor(), "", hashID, packet.isEncrypted());
return;
}
diff --git a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
index c59dccfc9..964000dad 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.protocol.enums;
import java.util.EnumSet;
@@ -100,7 +100,14 @@ public enum FunctionID{
GET_APP_SERVICE_DATA(53, "GetAppServiceData"),
GET_FILE(54, "GetFile"),
PERFORM_APP_SERVICES_INTERACTION(55, "PerformAppServiceInteraction"),
-
+ UNPUBLISH_APP_SERVICE(56, "UnpublishAppService"),
+ CANCEL_INTERACTION(57, "CancelInteraction"),
+ CLOSE_APPLICATION(58, "CloseApplication"),
+ SHOW_APP_MENU(59, "ShowAppMenu"),
+ CREATE_WINDOW(60, "CreateWindow"),
+ DELETE_WINDOW(61, "DeleteWindow"),
+ GET_INTERIOR_VEHICLE_DATA_CONSENT(62, "GetInteriorVehicleDataConsent"),
+ RELEASE_INTERIOR_VEHICLE_MODULE(63, "ReleaseInteriorVehicleDataModule"),
// NOTIFICATIONS
ON_HMI_STATUS(32768, "OnHMIStatus"),
ON_APP_INTERFACE_UNREGISTERED(32769, "OnAppInterfaceUnregistered"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index 339dc4e75..ac0d11506 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -74,7 +74,9 @@ public class RPCMessage extends RPCStruct {
store = hash;
messageType = getMessageTypeName(hash.keySet());
function = (Hashtable<String, Object>) hash.get(messageType);
- parameters = (Hashtable<String, Object>) function.get(KEY_PARAMETERS);
+ if (function != null) {
+ parameters = (Hashtable<String, Object>) function.get(KEY_PARAMETERS);
+ }
if (hasKey(hash.keySet(), RPCStruct.KEY_BULK_DATA)) {
setBulkData((byte[]) hash.get(RPCStruct.KEY_BULK_DATA));
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index 99af52156..69c3e2bc0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
@@ -108,8 +108,13 @@ public class RPCStruct {
if (protocolVersion > 1) {
String messageType = getMessageTypeName(store.keySet());
Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
- Hashtable<String, Object> parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
- return JsonRPCMarshaller.serializeHashtable(parameters);
+ if(function != null){
+ Hashtable<String, Object> parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ return JsonRPCMarshaller.serializeHashtable(parameters);
+ }else{
+ return null;
+ }
+
} else return JsonRPCMarshaller.serializeHashtable(store);
}
@@ -133,7 +138,11 @@ public class RPCStruct {
//retrieved from the store object.
String messageType = getMessageTypeName(store.keySet());
Hashtable<String, Object> function = (Hashtable<String, Object>) store.get(messageType);
- parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ if(function != null){
+ parameters = (Hashtable<String, Object>) function.get(RPCMessage.KEY_PARAMETERS);
+ }else {
+ parameters = null;
+ }
} else {
//If this is just an RPC struct the store itself should be used
parameters = store;
@@ -316,8 +325,7 @@ public class RPCStruct {
}
if(valueForString != null){
try {
- Object value = valueForString.invoke(null, (String) s);
- return value;
+ return valueForString.invoke(null, (String) s);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java b/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
index 24ba44331..febeb24ca 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java
@@ -36,23 +36,38 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
import com.smartdevicelink.proxy.rpc.AppServiceCapability;
import com.smartdevicelink.proxy.rpc.AppServicesCapabilities;
+import com.smartdevicelink.proxy.rpc.ButtonCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapabilities;
+import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.GetSystemCapability;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.HMICapabilities;
import com.smartdevicelink.proxy.rpc.OnSystemCapabilityUpdated;
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
+import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
import com.smartdevicelink.proxy.rpc.SystemCapability;
+import com.smartdevicelink.proxy.rpc.WindowCapability;
+import com.smartdevicelink.proxy.rpc.WindowTypeCapabilities;
+import com.smartdevicelink.proxy.rpc.enums.DisplayType;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
+import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.CorrelationIdGenerator;
import com.smartdevicelink.util.DebugTool;
+import com.smartdevicelink.util.Version;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.ListIterator;
import java.util.concurrent.CopyOnWriteArrayList;
public class SystemCapabilityManager {
@@ -61,18 +76,161 @@ public class SystemCapabilityManager {
private final Object LISTENER_LOCK;
private final ISdl callback;
private OnRPCListener rpcListener;
+ private boolean shouldConvertDeprecatedDisplayCapabilities;
public SystemCapabilityManager(ISdl callback){
this.callback = callback;
this.LISTENER_LOCK = new Object();
this.onSystemCapabilityListeners = new HashMap<>();
this.cachedSystemCapabilities = new HashMap<>();
+ this.shouldConvertDeprecatedDisplayCapabilities = true;
setupRpcListeners();
}
+ private List<DisplayCapability> createDisplayCapabilityList(RegisterAppInterfaceResponse rpc) {
+ return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(SetDisplayLayoutResponse rpc) {
+ return createDisplayCapabilityList(rpc.getDisplayCapabilities(), rpc.getButtonCapabilities(), rpc.getSoftButtonCapabilities());
+ }
+
+ private List<DisplayCapability> createDisplayCapabilityList(DisplayCapabilities display, List<ButtonCapabilities> button, List<SoftButtonCapabilities> softButton) {
+ // Based on deprecated Display capabilities we don't know if widgets are supported,
+ // The Default MAIN window is the only window we know is supported
+ WindowTypeCapabilities windowTypeCapabilities = new WindowTypeCapabilities(WindowType.MAIN, 1);
+
+ DisplayCapability displayCapability = new DisplayCapability();
+ displayCapability.setDisplayName(display != null ? display.getDisplayName() : display.getDisplayType().toString());
+ displayCapability.setWindowTypeSupported(Collections.singletonList(windowTypeCapabilities));
+
+ // Create a window capability object for the default MAIN window
+ WindowCapability defaultWindowCapability = new WindowCapability();
+ defaultWindowCapability.setWindowID(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ defaultWindowCapability.setButtonCapabilities(button);
+ defaultWindowCapability.setSoftButtonCapabilities(softButton);
+
+ // return if display capabilities don't exist.
+ if (display == null) {
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ // copy all available display capabilities
+ defaultWindowCapability.setTemplatesAvailable(display.getTemplatesAvailable());
+ defaultWindowCapability.setNumCustomPresetsAvailable(display.getNumCustomPresetsAvailable());
+ defaultWindowCapability.setTextFields(display.getTextFields());
+ defaultWindowCapability.setImageFields(display.getImageFields());
+ ArrayList<ImageType> imageTypeSupported = new ArrayList<>();
+ imageTypeSupported.add(ImageType.STATIC); // static images expected to always work on any head unit
+ if (display.getGraphicSupported()) {
+ imageTypeSupported.add(ImageType.DYNAMIC);
+ }
+ defaultWindowCapability.setImageTypeSupported(imageTypeSupported);
+
+ displayCapability.setWindowCapabilities(Collections.singletonList(defaultWindowCapability));
+ return Collections.singletonList(displayCapability);
+ }
+
+ private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayName, WindowCapability defaultMainWindow) {
+ DisplayCapabilities convertedCapabilities = new DisplayCapabilities();
+ convertedCapabilities.setDisplayType(DisplayType.SDL_GENERIC); //deprecated but it is mandatory...
+ convertedCapabilities.setDisplayName(displayName);
+ convertedCapabilities.setTextFields(defaultMainWindow.getTextFields());
+ convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
+ convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
+ convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
+ convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but allows empty array
+ // if there are imageTypes in the response, we must assume graphics are supported
+ convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported() != null && defaultMainWindow.getImageTypeSupported().size() > 0);
+
+ return convertedCapabilities;
+ }
+
+ private void updateDeprecatedDisplayCapabilities() {
+ WindowCapability defaultMainWindowCapabilities = getDefaultMainWindowCapability();
+ List<DisplayCapability> displayCapabilityList = convertToList(getCapability(SystemCapabilityType.DISPLAYS), DisplayCapability.class);
+
+ if (defaultMainWindowCapabilities == null || displayCapabilityList == null || displayCapabilityList.size() == 0) {
+ return;
+ }
+
+ // cover the deprecated capabilities for backward compatibility
+ setCapability(SystemCapabilityType.DISPLAY, createDeprecatedDisplayCapabilities(displayCapabilityList.get(0).getDisplayName(), defaultMainWindowCapabilities));
+ setCapability(SystemCapabilityType.BUTTON, defaultMainWindowCapabilities.getButtonCapabilities());
+ setCapability(SystemCapabilityType.SOFTBUTTON, defaultMainWindowCapabilities.getSoftButtonCapabilities());
+ }
+
+ private void updateCachedDisplayCapabilityList(List<DisplayCapability> newCapabilities) {
+ if (newCapabilities == null || newCapabilities.size() == 0) {
+ DebugTool.logWarning("Received invalid display capability list");
+ return;
+ }
+
+ List<DisplayCapability> oldCapabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS), DisplayCapability.class);
+
+ if (oldCapabilities == null || oldCapabilities.size() == 0) {
+ setCapability(SystemCapabilityType.DISPLAYS, newCapabilities);
+ updateDeprecatedDisplayCapabilities();
+ return;
+ }
+
+ DisplayCapability oldDefaultDisplayCapabilities = oldCapabilities.get(0);
+ ArrayList<WindowCapability> copyWindowCapabilities = new ArrayList<>(oldDefaultDisplayCapabilities.getWindowCapabilities());
+
+ DisplayCapability newDefaultDisplayCapabilities = newCapabilities.get(0);
+ List<WindowCapability> newWindowCapabilities = newDefaultDisplayCapabilities.getWindowCapabilities();
+
+ for (WindowCapability newWindow : newWindowCapabilities) {
+ ListIterator<WindowCapability> iterator = copyWindowCapabilities.listIterator();
+ boolean oldFound = false;
+ while (iterator.hasNext()) {
+ WindowCapability oldWindow = iterator.next();
+ int newWindowID = newWindow.getWindowID() != null ? newWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ int oldWindowID = oldWindow.getWindowID() != null ? oldWindow.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (newWindowID == oldWindowID) {
+ iterator.set(newWindow); // replace the old window caps with new ones
+ oldFound = true;
+ break;
+ }
+ }
+
+ if (!oldFound) {
+ copyWindowCapabilities.add(newWindow); // this is a new unknown window
+ }
+ }
+
+ // replace the window capabilities array with the merged one.
+ newDefaultDisplayCapabilities.setWindowCapabilities(copyWindowCapabilities);
+ setCapability(SystemCapabilityType.DISPLAYS, Collections.singletonList(newDefaultDisplayCapabilities));
+ updateDeprecatedDisplayCapabilities();
+ }
+
+
+ public WindowCapability getWindowCapability(int windowID) {
+ List<DisplayCapability> capabilities = convertToList(getCapability(SystemCapabilityType.DISPLAYS), DisplayCapability.class);
+ if (capabilities == null || capabilities.size() == 0) {
+ return null;
+ }
+ DisplayCapability display = capabilities.get(0);
+ for (WindowCapability windowCapability : display.getWindowCapabilities()) {
+ int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue();
+ if (currentWindowID == windowID) {
+ return windowCapability;
+ }
+ }
+ return null;
+ }
+
+ public WindowCapability getDefaultMainWindowCapability() {
+ return getWindowCapability(PredefinedWindows.DEFAULT_WINDOW.getValue());
+ }
+
public void parseRAIResponse(RegisterAppInterfaceResponse response){
if(response!=null && response.getSuccess()) {
+ this.shouldConvertDeprecatedDisplayCapabilities = true; // reset the flag
+ setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
setCapability(SystemCapabilityType.HMI, response.getHmiCapabilities());
setCapability(SystemCapabilityType.DISPLAY, response.getDisplayCapabilities());
setCapability(SystemCapabilityType.AUDIO_PASSTHROUGH, response.getAudioPassThruCapabilities());
@@ -83,10 +241,11 @@ public class SystemCapabilityManager {
setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
setCapability(SystemCapabilityType.SPEECH, response.getSpeechCapabilities());
setCapability(SystemCapabilityType.VOICE_RECOGNITION, response.getVrCapabilities());
+ setCapability(SystemCapabilityType.PRERECORDED_SPEECH, response.getPrerecordedSpeech());
}
}
- private void setupRpcListeners(){
+ private void setupRpcListeners() {
rpcListener = new OnRPCListener() {
@Override
public void onReceived(RPCMessage message) {
@@ -99,36 +258,53 @@ public class SystemCapabilityManager {
setCapability(SystemCapabilityType.BUTTON, response.getButtonCapabilities());
setCapability(SystemCapabilityType.PRESET_BANK, response.getPresetBankCapabilities());
setCapability(SystemCapabilityType.SOFTBUTTON, response.getSoftButtonCapabilities());
+ if (shouldConvertDeprecatedDisplayCapabilities) {
+ setCapability(SystemCapabilityType.DISPLAYS, createDisplayCapabilityList(response));
+ }
+ break;
+ case GET_SYSTEM_CAPABILITY:
+ GetSystemCapabilityResponse systemCapabilityResponse = (GetSystemCapabilityResponse) message;
+ SystemCapability systemCapability = systemCapabilityResponse.getSystemCapability();
+ if (systemCapabilityResponse.getSuccess() && SystemCapabilityType.DISPLAYS.equals(systemCapability.getSystemCapabilityType())) {
+ shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
+ List<DisplayCapability> newCapabilities = (List<DisplayCapability>) systemCapability.getCapabilityForType(SystemCapabilityType.DISPLAYS);
+ updateCachedDisplayCapabilityList(newCapabilities);
+ }
break;
}
- } else if (RPCMessage.KEY_NOTIFICATION.equals(message.getMessageType())){
+ } else if (RPCMessage.KEY_NOTIFICATION.equals(message.getMessageType())) {
switch (message.getFunctionID()) {
case ON_SYSTEM_CAPABILITY_UPDATED:
- OnSystemCapabilityUpdated onSystemCapabilityUpdated =(OnSystemCapabilityUpdated)message;
- if(onSystemCapabilityUpdated.getSystemCapability() != null){
+ OnSystemCapabilityUpdated onSystemCapabilityUpdated = (OnSystemCapabilityUpdated) message;
+ if (onSystemCapabilityUpdated.getSystemCapability() != null) {
SystemCapability systemCapability = onSystemCapabilityUpdated.getSystemCapability();
SystemCapabilityType systemCapabilityType = systemCapability.getSystemCapabilityType();
Object capability = systemCapability.getCapabilityForType(systemCapabilityType);
- if(cachedSystemCapabilities.containsKey(systemCapabilityType)) { //The capability already exists
+ if (cachedSystemCapabilities.containsKey(systemCapabilityType)) { //The capability already exists
switch (systemCapabilityType) {
case APP_SERVICES:
// App services only updates what was changed so we need
// to update the capability rather than override it
AppServicesCapabilities appServicesCapabilities = (AppServicesCapabilities) capability;
- if(capability != null) {
- List<AppServiceCapability> appServicesCapabilitiesList = appServicesCapabilities.getAppServices();
- AppServicesCapabilities cachedAppServicesCapabilities = (AppServicesCapabilities) cachedSystemCapabilities.get(systemCapabilityType);
- //Update the cached app services
- cachedAppServicesCapabilities.updateAppServices(appServicesCapabilitiesList);
- //Set the new capability object to the updated cached capabilities
- capability = cachedAppServicesCapabilities;
+ if (capability != null) {
+ List<AppServiceCapability> appServicesCapabilitiesList = appServicesCapabilities.getAppServices();
+ AppServicesCapabilities cachedAppServicesCapabilities = (AppServicesCapabilities) cachedSystemCapabilities.get(systemCapabilityType);
+ //Update the cached app services
+ cachedAppServicesCapabilities.updateAppServices(appServicesCapabilitiesList);
+ //Set the new capability object to the updated cached capabilities
+ capability = cachedAppServicesCapabilities;
}
break;
+ case DISPLAYS:
+ shouldConvertDeprecatedDisplayCapabilities = false; // Successfully got DISPLAYS data. No conversion needed anymore
+ // this notification can return only affected windows (hence not all windows)
+ List<DisplayCapability> newCapabilities = (List<DisplayCapability>) capability;
+ updateCachedDisplayCapabilityList(newCapabilities);
}
}
- if(capability != null){
- setCapability(systemCapabilityType, capability);
- }
+ if (capability != null) {
+ setCapability(systemCapabilityType, capability);
+ }
}
}
}
@@ -136,7 +312,8 @@ public class SystemCapabilityManager {
}
};
- if(callback != null){
+ if (callback != null) {
+ callback.addOnRPCListener(FunctionID.GET_SYSTEM_CAPABILITY, rpcListener);
callback.addOnRPCListener(FunctionID.SET_DISPLAY_LAYOUT, rpcListener);
callback.addOnRPCListener(FunctionID.ON_SYSTEM_CAPABILITY_UPDATED, rpcListener);
}
@@ -181,15 +358,45 @@ public class SystemCapabilityManager {
return true;
}else if(cachedSystemCapabilities.containsKey(SystemCapabilityType.HMI)){
HMICapabilities hmiCapabilities = ((HMICapabilities)cachedSystemCapabilities.get(SystemCapabilityType.HMI));
+ Version rpcVersion = null;
+ if (callback != null) {
+ SdlMsgVersion version = callback.getSdlMsgVersion();
+ if(version != null){
+ rpcVersion = new Version(version.getMajorVersion(), version.getMinorVersion(), version.getPatchVersion());
+ }
+ }
switch (type) {
case NAVIGATION:
return hmiCapabilities.isNavigationAvailable();
case PHONE_CALL:
return hmiCapabilities.isPhoneCallAvailable();
case VIDEO_STREAMING:
+ if(rpcVersion != null) {
+ if(rpcVersion.isBetween(new Version(3,0,0), new Version(4,4,0)) >= 0){
+ //This was before the system capability feature was added so check if
+ // graphics are supported instead
+ DisplayCapabilities displayCapabilities = (DisplayCapabilities) getCapability(SystemCapabilityType.DISPLAY);
+ if(displayCapabilities != null){
+ return displayCapabilities.getGraphicSupported() != null && displayCapabilities.getGraphicSupported();
+ }
+ }
+ }
return hmiCapabilities.isVideoStreamingAvailable();
case REMOTE_CONTROL:
return hmiCapabilities.isRemoteControlAvailable();
+ case APP_SERVICES:
+ if(rpcVersion != null){
+ if(rpcVersion.getMajor() == 5 && rpcVersion.getMinor() == 1){
+ //This is a corner case that the param was not available in 5.1.0, but
+ //the app services feature was available.
+ return true;
+ }
+ }
+ return hmiCapabilities.isAppServicesAvailable();
+ case DISPLAYS:
+ return hmiCapabilities.isDisplaysCapabilityAvailable();
+ case SEAT_LOCATION:
+ return hmiCapabilities.isSeatLocationAvailable();
default:
return false;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
index 13871a9f8..eb3d00c6b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerALM.java
@@ -29,8 +29,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.proxy.interfaces;
-
-public interface IProxyListenerALM extends IProxyListenerBase {
- // All methods moved into base interface
-}
+package com.smartdevicelink.proxy.interfaces;
+
+@Deprecated
+public interface IProxyListenerALM extends IProxyListenerBase {
+ // All methods moved into base interface
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
index 45b5abcc0..988325bd9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/IProxyListenerBase.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.interfaces;
import com.smartdevicelink.proxy.callbacks.OnServiceEnded;
@@ -38,12 +38,16 @@ import com.smartdevicelink.proxy.rpc.AddSubMenuResponse;
import com.smartdevicelink.proxy.rpc.AlertManeuverResponse;
import com.smartdevicelink.proxy.rpc.AlertResponse;
import com.smartdevicelink.proxy.rpc.ButtonPressResponse;
+import com.smartdevicelink.proxy.rpc.CancelInteractionResponse;
import com.smartdevicelink.proxy.rpc.ChangeRegistrationResponse;
+import com.smartdevicelink.proxy.rpc.CloseApplicationResponse;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSetResponse;
+import com.smartdevicelink.proxy.rpc.CreateWindowResponse;
import com.smartdevicelink.proxy.rpc.DeleteCommandResponse;
import com.smartdevicelink.proxy.rpc.DeleteFileResponse;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSetResponse;
import com.smartdevicelink.proxy.rpc.DeleteSubMenuResponse;
+import com.smartdevicelink.proxy.rpc.DeleteWindowResponse;
import com.smartdevicelink.proxy.rpc.DiagnosticMessageResponse;
import com.smartdevicelink.proxy.rpc.DialNumberResponse;
import com.smartdevicelink.proxy.rpc.EndAudioPassThruResponse;
@@ -52,6 +56,7 @@ import com.smartdevicelink.proxy.rpc.GetAppServiceDataResponse;
import com.smartdevicelink.proxy.rpc.GetCloudAppPropertiesResponse;
import com.smartdevicelink.proxy.rpc.GetDTCsResponse;
import com.smartdevicelink.proxy.rpc.GetFileResponse;
+import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataConsentResponse;
import com.smartdevicelink.proxy.rpc.GetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.GetSystemCapabilityResponse;
import com.smartdevicelink.proxy.rpc.GetVehicleDataResponse;
@@ -84,6 +89,7 @@ import com.smartdevicelink.proxy.rpc.PerformInteractionResponse;
import com.smartdevicelink.proxy.rpc.PublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
import com.smartdevicelink.proxy.rpc.ReadDIDResponse;
+import com.smartdevicelink.proxy.rpc.ReleaseInteriorVehicleDataModuleResponse;
import com.smartdevicelink.proxy.rpc.ResetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.ScrollableMessageResponse;
import com.smartdevicelink.proxy.rpc.SendHapticDataResponse;
@@ -94,6 +100,7 @@ import com.smartdevicelink.proxy.rpc.SetDisplayLayoutResponse;
import com.smartdevicelink.proxy.rpc.SetGlobalPropertiesResponse;
import com.smartdevicelink.proxy.rpc.SetInteriorVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SetMediaClockTimerResponse;
+import com.smartdevicelink.proxy.rpc.ShowAppMenuResponse;
import com.smartdevicelink.proxy.rpc.ShowConstantTbtResponse;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.SliderResponse;
@@ -103,13 +110,14 @@ import com.smartdevicelink.proxy.rpc.SubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.SubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.SubscribeWayPointsResponse;
import com.smartdevicelink.proxy.rpc.SystemRequestResponse;
+import com.smartdevicelink.proxy.rpc.UnpublishAppServiceResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeButtonResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeVehicleDataResponse;
import com.smartdevicelink.proxy.rpc.UnsubscribeWayPointsResponse;
import com.smartdevicelink.proxy.rpc.UpdateTurnListResponse;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
-
+@Deprecated
public interface IProxyListenerBase {
/**
@@ -388,6 +396,10 @@ public interface IProxyListenerBase {
public void onGetInteriorVehicleDataResponse(GetInteriorVehicleDataResponse response);
+ public void onCreateWindowResponse(CreateWindowResponse response);
+
+ public void onDeleteWindowResponse(DeleteWindowResponse response);
+
public void onButtonPressResponse(ButtonPressResponse response);
public void onSetInteriorVehicleDataResponse(SetInteriorVehicleDataResponse response);
@@ -412,6 +424,41 @@ public interface IProxyListenerBase {
public void onOnAppServiceData(OnAppServiceData notification);
+ public void onGetInteriorVehicleDataConsentResponse(GetInteriorVehicleDataConsentResponse response);
+
+ public void onReleaseInteriorVehicleDataModuleResponse(ReleaseInteriorVehicleDataModuleResponse response);
+
public void onOnSystemCapabilityUpdated(OnSystemCapabilityUpdated notification);
-} \ No newline at end of file
+ /**
+ * onCloseApplicationResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onCloseApplicationResponse(CloseApplicationResponse response);
+
+ /**
+ * onCancelInteractionResponse being called indicates that SDL has
+ * responded to a request to dismiss a modal view on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onCancelInteractionResponse(CancelInteractionResponse response);
+
+ /**
+ * UnpublishAppServiceResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onUnpublishAppServiceResponse(UnpublishAppServiceResponse response);
+
+ /**
+ * onShowAppMenuResponse being called indicates that SDL has
+ * responded to a request to close the application on the module.
+ *
+ * @param response - Contains information about the response sent from SDL.
+ */
+ public void onShowAppMenuResponse(ShowAppMenuResponse response);
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
index 8eaa74429..244c34395 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -263,4 +263,8 @@ public interface ISdl {
*/
@NonNull Version getProtocolVersion();
+ /**
+ * Start encrypted RPC service
+ */
+ void startRPCEncryption();
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
index a75b5899e..e2bd7e675 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AddSubMenu.java
@@ -1,40 +1,41 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import java.util.Hashtable;
@@ -89,6 +90,14 @@ import java.util.Hashtable;
* <td></td>
* <td>SmartDeviceLink 5.0</td>
* </tr>
+ * <tr>
+ * <td>menuLayout</td>
+ * <td>MenuLayout</td>
+ * <td>Sets the layout of the submenu screen.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
* <b>Response</b>
* <p>Indicates that the corresponding request either failed or succeeded. If the response returns with a SUCCESS result code, this means the SubMenu was added to the Command Menu successfully</p>
@@ -106,6 +115,7 @@ public class AddSubMenu extends RPCRequest {
public static final String KEY_MENU_NAME = "menuName";
public static final String KEY_MENU_ID = "menuID";
public static final String KEY_MENU_ICON = "menuIcon";
+ public static final String KEY_MENU_LAYOUT = "menuLayout";
/**
* Constructs a new AddSubMenu object
@@ -223,4 +233,21 @@ public class AddSubMenu extends RPCRequest {
public void setMenuIcon(Image menuIcon) {
setParameters(KEY_MENU_ICON, menuIcon);
}
+
+ /**
+ * Sets the layout of the submenu screen.
+ * @param menuLayout - the menuLayout
+ */
+ public void setMenuLayout(MenuLayout menuLayout) {
+ setParameters(KEY_MENU_LAYOUT, menuLayout);
+ }
+
+ /**
+ * Gets the layout of the submenu screen.
+ * @return the MenuLayout
+ */
+ @SuppressWarnings("unchecked")
+ public MenuLayout getMenuLayout() {
+ return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
index 1490a48f1..a67484131 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Alert.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -39,7 +39,9 @@ import java.util.List;
/**
* Provides information to the user using either TTS, the Display or both and
- * can include a system-generated alert tone
+ * can include a system-generated alert tone.
+ *
+ * If connecting to SDL Core v.6.0+, the alert can be canceled programmatically using the `cancelID`. Canceling will not dismiss the alert's speech - only the modal view will be dismissed. On older versions of SDL Core, the alert will persist until the user has interacted with the alert or the specified timeout has elapsed.
*
* <ul>
* <li>The displayed portion of the Alert, if any, will persist until the
@@ -68,7 +70,7 @@ import java.util.List;
* <th>Name</th>
* <th>Type</th>
* <th>Description</th>
- * <th> Req.</th>
+ * <th>Req.</th>
* <th>Notes</th>
* <th>Version Available</th>
* </tr>
@@ -76,23 +78,23 @@ import java.util.List;
* <td>alertText1</td>
* <td>String</td>
* <td>Text to be displayed in the first field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
+ * <td>N</td>
+ * <td>Length is limited to what is indicated in RegisterAppInterface response. If omitted, top display line will be cleared. Text is always centered</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText2</td>
* <td>String</td>
* <td>Text to be displayed in the second field of the display during the Alert. </td>
- * <td>N</td>
- * <td> Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
+ * <td>N</td>
+ * <td>Only permitted if HMI supports a second display line. Length is limited to what is indicated in RegisterAppInterface response. If omitted, second display line will be cleared. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>alertText3</td>
* <td>String</td>
* <td>Text to be displayed in the third field of the display during the Alert.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -100,23 +102,23 @@ import java.util.List;
* <td>ttsChunks</td>
* <td>TTSChunk[]</td>
* <td>Array of type TTSChunk which, taken together, specify what is to be spoken to the user.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>Array must have a least one element. </td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>duration</td>
* <td>Integer</td>
- * <td><p>The duration of the displayed portion of the alert, in milliseconds.</p> After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
- * <td>N</td>
- * <td>Min Value: 3000 Max Value: 10000 <p>If omitted, the default is 5000 milliseconds</p></td>
+ * <td>The duration of the displayed portion of the alert, in milliseconds. After this amount of time has passed, the display fields alertText1 and alertText2 will revert to what was displayed in those fields before the alert began.</td>
+ * <td>N</td>
+ * <td>Min Value: 3000 Max Value: 10000. If omitted, the default is 5000 milliseconds</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
* <tr>
* <td>playTone</td>
* <td>Boolean</td>
* <td>Specifies whether the alert tone should be played before the TTS (if any) is spoken.</td>
- * <td>N</td>
+ * <td>N</td>
* <td>If omitted, default is true.</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -124,7 +126,7 @@ import java.util.List;
* <td>softButtons</td>
* <td>SoftButton[]</td>
* <td>Specifies the softbuttons, the apps wants to use in this alert.</td>
- * <td></td>
+ * <td>N</td>
* <td>If omitted on supported displays, the alert will not have any SoftButton.ArrayMin: 0; ArrayMax: 4</td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
@@ -132,10 +134,26 @@ import java.util.List;
* <td>progressIndicator</td>
* <td>Boolean</td>
* <td>If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.</td>
- * <td>N</td>
+ * <td>N</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
+ * <tr>
+ * <td>alertIcon</td>
+ * <td>Image</td>
+ * <td>Image struct determining whether the icon is static or dynamic. If omitted on supported displays, no (or the default if applicable) icon should be displayed.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0.0</td>
+ * </tr>
* </table>
* @since SmartDeviceLink 1.0
*
@@ -154,6 +172,8 @@ public class Alert extends RPCRequest {
public static final String KEY_PROGRESS_INDICATOR = "progressIndicator";
public static final String KEY_TTS_CHUNKS = "ttsChunks";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
+ public static final String KEY_ALERT_ICON = "alertIcon";
/**
* Constructs a new Alert object
@@ -364,14 +384,72 @@ public class Alert extends RPCRequest {
* </ul>
* @since SmartDeviceLink 2.0
*/
-
public void setSoftButtons(List<SoftButton> softButtons) {
setParameters(KEY_SOFT_BUTTONS, softButtons);
}
- public Boolean getProgressIndicator() {
- return getBoolean(KEY_PROGRESS_INDICATOR);
+
+ /**
+ * Gets a Boolean value representing the progress indicator
+ *
+ * @return Boolean - If TRUE, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public Boolean getProgressIndicator() {
+ return getBoolean(KEY_PROGRESS_INDICATOR);
}
- public void setProgressIndicator(Boolean progressIndicator) {
+
+ /**
+ * Sets whether the progress indicator should be shown
+ *
+ * @param progressIndicator A Boolean value which specifies whether the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setProgressIndicator(Boolean progressIndicator) {
setParameters(KEY_PROGRESS_INDICATOR, progressIndicator);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ };
+
+ /**
+ * <p>Sets the Image
+ * If provided, defines the image to be shown along with the alert</p>
+ * @param alertIcon
+ * <p>an Image object representing the Image shown along with the alert</p>
+ * <p>
+ * <b>Notes: </b>If omitted on supported displays, no (or the
+ * default if applicable) icon will be displayed</p>
+ */
+ public void setAlertIcon(Image alertIcon) {
+ setParameters(KEY_ALERT_ICON, alertIcon);
+ }
+
+ /**
+ * <p>Gets the image to be shown along with the alert </p>
+ * @return Image -an Image object
+ */
+ public Image getAlertIcon() {
+ return (Image) getObject(Image.class, KEY_ALERT_ICON);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
index c8e2d6d03..4210c9c2b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/AudioControlCapabilities.java
@@ -44,6 +44,7 @@ public class AudioControlCapabilities extends RPCStruct {
public static final String KEY_VOLUME_AVAILABLE = "volumeAvailable";
public static final String KEY_EQUALIZER_AVAILABLE = "equalizerAvailable";
public static final String KEY_EQUALIZER_MAX_CHANNEL_ID = "equalizerMaxChannelId";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated AudioControlCapabilities object
@@ -178,4 +179,19 @@ public class AudioControlCapabilities extends RPCStruct {
return getInteger(KEY_EQUALIZER_MAX_CHANNEL_ID);
}
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
index b92d3ef16..41dcb774d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -97,6 +97,7 @@ public class ButtonCapabilities extends RPCStruct {
public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable";
public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable";
public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a newly allocated ButtonCapabilities object
*/
@@ -178,4 +179,20 @@ public class ButtonCapabilities extends RPCStruct {
public void setUpDownAvailable( @NonNull Boolean upDownAvailable ) {
setValue(KEY_UP_DOWN_AVAILABLE, upDownAvailable);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
index 2272198be..1872138c5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ButtonPress.java
@@ -49,6 +49,7 @@ public class ButtonPress extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_BUTTON_NAME = "buttonName";
public static final String KEY_BUTTON_PRESS_MODE = "buttonPressMode";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new ButtonPress object
@@ -136,4 +137,20 @@ public class ButtonPress extends RPCRequest {
public void setButtonPressMode(@NonNull ButtonPressMode buttonPressMode) {
setParameters(KEY_BUTTON_PRESS_MODE, buttonPressMode);
}
+
+ /**
+ * Sets the module id for this object
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the module id of this object
+ * @return the module id of this object
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
new file mode 100644
index 000000000..3fb02422c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteraction.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/17/19 8:40 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/*
+ * Used to dismiss a modal view programmatically without needing to wait for the timeout to complete. Can be used to dismiss alerts, scrollable messages, sliders, and perform interactions (i.e. pop-up menus).
+ *
+ * @see Alert, ScrollableMessage, Slider, PerformInteraction
+ */
+public class CancelInteraction extends RPCRequest {
+ public static final String KEY_CANCEL_ID = "cancelID";
+ public static final String KEY_FUNCTION_ID = "functionID";
+
+ // Constructors
+
+ /**
+ * Constructs a new CancelInteraction object
+ */
+ public CancelInteraction() {
+ super(FunctionID.CANCEL_INTERACTION.toString());
+ }
+
+ /**
+ * Constructs a new CancelInteraction object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteraction(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Convenience init for dismissing an interaction type.
+ * @param functionID - The ID of the type of interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID) {
+ this();
+ setInteractionFunctionID(functionID);
+ }
+
+ /**
+ * Convenience init for dismissing a specific interaction.
+ * @param functionID - The ID of the type of interaction to dismiss
+ * @param cancelID - The ID of the specific interaction to dismiss
+ */
+ public CancelInteraction(@NonNull Integer functionID, Integer cancelID) {
+ this();
+ setInteractionFunctionID(functionID);
+ setCancelID(cancelID);
+ }
+
+ // Custom Getters / Setters
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @return - the functionID
+ */
+ public Integer getInteractionFunctionID() {
+ return getInteger(KEY_FUNCTION_ID);
+ }
+
+ /**
+ * The ID of the type of interaction to dismiss.
+ * Only values 10 (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ * @param functionID - the functionID
+ */
+ public void setInteractionFunctionID(@NonNull Integer functionID) {
+ setParameters(KEY_FUNCTION_ID, functionID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @return - the cancelID
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * The ID of the specific interaction to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ * @param cancelID - the cancelID
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
new file mode 100644
index 000000000..defab83c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CancelInteractionResponse.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/24/19 9:29 AM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * Response to the request to dismiss a modal view. If no applicable request can be dismissed, the `resultCode` will be `IGNORED`.
+ */
+public class CancelInteractionResponse extends RPCResponse {
+ /**
+ * Constructs a new CancelInteractionResponse object
+ */
+ public CancelInteractionResponse() { super(FunctionID.CANCEL_INTERACTION.toString()); }
+
+ /**
+ * Constructs a new CancelInteractionResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CancelInteractionResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CancelInteractionResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CancelInteractionResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
index 6961faf94..8d229c30a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java
@@ -61,6 +61,8 @@ public class ClimateControlCapabilities extends RPCStruct{
public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable";
public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable";
public static final String KEY_HEATED_MIRRORS_AVAILABLE = "heatedMirrorsAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
+ public static final String KEY_CLIMATE_ENABLE_AVAILABLE = "climateEnableAvailable";
public ClimateControlCapabilities() {
}
@@ -403,4 +405,39 @@ public class ClimateControlCapabilities extends RPCStruct{
public Boolean getHeatedMirrorsAvailable() {
return getBoolean(KEY_HEATED_MIRRORS_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
+ /**
+ * Sets the climateEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @param climateEnableAvailable Availability of the control of enable/disable climate control.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public void setClimateEnableAvailable(Boolean climateEnableAvailable) {
+ setValue(KEY_CLIMATE_ENABLE_AVAILABLE, climateEnableAvailable);
+ }
+
+ /**
+ * Gets the climateEnableAvailable portion of the ClimateControlCapabilities class
+ *
+ * @return Boolean - Availability of the control of enable/disable climate control.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getClimateEnableAvailable() {
+ return getBoolean(KEY_CLIMATE_ENABLE_AVAILABLE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
index 4f9a8d09f..365a74044 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlData.java
@@ -52,6 +52,7 @@ public class ClimateControlData extends RPCStruct{
public static final String KEY_HEATED_WIND_SHIELD_ENABLE = "heatedWindshieldEnable";
public static final String KEY_HEATED_REAR_WINDOW_ENABLE = "heatedRearWindowEnable";
public static final String KEY_HEATED_MIRRORS_ENABLE = "heatedMirrorsEnable";
+ public static final String KEY_CLIMATE_ENABLE = "climateEnable";
public ClimateControlData() {
}
@@ -211,4 +212,22 @@ public class ClimateControlData extends RPCStruct{
public Boolean getHeatedMirrorsEnable() {
return getBoolean(KEY_HEATED_MIRRORS_ENABLE);
}
+
+ /**
+ * Sets the climateEnable portion of the ClimateControlData class
+ *
+ * @param climateEnable Value false means disabled, value true means enabled.
+ */
+ public void setClimateEnable(Boolean climateEnable) {
+ setValue(KEY_CLIMATE_ENABLE, climateEnable);
+ }
+
+ /**
+ * Gets the climateEnable portion of the ClimateControlData class
+ *
+ * @return Boolean - Value false means disabled, value true means enabled.
+ */
+ public Boolean getClimateEnable() {
+ return getBoolean(KEY_CLIMATE_ENABLE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplication.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplication.java
new file mode 100644
index 000000000..317302482
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplication.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/10/19 3:55 PM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * Used by an app to set itself to a `HMILevel` of `NONE`. The app will close but will still be registered. If the app is a navigation app it will no longer be used as the preferred mobile-navigation application by the module.
+ */
+public class CloseApplication extends RPCRequest {
+ /**
+ * Constructs a new CloseApplication object
+ */
+ public CloseApplication() {
+ super(FunctionID.CLOSE_APPLICATION.toString());
+ }
+
+ /**
+ * Constructs a new CloseApplication object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CloseApplication(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java
new file mode 100644
index 000000000..be3811759
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CloseApplicationResponse.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by Nicole Yarroch on 7/10/19 3:55 PM
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * Response to the request to close this app on the module.
+ */
+public class CloseApplicationResponse extends RPCResponse {
+ /**
+ * Constructs a new CloseApplicationResponse object
+ */
+ public CloseApplicationResponse() {
+ super(FunctionID.CLOSE_APPLICATION.toString());
+ }
+
+ /**
+ * Constructs a new CloseApplicationResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public CloseApplicationResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CloseApplicationResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CloseApplicationResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
new file mode 100644
index 000000000..d0ac5807c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindow.java
@@ -0,0 +1,163 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+
+import java.util.Hashtable;
+
+/**
+ * The RPC CreateWindow allows an app to create a new window on the display.
+ * The app needs to specify a window ID that is used for window manipulation e.g. with the RPC Show and the window type which can either be MAIN or WIDGET (see sub-section Window types).
+ * @since 6.0
+ */
+public class CreateWindow extends RPCRequest {
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_WINDOW_NAME = "windowName";
+ public static final String KEY_TYPE = "type";
+ public static final String KEY_ASSOCIATED_SERVICE_TYPE = "associatedServiceType";
+ public static final String KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID = "duplicateUpdatesFromWindowID";
+
+ /**
+ * Constructs a new CreateWindow object
+ */
+ public CreateWindow() {
+ super(FunctionID.CREATE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new CreateWindow object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public CreateWindow(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CreateWindow object
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ * @param windowName The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * {@code windowName.length() <= 100}
+ * @param type The type of the window to be created. Main window or widget.
+ */
+ public CreateWindow(@NonNull Integer windowID, @NonNull String windowName, @NonNull WindowType type) {
+ this();
+ setWindowID(windowID);
+ setWindowName(windowName);
+ setType(type);
+ }
+
+ /**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * The value of '0' will always be the default main window on the main display and should
+ * not be used in this context as it will already be created for the app. See PredefinedWindows enum.
+ * Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(@NonNull Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Sets a window name to be used by the HMI.
+ * The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ *
+ * @param windowName The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ * Multiple apps can share the same window name except for the default main window.
+ * {@code windowName.length() <= 100}
+ */
+ public void setWindowName(@NonNull String windowName) {
+ setParameters(KEY_WINDOW_NAME, windowName);
+ }
+
+ /**
+ * Gets a window name to be used by the HMI.
+ *
+ * @return String -a String value representing the window name.
+ */
+ public String getWindowName() {
+ return getString(KEY_WINDOW_NAME);
+ }
+
+ /**
+ * Sets the type of the window to be created. Main window or widget.
+ *
+ * @param type The type of the window to be created. Main window or widget.
+ */
+ public void setType(@NonNull WindowType type) {
+ setParameters(KEY_TYPE, type);
+ }
+
+ /**
+ * Gets a WindowType value
+ *
+ * @return WindowType -a WindowType value
+ */
+ public WindowType getType() {
+ return (WindowType) getObject(WindowType.class, KEY_TYPE);
+ }
+
+ /**
+ * Sets the associatedServiceType. It allows an app to create a widget related to a specific service type.
+ * As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ * Actions such as skip or play/pause will be directed to this active media app. In case of widgets, the system
+ * can provide a single "media" widget which will act as a placeholder for the active media app. It is only allowed
+ * to have one window per service type. This means that a media app can only have a single MEDIA widget. Still the
+ * app can create widgets omitting this parameter. Those widgets would be available as app specific widgets that are
+ * permanently included in the HMI. This parameter is related to widgets only. The default main window, which is
+ * pre-created during app registration, will be created based on the HMI types specified in the app registration request.
+ *
+ * @param associatedServiceType Allows an app to create a widget related to a specific service type.
+ * As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ */
+ public void setAssociatedServiceType(String associatedServiceType) {
+ setParameters(KEY_ASSOCIATED_SERVICE_TYPE, associatedServiceType);
+ }
+
+ /**
+ * Gets the associatedServiceType.
+ *
+ * @return String -a String value representing the associatedServiceType.
+ */
+ public String getAssociatedServiceType() {
+ return getString(KEY_ASSOCIATED_SERVICE_TYPE);
+ }
+
+ /**
+ * Sets the duplicateUpdatesFromWindowID.
+ * Its a Optional parameter. Specify whether the content sent to an existing window
+ * should be duplicated to the created window. If there isn't a window with the ID,
+ * the request will be rejected with `INVALID_DATA`.
+ *
+ * @param duplicateUpdatesFromWindowID Specify whether the content sent to an existing window should be duplicated to the created window.
+ */
+ public void setDuplicateUpdatesFromWindowID(Integer duplicateUpdatesFromWindowID) {
+ setParameters(KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID, duplicateUpdatesFromWindowID);
+ }
+
+ /**
+ * Gets the duplicateUpdatesFromWindowID.
+ *
+ * @return int -an int value representing the duplicateUpdatesFromWindowID.
+ */
+ public Integer getDuplicateUpdatesFromWindowID() {
+ return getInteger(KEY_DUPLICATE_UPDATES_FROM_WINDOW_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
new file mode 100644
index 000000000..733283462
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/CreateWindowResponse.java
@@ -0,0 +1,45 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * This RCP creates a window, by default the main is 0.
+ * @since 6.0
+ */
+public class CreateWindowResponse extends RPCResponse {
+
+ /**
+ * Constructs a new CreateWindowResponse object
+ */
+ public CreateWindowResponse() {
+ super(FunctionID.CREATE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new CreateWindowResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public CreateWindowResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new CreateWindowResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public CreateWindowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
new file mode 100644
index 000000000..3c766deeb
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindow.java
@@ -0,0 +1,65 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * This RPC deletes the window created by the CreateWindow RPC
+ * @see CreateWindow
+ * @since 6.0
+ */
+public class DeleteWindow extends RPCRequest {
+ public static final String KEY_WINDOW_ID = "windowID";
+
+ /**
+ * Constructs a new DeleteWindow object
+ */
+ public DeleteWindow() {
+ super(FunctionID.DELETE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new DeleteWindow object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public DeleteWindow(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new DeleteWindow object
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and cannot be deleted.
+ * See PredefinedWindows enum.
+ */
+ public DeleteWindow(@NonNull Integer windowID) {
+ this();
+ setWindowID(windowID);
+ }
+
+ /**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * The value of '0' will always be the default main window on the main display and cannot be deleted.
+ * See PredefinedWindows enum.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(@NonNull Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
new file mode 100644
index 000000000..d943e860b
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeleteWindowResponse.java
@@ -0,0 +1,46 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * This RPC is the response of the DeleteWindow RPC
+ * @see DeleteWindow
+ * @since 6.0
+ */
+public class DeleteWindowResponse extends RPCResponse {
+
+ /**
+ * Constructs a new DeleteWindowResponse object
+ */
+ public DeleteWindowResponse() {
+ super(FunctionID.DELETE_WINDOW.toString());
+ }
+
+ /**
+ * <p>Constructs a new DeleteWindowResponse object indicated by the Hashtable
+ * parameter</p>
+ *
+ * @param hash The Hashtable to use
+ */
+ public DeleteWindowResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new DeleteWindowResponse object
+ *
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DeleteWindowResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
index bd8c5599c..53b7a32e0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DiagnosticMessageResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -61,19 +61,33 @@ public class DiagnosticMessageResponse extends RPCResponse {
* Constructs a new DiagnosticMessageResponse object
* @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
+ * @deprecated use {@link DiagnosticMessageResponse#DiagnosticMessageResponse(Boolean, Result)}
*/
+ @Deprecated
public DiagnosticMessageResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull List<Integer> messageDataResult) {
this();
setSuccess(success);
setResultCode(resultCode);
setMessageDataResult(messageDataResult);
}
+
+ /**
+ * Constructs a new DiagnosticMessageResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public DiagnosticMessageResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
@SuppressWarnings("unchecked")
public List<Integer> getMessageDataResult() {
return (List<Integer>) getObject(Integer.class, KEY_MESSAGE_DATA_RESULT);
}
- public void setMessageDataResult(@NonNull List<Integer> messageDataResult) {
+ public void setMessageDataResult(List<Integer> messageDataResult) {
setParameters(KEY_MESSAGE_DATA_RESULT, messageDataResult);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
index 32677230b..3d461e2d0 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java
@@ -150,7 +150,7 @@ public class DisplayCapabilities extends RPCStruct {
if(!store.containsKey(KEY_GRAPHIC_SUPPORTED)){
// At some point this was added to the RPC spec as mandatory but at least in v1.0.0
// it was not included.
- store.put(KEY_GRAPHIC_SUPPORTED, new Boolean(false));
+ store.put(KEY_GRAPHIC_SUPPORTED, Boolean.FALSE);
}
}
@@ -270,5 +270,5 @@ public class DisplayCapabilities extends RPCStruct {
@SuppressWarnings("unchecked")
public ScreenParams getScreenParams() {
return (ScreenParams) getObject(ScreenParams.class, KEY_SCREEN_PARAMS);
- }
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
new file mode 100644
index 000000000..992083689
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapability.java
@@ -0,0 +1,89 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * Contain the display related information and all windows related to that display.
+ * @since 6.0
+ */
+public class DisplayCapability extends RPCStruct {
+ public static final String KEY_DISPLAY_NAME = "displayName";
+ public static final String KEY_WINDOW_TYPE_SUPPORTED = "windowTypeSupported";
+ public static final String KEY_WINDOW_CAPABILITIES = "windowCapabilities";
+
+ public DisplayCapability() {
+ }
+
+ public DisplayCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Get the name of the display
+ *
+ * @return the name of the display
+ */
+ public String getDisplayName() {
+ return getString(KEY_DISPLAY_NAME);
+ }
+
+ /**
+ * Set the name of the display
+ * {@code displayName.length() > 1}
+ *
+ * @param displayName the name of the display
+ */
+ public void setDisplayName(String displayName) {
+ setValue(KEY_DISPLAY_NAME, displayName);
+ }
+
+ /**
+ * Sets the windowTypeSupported portion of the DisplayCapability class.
+ * {@code windowTypeSupported.size()>=1}
+ *
+ * @param windowTypeSupported It informs the application how many windows the app is allowed to create per type.
+ */
+ public void setWindowTypeSupported(List<WindowTypeCapabilities> windowTypeSupported) {
+ setValue(KEY_WINDOW_TYPE_SUPPORTED, windowTypeSupported);
+ }
+
+ /**
+ * Gets the windowTypeSupported portion of the DisplayCapability class
+ *
+ * @return List<WindowTypeCapabilities>
+ * It informs the application how many windows the app is allowed to create per type.
+ */
+ @SuppressWarnings("unchecked")
+ public List<WindowTypeCapabilities> getWindowTypeSupported() {
+ return (List<WindowTypeCapabilities>) getObject(WindowTypeCapabilities.class, KEY_WINDOW_TYPE_SUPPORTED);
+ }
+
+ /**
+ * Sets the windowCapabilities portion of the DisplayCapability class.
+ *
+ * @param windowCapabilities Contains a list of capabilities of all windows related to the app.
+ * Once the app has registered the capabilities of all windows are provided.
+ * GetSystemCapability still allows requesting window capabilities of all windows.
+ * After registration, only windows with capabilities changed will be included.
+ * Following cases will cause only affected windows to be included:
+ * 1. App creates a new window. After the window is created, a system capability notification will be sent related only to the created window.
+ * 2. App sets a new template to the window. The new template changes window capabilties. The notification will reflect those changes to the single window.
+ */
+ public void setWindowCapabilities(List<WindowCapability> windowCapabilities) {
+ setValue(KEY_WINDOW_CAPABILITIES, windowCapabilities);
+ }
+
+ /**
+ * Gets the windowCapabilities portion of the DisplayCapability class
+ *
+ * @return List<WindowCapability>
+ * Contains a list of capabilities of all windows related to the app.
+ */
+ @SuppressWarnings("unchecked")
+ public List<WindowCapability> getWindowCapabilities() {
+ return (List<WindowCapability>) getObject(WindowCapability.class, KEY_WINDOW_CAPABILITIES);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
index 40b5af70f..d10c90bf5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GPSData.java
@@ -195,6 +195,7 @@ public class GPSData extends RPCStruct {
public static final String KEY_ALTITUDE = "altitude";
public static final String KEY_HEADING = "heading";
public static final String KEY_SPEED = "speed";
+ public static final String KEY_SHIFTED = "shifted";
/**
* Constructs a newly allocated GPSData object
@@ -521,4 +522,22 @@ public class GPSData extends RPCStruct {
Object object = getValue(KEY_SPEED);
return SdlDataTypeConverter.objectToDouble(object);
}
-}
+
+ /**
+ * Sets the shifted param for GPSData.
+ * @param shifted True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ * False, if the GPS data is raw and un-shifted.
+ * If not provided, then value is assumed False.
+ */
+ public void setShifted(Boolean shifted) {
+ setValue(KEY_SHIFTED, shifted);
+ }
+
+ /**
+ * Gets the shifted param for GPSData.
+ * @return Boolean - True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ */
+ public Boolean getShifted() {
+ return getBoolean(KEY_SHIFTED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
index be970cc39..a0de6de5c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetDTCsResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -63,7 +63,9 @@ public class GetDTCsResponse extends RPCResponse{
* @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
* @param ecuHeader representation of the ecu header that was returned from the GetDTC request
+ * @deprecated use {@link GetDTCsResponse#GetDTCsResponse(Boolean, Result)}
*/
+ @Deprecated
public GetDTCsResponse(@NonNull Boolean success, @NonNull Result resultCode, @NonNull Integer ecuHeader) {
this();
setSuccess(success);
@@ -71,6 +73,17 @@ public class GetDTCsResponse extends RPCResponse{
setEcuHeader(ecuHeader);
}
+ /**
+ * Constructs a new GetDTCsResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public GetDTCsResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
@SuppressWarnings("unchecked")
public List<String> getDtc(){
return (List<String>) getObject(String.class, KEY_DTC);
@@ -84,7 +97,7 @@ public class GetDTCsResponse extends RPCResponse{
return getInteger(KEY_ECU_HEADER);
}
- public void setEcuHeader(@NonNull Integer ecuHeader){
+ public void setEcuHeader(Integer ecuHeader){
setParameters(KEY_ECU_HEADER, ecuHeader);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
index fecf4463f..a2999ae3b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleData.java
@@ -49,6 +49,7 @@ import java.util.Hashtable;
public class GetInteriorVehicleData extends RPCRequest {
public static final String KEY_MODULE_TYPE = "moduleType";
public static final String KEY_SUBSCRIBE = "subscribe";
+ public static final String KEY_MODULE_ID = "moduleId";
/**
* Constructs a new GetInteriorVehicleData object
@@ -118,4 +119,20 @@ public class GetInteriorVehicleData extends RPCRequest {
public Boolean getSubscribe() {
return getBoolean(KEY_SUBSCRIBE);
}
+
+ /**
+ * Sets the Module ID for this class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of this class
+ * @return the Module ID of this class
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
new file mode 100644
index 000000000..fd53bedf2
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsent.java
@@ -0,0 +1,66 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsent extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleIds";
+
+ public GetInteriorVehicleDataConsent() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsent(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * @param moduleType Sets the Module Type for this class
+ * @param moduleIds Sets the Module Ids for this class
+ */
+ public GetInteriorVehicleDataConsent(@NonNull ModuleType moduleType, @NonNull List<String> moduleIds){
+ this();
+ setModuleType(moduleType);
+ setModuleIds(moduleIds);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(@NonNull ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param ids the ids to be set
+ */
+ public void setModuleIds(@NonNull List<String> ids) {
+ setParameters(KEY_MODULE_ID, ids);
+ }
+
+ /**
+ * Gets the Module Ids of this class
+ * @return the Module Ids
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getModuleIds() {
+ return (List<String>) getObject(String.class, KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
new file mode 100644
index 000000000..684eba292
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataConsentResponse.java
@@ -0,0 +1,46 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class GetInteriorVehicleDataConsentResponse extends RPCResponse {
+
+ public static final String KEY_ALLOWED = "allowed";
+
+ public GetInteriorVehicleDataConsentResponse() {
+ super(FunctionID.GET_INTERIOR_VEHICLE_DATA_CONSENT.toString());
+ }
+
+ public GetInteriorVehicleDataConsentResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public GetInteriorVehicleDataConsentResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+
+ /**
+ * Sets the list of allowances for this class
+ * @param allowances the allowances to be set
+ */
+ public void setAllowances(@NonNull List<Boolean> allowances) {
+ setParameters(KEY_ALLOWED, allowances);
+ }
+
+ /**
+ * Gets the list of allowances of this class
+ * @return the list of allowances of this class
+ */
+ @SuppressWarnings("unchecked")
+ public List<Boolean> getAllowances() {
+ return (List<Boolean>) getObject(Boolean.class, KEY_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
index 6c27b8b37..7a85ac129 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetInteriorVehicleDataResponse.java
@@ -67,9 +67,10 @@ public class GetInteriorVehicleDataResponse extends RPCResponse {
* @param moduleData specific data for the module that was requested
* @param resultCode whether the request is successfully processed
* @param success whether the request is successfully processed
-
+ * @deprecated use {@link GetInteriorVehicleDataResponse#GetInteriorVehicleDataResponse(Result, Boolean)}
*/
- public GetInteriorVehicleDataResponse( @NonNull ModuleData moduleData, @NonNull Result resultCode, @NonNull Boolean success) {
+ @Deprecated
+ public GetInteriorVehicleDataResponse(@NonNull ModuleData moduleData, @NonNull Result resultCode, @NonNull Boolean success) {
this();
setModuleData(moduleData);
setResultCode(resultCode);
@@ -77,6 +78,17 @@ public class GetInteriorVehicleDataResponse extends RPCResponse {
}
/**
+ * Constructs a new GetInteriorVehicleDataResponse object
+ * @param resultCode whether the request is successfully processed
+ * @param success whether the request is successfully processed
+ */
+ public GetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
* Gets the moduleData
*
* @return ModuleData
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
index 8029e77e2..f324de95f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetSystemCapabilityResponse.java
@@ -69,7 +69,9 @@ public class GetSystemCapabilityResponse extends RPCResponse {
* @param systemCapability SystemCapability object
* @param resultCode whether the request is successfully processed
* @param success whether the request is successfully processed
+ * @deprecated use {@link GetSystemCapabilityResponse#GetSystemCapabilityResponse(Result, Boolean)}
*/
+ @Deprecated
public GetSystemCapabilityResponse(@NonNull SystemCapability systemCapability, @NonNull Result resultCode, @NonNull Boolean success) {
this();
setSystemCapability(systemCapability);
@@ -78,6 +80,17 @@ public class GetSystemCapabilityResponse extends RPCResponse {
}
/**
+ * Constructs a new GetSystemCapabilityResponse object
+ * @param resultCode whether the request is successfully processed
+ * @param success whether the request is successfully processed
+ */
+ public GetSystemCapabilityResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
* Get the SystemCapability object returned after a GetSystemCapability call
* @return SystemCapability object
*/
@@ -89,7 +102,7 @@ public class GetSystemCapabilityResponse extends RPCResponse {
* Set a SystemCapability object in the response
* @param value SystemCapability object
*/
- public void setSystemCapability(@NonNull SystemCapability value){
+ public void setSystemCapability(SystemCapability value){
setParameters(KEY_SYSTEM_CAPABILITY, value);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
index d8c9d7077..0f4e70f9b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleData.java
@@ -540,4 +540,21 @@ public class GetVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
index db09d86e5..60b3b7cc4 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/GetVehicleDataResponse.java
@@ -372,4 +372,22 @@ public class GetVehicleDataResponse extends RPCResponse {
public String getCloudAppVehicleID(){
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleData value for the vehicle data item.
+ * @return a Object related to the vehicle data
+ */
+ public Object getOEMCustomVehicleData(String vehicleDataName){
+ return getParameters(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
new file mode 100644
index 000000000..2aced1a6f
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Grid.java
@@ -0,0 +1,133 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a location (origin coordinates and span) of a vehicle component (Module)
+ */
+
+public class Grid extends RPCStruct {
+ public static final String KEY_COL = "col";
+ public static final String KEY_ROW = "row";
+ public static final String KEY_LEVEL = "level";
+ public static final String KEY_COL_SPAN = "colspan";
+ public static final String KEY_ROW_SPAN = "rowspan";
+ public static final String KEY_LEVEL_SPAN = "levelspan";
+
+ public Grid() {}
+
+ public Grid(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Struct that describes a location (origin coordinates and span) of a vehicle component (Module)
+ * @param row Sets the row's value of this Grid
+ * @param column Sets the column of this Grid
+ */
+ public Grid(@NonNull Integer row, @NonNull Integer column){
+ this();
+ setRow(row);
+ setCol(column);
+ }
+
+ /**
+ * Sets the column of this Grid
+ * @param col the column to be set
+ */
+ public void setCol(@NonNull Integer col) {
+ setValue(KEY_COL, col);
+ }
+
+ /**
+ * Get the column value of this Grid
+ * @return the column value
+ */
+ public Integer getCol() {
+ return getInteger(KEY_COL);
+ }
+
+ /**
+ * Sets the row's value of this Grid
+ * @param row the row to be set
+ */
+ public void setRow(@NonNull Integer row) {
+ setValue(KEY_ROW, row);
+ }
+
+ /**
+ * Gets the row value of this Grid
+ * @return the row value
+ */
+ public Integer getRow() {
+ return getInteger(KEY_ROW);
+ }
+
+ /**
+ * Sets the level value of this Grid
+ * @param level the level to be set
+ */
+ public void setLevel(Integer level) {
+ setValue(KEY_LEVEL, level);
+ }
+
+ /**
+ * Gets the level value of this Grid
+ * @return the level
+ */
+ public Integer getLevel() {
+ return getInteger(KEY_LEVEL);
+ }
+
+ /**
+ * Sets the column span of this Grid
+ * @param span the span to be set
+ */
+ public void setColSpan(Integer span) {
+ setValue(KEY_COL_SPAN, span);
+ }
+
+ /**
+ * Gets the column span of this Grid
+ * @return the column span
+ */
+ public Integer getColSpan() {
+ return getInteger(KEY_COL_SPAN);
+ }
+
+ /**
+ * Sets the row span of this Grid
+ * @param span the span to be set
+ */
+ public void setRowSpan(Integer span) {
+ setValue(KEY_ROW_SPAN, span);
+ }
+
+ /**
+ * Gets the row span of this Grid
+ * @return the row span
+ */
+ public Integer getRowSpan() {
+ return getInteger(KEY_ROW_SPAN);
+ }
+
+ /**
+ * Sets the level span of this Grid
+ * @param span the span to be set
+ */
+ public void setLevelSpan(Integer span) {
+ setValue(KEY_LEVEL_SPAN, span);
+ }
+
+ /**
+ * Gets the level span of this Grid
+ * @return the level span
+ */
+ public Integer getLevelSpan() {
+ return getInteger(KEY_LEVEL_SPAN);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
index 7b772c822..d7a8c9001 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java
@@ -40,6 +40,9 @@ public class HMICapabilities extends RPCStruct{
public static final String KEY_PHONE_CALL = "phoneCall";
public static final String KEY_VIDEO_STREAMING = "videoStreaming";
public static final String KEY_REMOTE_CONTROL = "remoteControl";
+ public static final String KEY_APP_SERVICES = "appServices";
+ public static final String KEY_DISPLAYS = "displays";
+ public static final String KEY_SEAT_LOCATION = "seatLocation";
public HMICapabilities() { }
@@ -95,5 +98,40 @@ public class HMICapabilities extends RPCStruct{
setValue(KEY_REMOTE_CONTROL, available);
}
+ public boolean isAppServicesAvailable(){
+ Object available = getValue(KEY_APP_SERVICES);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setAppServicesAvailable(Boolean available){
+ setValue(KEY_APP_SERVICES, available);
+ }
+
+ public boolean isDisplaysCapabilityAvailable(){
+ Object available = getValue(KEY_DISPLAYS);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setDisplaysCapabilityAvailable(Boolean available){
+ setValue(KEY_DISPLAYS, available);
+ }
+
+ public boolean isSeatLocationAvailable(){
+ Object available = getValue(KEY_SEAT_LOCATION);
+ if(available == null){
+ return false;
+ }
+ return (Boolean)available;
+ }
+
+ public void setSeatLocationAvailable(Boolean available){
+ setValue(KEY_SEAT_LOCATION, available);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
index 80b030ad2..c9a7d690f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/HMISettingsControlCapabilities.java
@@ -42,6 +42,7 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public static final String KEY_DISTANCE_UNIT_AVAILABLE = "distanceUnitAvailable";
public static final String KEY_TEMPERATURE_UNIT_AVAILABLE = "temperatureUnitAvailable";
public static final String KEY_DISPLAY_MODE_UNIT_AVAILABLE = "displayModeUnitAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new HMISettingsControlCapabilities object
@@ -135,4 +136,20 @@ public class HMISettingsControlCapabilities extends RPCStruct {
public Boolean getDisplayModeUnitAvailable() {
return getBoolean(KEY_DISPLAY_MODE_UNIT_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
index 1e6f25c24..32e9a46fc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ImageResolution.java
@@ -95,16 +95,32 @@ public class ImageResolution extends RPCStruct {
setResolutionWidth(resolutionWidth);
setResolutionHeight(resolutionHeight);
}
-
+
+ /**
+ * @param resolutionWidth the desired resolution width. Odds values cause problems in
+ * the Android H264 decoder, as a workaround the odd value is
+ * converted to a pair value.
+ */
public void setResolutionWidth(@NonNull Integer resolutionWidth) {
+ if(resolutionWidth != null && resolutionWidth % 2 != 0) {
+ resolutionWidth++;
+ }
setValue(KEY_RESOLUTION_WIDTH, resolutionWidth);
}
public Integer getResolutionWidth() {
return getInteger(KEY_RESOLUTION_WIDTH);
}
-
+
+ /**
+ * @param resolutionHeight the desired resolution height. Odds values cause problems in
+ * the Android H264 decoder, as a workaround the odd value is
+ * converted to a pair value.
+ */
public void setResolutionHeight(@NonNull Integer resolutionHeight) {
+ if(resolutionHeight != null && resolutionHeight % 2 != 0) {
+ resolutionHeight++;
+ }
setValue(KEY_RESOLUTION_HEIGHT, resolutionHeight);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
index 6ceada6a5..cd721fec8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/KeyboardProperties.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
@@ -93,6 +93,13 @@ import java.util.List;
* <td>maxlength = 1000 </td>
* <td>Allows an app to prepopulate the text field with a suggested or completed entry as the user types.</td>
* </tr>
+ * <tr>
+ * <td>autoCompleteList</td>
+ * <td>String</td>
+ * <td>false</td>
+ * <td>Array = true maxlength = 1000 minsize = 0 maxsize = 100</td>
+ * <td>Allows an app to prepopulate the text field with a list of suggested or completed entry as the user types. Set to an empty array to remove the auto-complete list from the screen</td>
+ * </tr>
* </table>
*
* @since SmartDeviceLink 3.0
@@ -103,7 +110,8 @@ public class KeyboardProperties extends RPCStruct {
public static final String KEY_KEYPRESS_MODE = "keypressMode";
public static final String KEY_KEYBOARD_LAYOUT = "keyboardLayout";
public static final String KEY_LIMITED_CHARACTER_LIST = "limitedCharacterList";
- public static final String KEY_AUTO_COMPLETE_TEXT = "autoCompleteText";
+ @Deprecated public static final String KEY_AUTO_COMPLETE_TEXT = "autoCompleteText";
+ public static final String KEY_AUTO_COMPLETE_LIST = "autoCompleteList";
public static final String KEY_LANGUAGE = "language";
private static final KeypressMode KEYPRESS_MODE_DEFAULT = KeypressMode.RESEND_CURRENT_ENTRY;
@@ -160,11 +168,40 @@ public class KeyboardProperties extends RPCStruct {
setValue(KEY_LIMITED_CHARACTER_LIST, limitedCharacterList);
}
+ /**
+ * Gets the text that allows an app to prepopulate the text field with a suggested entry as the user types
+ * @return String representing the suggestions text
+ */
+ @Deprecated
public String getAutoCompleteText() {
return (String) getObject(String.class, KEY_AUTO_COMPLETE_TEXT);
}
+ /**
+ * Sets the text that allows an app to prepopulate the text field with a suggested entry as the user types
+ * @param autoCompleteText String representing the suggestions text
+ * @deprecated use {@link #setAutoCompleteList(List<String>)} instead
+ */
+ @Deprecated // Note: removing autoCompleteText setter will leave no way to provide auto complete suggestions on old head units that don't support autoCompleteList
public void setAutoCompleteText(String autoCompleteText) {
setValue(KEY_AUTO_COMPLETE_TEXT, autoCompleteText);
}
+
+ /**
+ * Gets the list that allows an app to prepopulate the text field with a list of suggested or
+ * completed entries as the user types.
+ * @return List<String> representing the suggestions list
+ */
+ public List<String> getAutoCompleteList() {
+ return (List<String>) getObject(String.class, KEY_AUTO_COMPLETE_LIST);
+ }
+
+ /**
+ * Sets the lists that allows an app to prepopulate the text field with a list of suggested or
+ * completed entries as the user types. Set to an empty array to remove the auto-complete list from the screen
+ * @param autoCompleteList List<String> representing the suggestions list
+ */
+ public void setAutoCompleteList(List<String> autoCompleteList) {
+ setValue(KEY_AUTO_COMPLETE_LIST, autoCompleteList);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
index 2c1e63455..a3b66467c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/LightControlCapabilities.java
@@ -41,6 +41,7 @@ import java.util.List;
public class LightControlCapabilities extends RPCStruct {
public static final String KEY_MODULE_NAME = "moduleName";
public static final String KEY_SUPPORTED_LIGHTS = "supportedLights";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new LightControlCapabilities object
@@ -106,4 +107,20 @@ public class LightControlCapabilities extends RPCStruct {
public void setSupportedLights(@NonNull List<LightCapabilities> supportedLights) {
setValue(KEY_SUPPORTED_LIGHTS, supportedLights);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
index cdd5d21a4..16065f669 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/MediaServiceData.java
@@ -45,6 +45,7 @@ public class MediaServiceData extends RPCStruct {
public static final String KEY_MEDIA_TITLE = "mediaTitle";
public static final String KEY_MEDIA_ARTIST = "mediaArtist";
public static final String KEY_MEDIA_ALBUM = "mediaAlbum";
+ public static final String KEY_MEDIA_IMAGE = "mediaImage";
public static final String KEY_PLAYLIST_NAME = "playlistName";
public static final String KEY_IS_EXPLICIT = "isExplicit";
public static final String KEY_TRACK_PLAYBACK_PROGRESS = "trackPlaybackProgress";
@@ -139,6 +140,27 @@ public class MediaServiceData extends RPCStruct {
}
/**
+ * Sets the media image associated with the currently playing media
+ * Music: The album art of the current track
+ * Podcast: The podcast or chapter artwork of the current podcast episode
+ * Audiobook: The book or chapter artwork of the current audiobook
+ * @param mediaImage
+ */
+ public void setMediaImage(Image mediaImage){
+ setValue(KEY_MEDIA_IMAGE, mediaImage);
+ }
+
+ /**
+ * Returns the media image associated with the currently playing media
+ * Music: The album art of the current track
+ * Podcast: The podcast or chapter artwork of the current podcast episode
+ * Audiobook: The book or chapter artwork of the current audiobook
+ */
+ public Image getMediaImage(){
+ return (Image) getObject(Image.class, KEY_MEDIA_IMAGE);
+ }
+
+ /**
* Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
* Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
* Audiobook: Likely not applicable, possibly a collection or "playlist" of books
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
index 8f11dc556..26cf08684 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleData.java
@@ -46,6 +46,7 @@ public class ModuleData extends RPCStruct {
public static final String KEY_AUDIO_CONTROL_DATA = "audioControlData";
public static final String KEY_LIGHT_CONTROL_DATA = "lightControlData";
public static final String KEY_HMI_SETTINGS_CONTROL_DATA = "hmiSettingsControlData";
+ public static final String KEY_MODULE_ID = "moduleId";
public ModuleData() {
}
@@ -186,4 +187,20 @@ public class ModuleData extends RPCStruct {
public HMISettingsControlData getHmiSettingsControlData() {
return (HMISettingsControlData) getObject(HMISettingsControlData.class, KEY_HMI_SETTINGS_CONTROL_DATA);
}
+
+ /**
+ * Sets the Module ID of the ModuleData class
+ * @param id the id to be set
+ */
+ public void setModuleId(String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID of the ModuleData class
+ * @return the Module ID
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
new file mode 100644
index 000000000..fd7be795f
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ModuleInfo.java
@@ -0,0 +1,96 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Struct that describes a module within different SystemCapabilities
+ */
+public class ModuleInfo extends RPCStruct {
+ public static final String KEY_MODULE_ID = "moduleId";
+ public static final String KEY_MODULE_LOCATION = "location";
+ public static final String KEY_MODULE_SERVICE_AREA = "serviceArea";
+ public static final String KEY_MULTIPLE_ACCESS_ALLOWED = "allowMultipleAccess";
+
+ public ModuleInfo(){}
+
+ public ModuleInfo(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Struct that describes a module within different SystemCapabilities
+ * @param moduleId Sets the Module ID for this Module
+ */
+ public ModuleInfo(@NonNull String moduleId){
+ this();
+ setModuleId(moduleId);
+ }
+
+ /**
+ * Sets the Module ID for this Module
+ * @param id the id to be set
+ */
+ public void setModuleId(@NonNull String id) {
+ setValue(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module ID for this module
+ * @return the Module ID as a String
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+
+ /**
+ * Sets the location of this Module
+ * @param location the location to be set
+ */
+ public void setModuleLocation(Grid location) {
+ setValue(KEY_MODULE_LOCATION, location);
+ }
+
+ /**
+ * Gets the location of this Module
+ * @return the location of this Module
+ */
+ public Grid getModuleLocation() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_LOCATION);
+ }
+
+ /**
+ * Sets the service area of this Module
+ * @param serviceArea the service area of this Module
+ */
+ public void setModuleServiceArea(Grid serviceArea) {
+ setValue(KEY_MODULE_SERVICE_AREA, serviceArea);
+ }
+
+ /**
+ * Gets the service area of this Module
+ * @return the service area of this Module
+ */
+ public Grid getModuleServiceArea() {
+ return (Grid) getObject(Grid.class, KEY_MODULE_SERVICE_AREA);
+ }
+
+ /**
+ * Sets the multiple access allowance for this Module
+ * @param isMultipleAccess the access to be set
+ */
+ public void setMultipleAccessAllowance(Boolean isMultipleAccess) {
+ setValue(KEY_MULTIPLE_ACCESS_ALLOWED, isMultipleAccess);
+ }
+
+ /**
+ * Gets the multiple allowance access of this Module
+ * @return the multiple access allowance of this Module
+ */
+ public Boolean getMultipleAccessAllowance() {
+ return getBoolean(KEY_MULTIPLE_ACCESS_ALLOWED);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
index e4efe5e13..f6a328dcf 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnDriverDistraction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -73,6 +73,8 @@ import java.util.Hashtable;
*/
public class OnDriverDistraction extends RPCNotification {
public static final String KEY_STATE = "state";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE = "lockScreenDismissalEnabled";
+ public static final String KEY_LOCKSCREEN_DISMISSIBLE_MSG = "lockScreenDismissalWarning";
/**
*Constructs a newly allocated OnDriverDistraction object
*/
@@ -107,5 +109,37 @@ public class OnDriverDistraction extends RPCNotification {
*/
public void setState( @NonNull DriverDistractionState state ) {
setParameters(KEY_STATE, state);
- }
+ }
+
+ /**
+ * <p>Called to set dismissible state of Lockscreen</p>
+ * @param isDismissible the Lockscreen's dismissibility
+ */
+ public void setLockscreenDismissibility(boolean isDismissible) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE, isDismissible);
+ }
+
+ /**
+ * <p>Called to get the dismissible state of Lockscreen</p>
+ * @return true if the Lockscreen is dismissible, false otherwise
+ */
+ public Boolean getLockscreenDismissibility() {
+ return (Boolean) getObject(Boolean.class, KEY_LOCKSCREEN_DISMISSIBLE);
+ }
+
+ /**
+ * Called to set a warning message for the lockscreen
+ * @param msg the message to be set
+ */
+ public void setLockscreenWarningMessage(String msg) {
+ setParameters(KEY_LOCKSCREEN_DISMISSIBLE_MSG, msg);
+ }
+
+ /**
+ * Called to get the lockscreen warning message
+ * @return warning message
+ */
+ public String getLockscreenWarningMessage() {
+ return (String) getObject(String.class, KEY_LOCKSCREEN_DISMISSIBLE_MSG);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
index 8f98d65a8..9970eb66a 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnHMIStatus.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -107,6 +107,7 @@ public class OnHMIStatus extends RPCNotification {
public static final String KEY_VIDEO_STREAMING_STATE = "videoStreamingState";
public static final String KEY_SYSTEM_CONTEXT = "systemContext";
public static final String KEY_HMI_LEVEL = "hmiLevel";
+ public static final String KEY_WINDOW_ID = "windowID";
private Boolean firstRun;
@@ -218,4 +219,22 @@ public class OnHMIStatus extends RPCNotification {
public void setFirstRun(Boolean firstRun) {
this.firstRun = firstRun;
}
+ /**
+ * <p>Set the windowID value</p>
+ * @param windowID This is the unique ID assigned to the window that this RPC is intended.
+ * If this param is not included, it will be assumed that this request is specifically for the main window on the main display.
+ * See PredefinedWindows enum.
+ * @since 6.0
+ */
+ public void setWindowID(Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+ /**
+ * <p>Get the windowID value</p>
+ * @return Integer This is the unique ID assigned to the window that this RPC is intended.
+ * @since 6.0
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
index 10078a707..2fd2b1221 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnKeyboardInput.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -124,8 +124,7 @@ public class OnKeyboardInput extends RPCNotification {
@Override
public String toString(){
- String result = this.getFunctionName() +": " + " data: " + this.getData() + " event:" + this.getEvent().toString();
- return result;
+ return this.getFunctionName() +": " + " data: " + this.getData() + " event:" + this.getEvent().toString();
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
index 4f5845e4a..7a9532e36 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnPermissionsChange.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -82,6 +82,7 @@ import java.util.List;
*/
public class OnPermissionsChange extends RPCNotification {
public static final String KEY_PERMISSION_ITEM = "permissionItem";
+ public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
/**
*Constructs a newly allocated OnCommand object
*/
@@ -118,4 +119,20 @@ public class OnPermissionsChange extends RPCNotification {
public void setPermissionItem(@NonNull List<PermissionItem> permissionItem) {
setParameters(KEY_PERMISSION_ITEM, permissionItem);
}
+
+ /**
+ * Returns the encryption requirement for this permission change
+ * @return true if encryption is required, false otherwise
+ */
+ public Boolean getRequireEncryption() {
+ return getBoolean(KEY_REQUIRE_ENCRYPTION);
+ }
+
+ /**
+ * Sets the encryption requirement for this permission change
+ * @param isRequired the boolean requirement to be set
+ */
+ public void setRequireEncryption(Boolean isRequired) {
+ setParameters(KEY_REQUIRE_ENCRYPTION, isRequired);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
index 45dba173c..3dea74d1d 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/OnVehicleData.java
@@ -582,4 +582,21 @@ public class OnVehicleData extends RPCNotification {
public String getCloudAppVehicleID(){
return getString(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Object vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleData value for the vehicle data item.
+ * @return a Object related to the vehicle data
+ */
+ public Object getOEMCustomVehicleData(String vehicleDataName){
+ return getParameters(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
index 12be13e9f..5e253e540 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PerformInteraction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -47,7 +47,9 @@ import java.util.List;
* application may use a PerformInteraction to ask a user to say the name of a
* song to play. The user's response is only valid if it appears in the
* specified Choice Sets and is recognized by SDL
- * <p></p>
+ *
+ * If connecting to SDL Core v.6.0+, the perform interaction can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the perform interaction will persist until the user has interacted with the perform interaction or the specified timeout has elapsed.
+ *
* <p>Function Group: Base</p>
*
* <p><b>HMILevel needs to be FULL</b></p>
@@ -134,6 +136,14 @@ import java.util.List;
* <td></td>
* <td>SmartDeviceLink 3.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*
*
@@ -151,6 +161,8 @@ public class PerformInteraction extends RPCRequest {
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new PerformInteraction object
*/
@@ -168,10 +180,10 @@ public class PerformInteraction extends RPCRequest {
}
/**
* Constructs a new PerformInteraction object
- * @param initialText a String value that Displayed when the interaction begins
+ * @param initialText a String value that is displayed when the interaction begins
* @param interactionMode indicate how user selects interaction choice (VR_ONLY, MANUAL_ONLY or BOTH)
* @param interactionChoiceSetIDList a List<Integer> representing an Array of one or more Choice Set IDs. User can select any choice from any of the specified
- * Choice Sets <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000
+ * Choice Sets <b>Notes: </b>Min Value: 0; Max Value: 2000000000
*/
public PerformInteraction(@NonNull String initialText, @NonNull InteractionMode interactionMode, @NonNull List<Integer> interactionChoiceSetIDList) {
this();
@@ -361,8 +373,7 @@ public class PerformInteraction extends RPCRequest {
}
/**
- * Gets a Voice recognition Help, which is a suggested VR Help Items to
- * display on-screen during Perform Interaction
+ * Gets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
*
* @return List<VrHelpItem> -a List value representing a suggested VR
* Help Items to display on-screen during Perform Interaction
@@ -374,7 +385,8 @@ public class PerformInteraction extends RPCRequest {
}
/**
- *
+ * Sets a Voice Recognition Help list, which is a list of suggested VR Help Items to display on-screen during a Perform Interaction
+ *
* @param vrHelp
* a List representing a suggested VR Help Items to display
* on-screen during Perform Interaction
@@ -387,12 +399,48 @@ public class PerformInteraction extends RPCRequest {
public void setVrHelp(List<VrHelpItem> vrHelp) {
setParameters(KEY_VR_HELP, vrHelp);
}
-
- public LayoutMode getInteractionLayout() {
+
+ /**
+ * Gets the layout mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @return LayoutMode - The interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public LayoutMode getInteractionLayout() {
return (LayoutMode) getObject(LayoutMode.class, KEY_INTERACTION_LAYOUT);
}
-
- public void setInteractionLayout( LayoutMode interactionLayout ) {
+
+ /**
+ * Sets the mode of how the choices are presented. For touchscreen interactions only.
+ *
+ * @param interactionLayout A LayoutMode representing the interaction layout mode
+ *
+ * @since SmartDeviceLink 3.0
+ */
+ public void setInteractionLayout(LayoutMode interactionLayout ) {
setParameters(KEY_INTERACTION_LAYOUT, interactionLayout);
- }
+ }
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific perform interaction to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
index 7b5801b96..63d9624f7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PermissionItem.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
@@ -83,6 +83,7 @@ public class PermissionItem extends RPCStruct {
public static final String KEY_RPC_NAME = "rpcName";
public static final String KEY_HMI_PERMISSIONS = "hmiPermissions";
public static final String KEY_PARAMETER_PERMISSIONS = "parameterPermissions";
+ public static final String KEY_REQUIRE_ENCRYPTION = "requireEncryption";
/**
* Constructs a new PermissionItem object
*/
@@ -125,4 +126,20 @@ public class PermissionItem extends RPCStruct {
public void setParameterPermissions(@NonNull ParameterPermissions parameterPermissions) {
setValue(KEY_PARAMETER_PERMISSIONS, parameterPermissions);
}
+
+ /**
+ * Gets the encryption requirement for this item
+ * @return true is encryption is required, false otherwise
+ */
+ public Boolean getRequireEncryption() {
+ return (Boolean) getValue(KEY_REQUIRE_ENCRYPTION);
+ }
+
+ /**
+ * Sets the encryption requirement for this item
+ * @param isRequired the boolean requirement to be set
+ */
+ public void setRequireEncryption(Boolean isRequired) {
+ setValue(KEY_REQUIRE_ENCRYPTION, isRequired);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
index 383d22430..35587c289 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/PublishAppService.java
@@ -39,7 +39,8 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
/**
- * Registers a service offered by this app on the module
+ * Registers a service offered by this app on the module.
+ * Subsequent calls with the same service type will update the manifest for that service.
*/
public class PublishAppService extends RPCRequest {
@@ -75,6 +76,7 @@ public class PublishAppService extends RPCRequest {
/**
* The manifest of the service that wishes to be published.
+ * If already published, the updated manifest for this service.
* @param serviceManifest - the App Service Manifest
*/
public void setAppServiceManifest(@NonNull AppServiceManifest serviceManifest){
@@ -83,6 +85,7 @@ public class PublishAppService extends RPCRequest {
/**
* The manifest of the service that wishes to be published.
+ * If already published, the updated manifest for this service.
* @return serviceManifest - the App Service Manifest
*/
public AppServiceManifest getAppServiceManifest(){
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
index da987e48a..22d1d892e 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlCapabilities.java
@@ -54,6 +54,8 @@ public class RadioControlCapabilities extends RPCStruct{
public static final String KEY_HD_RADIO_ENABLE_AVAILABLE = "hdRadioEnableAvailable";
public static final String KEY_SIRIUS_XM_RADIO_AVAILABLE = "siriusxmRadioAvailable";
public static final String KEY_SIS_DATA_AVAILABLE = "sisDataAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
+ public static final String KEY_AVAILABLE_HD_CHANNELS_AVAILABLE = "availableHdChannelsAvailable";
public RadioControlCapabilities() {
}
@@ -204,6 +206,7 @@ public class RadioControlCapabilities extends RPCStruct{
* Availability of the getting the number of available HD channels.
* True: Available, False: Not Available, Not present: Not Available.
*/
+ @Deprecated
public void setAvailableHDsAvailable(Boolean availableHDsAvailable) {
setValue(KEY_AVAILABLE_HDS_AVAILABLE, availableHDsAvailable);
}
@@ -214,11 +217,33 @@ public class RadioControlCapabilities extends RPCStruct{
* @return Boolean - Availability of the getting the number of available HD channels.
* True: Available, False: Not Available, Not present: Not Available.
*/
+ @Deprecated
public Boolean getAvailableHDsAvailable() {
return getBoolean(KEY_AVAILABLE_HDS_AVAILABLE);
}
/**
+ * Sets the availableHdChannelsAvailable portion of the RadioControlCapabilities class
+ *
+ * @param availableHdChannelsAvailable
+ * Availability of the list of available HD sub-channel indexes.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public void setAvailableHdChannelsAvailable(Boolean availableHdChannelsAvailable) {
+ setValue(KEY_AVAILABLE_HD_CHANNELS_AVAILABLE, availableHdChannelsAvailable);
+ }
+
+ /**
+ * Gets the availableHdChannelsAvailable portion of the RadioControlCapabilities class
+ *
+ * @return Boolean - Availability of the list of available HD sub-channel indexes.
+ * True: Available, False: Not Available, Not present: Not Available.
+ */
+ public Boolean getAvailableHdChannelsAvailable() {
+ return getBoolean(KEY_AVAILABLE_HD_CHANNELS_AVAILABLE);
+ }
+
+ /**
* Sets the stateAvailable portion of the RadioControlCapabilities class
*
* @param stateAvailable
@@ -340,4 +365,20 @@ public class RadioControlCapabilities extends RPCStruct{
public Boolean getSisDataAvailable() {
return getBoolean(KEY_SIS_DATA_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
index 8fbd001fb..4de584a9f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RadioControlData.java
@@ -36,6 +36,7 @@ import com.smartdevicelink.proxy.rpc.enums.RadioBand;
import com.smartdevicelink.proxy.rpc.enums.RadioState;
import java.util.Hashtable;
+import java.util.List;
/**
* Include information (both read-only and changeable data) about a
@@ -54,6 +55,7 @@ public class RadioControlData extends RPCStruct{
public static final String KEY_STATE= "state";
public static final String KEY_HD_RADIO_ENABLE = "hdRadioEnable";
public static final String KEY_SIS_DATA = "sisData";
+ public static final String KEY_AVAILABLE_HD_CHANNELS= "availableHdChannels";
public RadioControlData() {
}
@@ -144,6 +146,7 @@ public class RadioControlData extends RPCStruct{
* @param availableHDs
* Number of HD sub-channels if available.
*/
+ @Deprecated
public void setAvailableHDs(Integer availableHDs) {
setValue(KEY_AVAILABLE_HDS, availableHDs);
}
@@ -153,6 +156,7 @@ public class RadioControlData extends RPCStruct{
*
* @return Integer - Number of HD sub-channels if available.
*/
+ @Deprecated
public Integer getAvailableHDs() {
return getInteger(KEY_AVAILABLE_HDS);
}
@@ -290,4 +294,23 @@ public class RadioControlData extends RPCStruct{
public SisData getSisData() {
return (SisData) getObject(SisData.class, KEY_SIS_DATA);
}
+
+ /**
+ * Sets the availableHdChannels portion of the RadioControlData class
+ *
+ * @param availableHdChannels List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
+ */
+ public void setAvailableHdChannels(List<Integer> availableHdChannels){
+ setValue(KEY_AVAILABLE_HD_CHANNELS, availableHdChannels);
+ }
+
+ /**
+ * Gets the availableHdChannels portion of the RadioControlData class
+ *
+ * @return List<Integer> - List of available hd sub-channel indexes, empty list means no Hd channel is available, read-only.
+ */
+ @SuppressWarnings("unchecked")
+ public List<Integer> getAvailableHdChannels(){
+ return (List<Integer>) getObject(Integer.class,KEY_AVAILABLE_HD_CHANNELS);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
index a2e2ef646..ca37339be 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/RegisterAppInterfaceResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -216,6 +216,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return DisplayCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public DisplayCapabilities getDisplayCapabilities() {
return (DisplayCapabilities) getObject(DisplayCapabilities.class, KEY_DISPLAY_CAPABILITIES);
@@ -224,6 +225,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets Display Capabilities
* @param displayCapabilities
*/
+ @Deprecated
public void setDisplayCapabilities(DisplayCapabilities displayCapabilities) {
setParameters(KEY_DISPLAY_CAPABILITIES, displayCapabilities);
}
@@ -233,6 +235,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return buttonCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public List<ButtonCapabilities> getButtonCapabilities() {
return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
@@ -241,6 +244,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets Button Capabilities
* @param buttonCapabilities
*/
+ @Deprecated
public void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
setParameters(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
}
@@ -249,6 +253,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return SoftButtonCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public List<SoftButtonCapabilities> getSoftButtonCapabilities() {
return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
@@ -257,6 +262,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets softButtonCapabilities
* @param softButtonCapabilities
*/
+ @Deprecated
public void setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
setParameters(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
}
@@ -266,6 +272,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
*
* @return PresetBankCapabilities
*/
+ @Deprecated
@SuppressWarnings("unchecked")
public PresetBankCapabilities getPresetBankCapabilities() {
return (PresetBankCapabilities) getObject(PresetBankCapabilities.class, KEY_PRESET_BANK_CAPABILITIES);
@@ -274,6 +281,7 @@ public class RegisterAppInterfaceResponse extends RPCResponse {
* Sets presetBankCapabilities
* @param presetBankCapabilities
*/
+ @Deprecated
public void setPresetBankCapabilities(PresetBankCapabilities presetBankCapabilities) {
setParameters(KEY_PRESET_BANK_CAPABILITIES, presetBankCapabilities);
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
new file mode 100644
index 000000000..fb00c9779
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModule.java
@@ -0,0 +1,62 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.ModuleType;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModule extends RPCRequest {
+ public static final String KEY_MODULE_TYPE = "moduleType";
+ public static final String KEY_MODULE_ID = "moduleId";
+
+ public ReleaseInteriorVehicleDataModule() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModule(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * @param moduleType Sets the Module Type for this class
+ */
+ public ReleaseInteriorVehicleDataModule(@NonNull ModuleType moduleType){
+ this();
+ setModuleType(moduleType);
+ }
+
+ /**
+ * Sets the Module Type for this class
+ * @param type the Module Type to be set
+ */
+ public void setModuleType(@NonNull ModuleType type) {
+ setParameters(KEY_MODULE_TYPE, type);
+ }
+
+ /**
+ * Gets the Module Type of this class
+ * @return the Module Type of this class
+ */
+ public ModuleType getModuleType() {
+ return (ModuleType) getObject(ModuleType.class, KEY_MODULE_TYPE);
+ }
+
+ /**
+ * Sets the Module Ids for this class
+ * @param id the ids to be set
+ */
+ public void setModuleId(String id) {
+ setParameters(KEY_MODULE_ID, id);
+ }
+
+ /**
+ * Gets the Module Id of this class
+ * @return the Module Ids
+ */
+ public String getModuleId() {
+ return getString(KEY_MODULE_ID);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
new file mode 100644
index 000000000..61d8df98a
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ReleaseInteriorVehicleDataModuleResponse.java
@@ -0,0 +1,26 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+public class ReleaseInteriorVehicleDataModuleResponse extends RPCResponse {
+
+ public ReleaseInteriorVehicleDataModuleResponse() {
+ super(FunctionID.RELEASE_INTERIOR_VEHICLE_MODULE.toString());
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public ReleaseInteriorVehicleDataModuleResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
index b4e212fcc..a3bb9a567 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ScrollableMessage.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -42,6 +42,8 @@ import java.util.List;
/**
* Creates a full screen overlay containing a large block of formatted text that
* can be scrolled with up to 8 SoftButtons defined
+ *
+ * If connecting to SDL Core v.6.0+, the scrollable message can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the scrollable message will persist until the user has interacted with the scrollable message or the specified timeout has elapsed.
*
* <p>Function Group: ScrollableMessage</p>
*
@@ -81,6 +83,14 @@ import java.util.List;
* <td>minsize=0; maxsize=8</td>
* <td>SmartDevice Link 1.0 </td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific ScrollableMessage to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
* <p> <b>Response</b></p>
*<b>Non-default Result Codes:</b>
@@ -102,6 +112,7 @@ public class ScrollableMessage extends RPCRequest {
public static final String KEY_SCROLLABLE_MESSAGE_BODY = "scrollableMessageBody";
public static final String KEY_TIMEOUT = "timeout";
public static final String KEY_SOFT_BUTTONS = "softButtons";
+ public static final String KEY_CANCEL_ID = "cancelID";
/**
* Constructs a new ScrollableMessage object
@@ -197,4 +208,26 @@ public class ScrollableMessage extends RPCRequest {
public List<SoftButton> getSoftButtons() {
return (List<SoftButton>) getObject(SoftButton.class, KEY_SOFT_BUTTONS);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific scrollable message to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
index 3c875d0d1..d56a321a2 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatControlCapabilities.java
@@ -54,6 +54,7 @@ public class SeatControlCapabilities extends RPCStruct {
public static final String KEY_MASSAGE_MODE_AVAILABLE = "massageModeAvailable";
public static final String KEY_MASSAGE_CUSHION_FIRMNESS_AVAILABLE = "massageCushionFirmnessAvailable";
public static final String KEY_MEMORY_AVAILABLE = "memoryAvailable";
+ public static final String KEY_MODULE_INFO = "moduleInfo";
/**
* Constructs a new SeatControlCapabilities object
@@ -367,4 +368,20 @@ public class SeatControlCapabilities extends RPCStruct {
public Boolean getMemoryAvailable() {
return getBoolean(KEY_MEMORY_AVAILABLE);
}
+
+ /**
+ * Sets ModuleInfo for this capability
+ * @param info the ModuleInfo to be set
+ */
+ public void setModuleInfo(ModuleInfo info) {
+ setValue(KEY_MODULE_INFO, info);
+ }
+
+ /**
+ * Gets a ModuleInfo of this capability
+ * @return module info of this capability
+ */
+ public ModuleInfo getModuleInfo() {
+ return (ModuleInfo) getObject(ModuleInfo.class, KEY_MODULE_INFO);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
new file mode 100644
index 000000000..a4b33d1bd
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocation.java
@@ -0,0 +1,32 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+public class SeatLocation extends RPCStruct {
+ public static final String KEY_GRID = "grid";
+
+ public SeatLocation(){}
+
+ public SeatLocation(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets grid data for this seat location
+ * @param grid the grid to be set
+ */
+ public void setGrid(Grid grid) {
+ setValue(KEY_GRID, grid);
+ }
+
+ /**
+ * Gets the Grid of this seat location
+ * @return the grid of this seat location
+ */
+ public Grid getGrid() {
+ return (Grid) getObject(Grid.class, KEY_GRID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
new file mode 100644
index 000000000..3fc34bada
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SeatLocationCapability.java
@@ -0,0 +1,85 @@
+package com.smartdevicelink.proxy.rpc;
+
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+import java.util.List;
+
+public class SeatLocationCapability extends RPCStruct {
+ public static final String KEY_ROWS = "rows";
+ public static final String KEY_COLS = "columns";
+ public static final String KEY_LEVELS = "levels";
+ public static final String KEY_SEATS = "seats";
+
+ public SeatLocationCapability(){}
+
+ public SeatLocationCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the seat rows for this capability
+ * @param rows rows to be set
+ */
+ public void setRows(Integer rows) {
+ setValue(KEY_ROWS, rows);
+ }
+
+ /**
+ * Gets the seat rows of this capability
+ * @return the seat rows
+ */
+ public Integer getRows() {
+ return getInteger(KEY_ROWS);
+ }
+
+ /**
+ * Sets the seat columns for this capability
+ * @param cols the seat columns to be set
+ */
+ public void setCols(Integer cols) {
+ setValue(KEY_COLS, cols);
+ }
+
+ /**
+ * Gets the seat columns of this capability
+ * @return the seat columns
+ */
+ public Integer getCols() {
+ return getInteger(KEY_COLS);
+ }
+
+ /**
+ * Sets the levels for this capability
+ * @param levels the levels to be set
+ */
+ public void setLevels(Integer levels) {
+ setValue(KEY_LEVELS, levels);
+ }
+
+ /**
+ * Gets the seat levels of this capability
+ * @return the seat levels
+ */
+ public Integer getLevels() {
+ return getInteger(KEY_LEVELS);
+ }
+
+ /**
+ * Sets the seat locations for this capability
+ * @param locations the locations to be set
+ */
+ public void setSeats(List<SeatLocation> locations) {
+ setValue(KEY_SEATS, locations);
+ }
+
+ /**
+ * Gets the seat locations of this capability
+ * @return the seat locations
+ */
+ @SuppressWarnings("unchecked")
+ public List<SeatLocation> getSeatLocations() {
+ return (List<SeatLocation>) getObject(SeatLocation.class, KEY_SEATS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
index 18550c1ce..562021544 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayout.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -39,6 +39,7 @@ import com.smartdevicelink.proxy.RPCRequest;
import java.util.Hashtable;
/**
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Used to set an alternate display layout. If not sent, default screen for
* given platform will be shown
*
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
index 070879a1a..0d136daf6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetDisplayLayoutResponse.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -41,6 +41,7 @@ import java.util.Hashtable;
import java.util.List;
/**
+ * <Strong>If using Widgets with Core > 6.0, use {@link Show} to change widget layouts</Strong> <br>
* Set Display Layout Response is sent, when SetDisplayLayout has been called
*
* @since SmartDeviceLink 2.0
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
index 62aca4657..82e7738ee 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetGlobalProperties.java
@@ -1,38 +1,39 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
import java.util.Hashtable;
import java.util.List;
@@ -87,7 +88,7 @@ import java.util.List;
* </tr>
* <tr>
* <td>vrHelp</td>
- * <td>VrHelep</td>
+ * <td>VrHelp</td>
* <td>Items listed in the VR help screen used in an interaction started by PTT.</td>
* <td>N</td>
* <td>If omitted on supported displays, the default SDL VR help / What Can I Say? screen will be used<p>If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC will be rejected.</p><p>If omitted and a vrHelpTitle is provided, the request will be rejected.</p>minsize:1; maxsize: 100 </td>
@@ -112,11 +113,19 @@ import java.util.List;
* <tr>
* <td>keyboardProperties</td>
* <td>KeyboardProperties</td>
- * <td>On-screen keybaord configuration (if available).</td>
+ * <td>On-screen keyboard configuration (if available).</td>
* <td>N</td>
* <td></td>
* <td>SmartDeviceLink 1.0</td>
* </tr>
+ * <tr>
+ * <td>menuLayout</td>
+ * <td>MenuLayout</td>
+ * <td>Sets the layout of the main menu screen. If this is sent while a menu is already on-screen, the head unit will change the display to the new layout type.</td>
+ * <td></td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
*
* </table>
*
@@ -144,6 +153,8 @@ public class SetGlobalProperties extends RPCRequest {
public static final String KEY_HELP_PROMPT = "helpPrompt";
public static final String KEY_TIMEOUT_PROMPT = "timeoutPrompt";
public static final String KEY_VR_HELP = "vrHelp";
+ public static final String KEY_USER_LOCATION = "userLocation";
+ public static final String KEY_MENU_LAYOUT = "menuLayout";
/**
* Constructs a new SetGlobalProperties object
*/
@@ -302,9 +313,44 @@ public class SetGlobalProperties extends RPCRequest {
setParameters(KEY_KEYBOARD_PROPERTIES, keyboardProperties);
}
+ /**
+ * Sets the user seat location
+ * @param location the location to be set
+ */
+ public void setUserLocation(SeatLocation location) {
+ setParameters(KEY_USER_LOCATION, location);
+ }
+
+ /**
+ * Gets the user seat location
+ * @return the user seat location
+ */
+ public SeatLocation getUserLocation() {
+ return (SeatLocation) getObject(SeatLocation.class, KEY_USER_LOCATION);
+ }
+
@SuppressWarnings("unchecked")
public KeyboardProperties getKeyboardProperties() {
return (KeyboardProperties) getObject(KeyboardProperties.class, KEY_KEYBOARD_PROPERTIES);
- }
+ }
+
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ * @param menuLayout - the menuLayout
+ */
+ public void setMenuLayout(MenuLayout menuLayout) {
+ setParameters(KEY_MENU_LAYOUT, menuLayout);
+ }
+
+ /**
+ * Sets the layout of the main menu screen. If this is sent while a menu is already on-screen,
+ * the head unit will change the display to the new layout type.
+ * @return the MenuLayout
+ */
+ @SuppressWarnings("unchecked")
+ public MenuLayout getMenuLayout() {
+ return (MenuLayout) getObject(MenuLayout.class, KEY_MENU_LAYOUT);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
index 072aac498..1e756ade9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SetInteriorVehicleDataResponse.java
@@ -66,7 +66,9 @@ public class SetInteriorVehicleDataResponse extends RPCResponse {
* @param moduleData
* @param success whether the request is successfully processed
* @param resultCode whether the request is successfully processed
+ * @deprecated use {@link SetInteriorVehicleDataResponse#SetInteriorVehicleDataResponse(Result, Boolean)}
*/
+ @Deprecated
public SetInteriorVehicleDataResponse(@NonNull ModuleData moduleData, @NonNull Result resultCode, @NonNull Boolean success) {
this();
setModuleData(moduleData);
@@ -75,6 +77,17 @@ public class SetInteriorVehicleDataResponse extends RPCResponse {
}
/**
+ * Constructs a new SetInteriorVehicleDataResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public SetInteriorVehicleDataResponse(@NonNull Result resultCode, @NonNull Boolean success) {
+ this();
+ setResultCode(resultCode);
+ setSuccess(success);
+ }
+
+ /**
* Gets the moduleData
*
* @return ModuleData
@@ -88,7 +101,7 @@ public class SetInteriorVehicleDataResponse extends RPCResponse {
*
* @param moduleData
*/
- public void setModuleData(@NonNull ModuleData moduleData) {
+ public void setModuleData(ModuleData moduleData) {
setParameters(KEY_MODULE_DATA, moduleData);
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
index 8a536e4a9..f3546dcc8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Show.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -162,6 +162,14 @@ import java.util.List;
* <td><p>If omitted on supported displays, the presets will be shown as not defined.</p>Minsize: 0; Maxsize: 6</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
+ * <tr>
+ * <td>templateTitle</td>
+ * <td>String</td>
+ * <td>The title of the new template that will be displayed.</td>
+ * <td><p>How this will be displayed is dependent on the OEM design and implementation of the template..</p>Minsize: 0; Maxsize: 100</td>
+ * <td>N</td>
+ * <td>SmartDeviceLink 6.0.0</td>
+ * </tr>
*
* </table>
*<p><b>Response </b></p>
@@ -196,6 +204,10 @@ public class Show extends RPCRequest {
public static final String KEY_SECONDARY_GRAPHIC = "secondaryGraphic";
public static final String KEY_SOFT_BUTTONS = "softButtons";
public static final String KEY_METADATA_TAGS = "metadataTags";
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_TEMPLATE_CONFIGURATION = "templateConfiguration";
+ public static final String KEY_TEMPLATE_TITLE = "templateTitle";
+
/**
* Constructs a new Show object
*/
@@ -439,7 +451,7 @@ public class Show extends RPCRequest {
* Sets the text in the track field
*
* @param mediaTrack
- * a String value disaplayed in the track field
+ * a String value displayed in the track field
* <p></p>
* <b>Notes: </b>
* <ul>
@@ -577,4 +589,71 @@ public class Show extends RPCRequest {
public MetadataTags getMetadataTags() {
return (MetadataTags) getObject(MetadataTags.class, KEY_METADATA_TAGS);
}
+
+ /**
+ * Sets the windowID. It's a unique ID to identify the window.
+ * If this param is not included, it will be assumed that this request is specifically for the main window on the main display.
+ * See PredefinedWindows enum.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ *
+ * @since 6.0
+ */
+ public void setWindowID(Integer windowID) {
+ setParameters(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return int -an int value representing the windowID.
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Gets the templateConfiguration.
+ *
+ * @return TemplateConfiguration
+ *
+ * @since 6.0
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateConfiguration getTemplateConfiguration() {
+ return (TemplateConfiguration) getObject(TemplateConfiguration.class, KEY_TEMPLATE_CONFIGURATION);
+ }
+
+ /**
+ * Sets the templateConfiguration. It's used to set an alternate template layout to a window.
+ * @param templateConfiguration
+ */
+ public void setTemplateConfiguration(TemplateConfiguration templateConfiguration) {
+ setParameters(KEY_TEMPLATE_CONFIGURATION, templateConfiguration);
+ }
+
+ /**
+ * Sets the title of the new template that will be displayed.
+ * How this will be displayed is dependent on the OEM design and implementation of the template.
+ * @param templateTitle the title of the new template that will be displayed
+ * <p></p>
+ * <ul>
+ * <li>Minlength: 0</li>
+ * <li>Maxlength: 100</li>
+ * </ul>
+ * @since SmartDeviceLink 6.0.0
+ */
+ public void setTemplateTitle(String templateTitle){
+ setParameters(KEY_TEMPLATE_TITLE, templateTitle);
+ }
+
+ /**
+ * Gets the title of the new template that will be displayed
+ * How this will be displayed is dependent on the OEM design and implementation of the template.
+ * @return templateTitle - String value that represents the title of the new template that will be displayed
+ * @since SmartDeviceLink 6.0.0
+ */
+ public String getTemplateTitle(){
+ return getString(KEY_TEMPLATE_TITLE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
new file mode 100644
index 000000000..6c6c2e7c9
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenu.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/16/19 1:44 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+public class ShowAppMenu extends RPCRequest {
+
+ public static final String KEY_MENU_ID = "menuID";
+
+ /**
+ * Constructs a new ShowAppMenu object
+ */
+ public ShowAppMenu() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenu object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenu(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @param menuID - The SubMenu ID to open
+ */
+ public void setMenuID(Integer menuID){
+ setParameters(KEY_MENU_ID, menuID);
+ }
+
+ /**
+ * If omitted the HMI opens the apps menu.
+ * If set to a sub-menu ID the HMI opens the corresponding sub-menu
+ * previously added using `AddSubMenu`.
+ * @return - MenuID int
+ */
+ public Integer getMenuID(){
+ return getInteger(KEY_MENU_ID);
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
new file mode 100644
index 000000000..f9ba65c7b
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/ShowAppMenuResponse.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/16/19 1:52 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * The response to ShowAppMenuResponse
+ */
+public class ShowAppMenuResponse extends RPCResponse {
+ /**
+ * Constructs a new ShowAppMenuResponse object
+ */
+ public ShowAppMenuResponse() {
+ super(FunctionID.SHOW_APP_MENU.toString());
+ }
+
+ /**
+ * Constructs a new ShowAppMenuResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public ShowAppMenuResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new ShowAppMenuResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public ShowAppMenuResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
index 530352c6d..466879845 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/Slider.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -40,8 +40,9 @@ import java.util.Hashtable;
import java.util.List;
/**
- * <p>Creates a full screen or pop-up overlay (depending on platform) with a single
- * user controlled slider.</p>
+ * Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.
+ *
+ * If connecting to SDL Core v.6.0+, the slider can be canceled programmatically using the `cancelID`. On older versions of SDL Core, the slider will persist until the user has interacted with the slider or the specified timeout has elapsed.
*
* <p>Function Group: Base</p>
*
@@ -99,6 +100,14 @@ import java.util.List;
* <td>Minvalue=0; Maxvalue=65535; Defvalue= 10000</td>
* <td>SmartDeviceLink 2.0</td>
* </tr>
+ * <tr>
+ * <td>cancelID</td>
+ * <td>Integer</td>
+ * <td>An ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.</td>
+ * <td>N</td>
+ * <td></td>
+ * <td>SmartDeviceLink 6.0</td>
+ * </tr>
* </table>
*<p><b>Response </b></p>
*
@@ -124,6 +133,8 @@ public class Slider extends RPCRequest {
public static final String KEY_SLIDER_FOOTER = "sliderFooter";
public static final String KEY_POSITION = "position";
public static final String KEY_TIMEOUT = "timeout";
+ public static final String KEY_CANCEL_ID = "cancelID";
+
/**
* Constructs a new Slider object
*/
@@ -263,4 +274,26 @@ public class Slider extends RPCRequest {
public Integer getTimeout() {
return getInteger(KEY_TIMEOUT);
}
+
+ /**
+ * Gets an Integer value representing the cancel ID
+ *
+ * @return Integer - An Integer value representing the ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public Integer getCancelID() {
+ return getInteger(KEY_CANCEL_ID);
+ }
+
+ /**
+ * Sets the cancel ID
+ *
+ * @param cancelID An Integer ID for this specific slider to allow cancellation through the `CancelInteraction` RPC.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ public void setCancelID(Integer cancelID) {
+ setParameters(KEY_CANCEL_ID, cancelID);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
index af770a1c9..4fff09591 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SoftButtonCapabilities.java
@@ -87,6 +87,7 @@ public class SoftButtonCapabilities extends RPCStruct {
public static final String KEY_SHORT_PRESS_AVAILABLE = "shortPressAvailable";
public static final String KEY_LONG_PRESS_AVAILABLE = "longPressAvailable";
public static final String KEY_UP_DOWN_AVAILABLE = "upDownAvailable";
+ public static final String KEY_TEXT_SUPPORTED = "textSupported";
/**
* Constructs a newly allocated SoftButtonCapabilities object
@@ -122,7 +123,7 @@ public class SoftButtonCapabilities extends RPCStruct {
if(!store.containsKey(KEY_IMAGE_SUPPORTED)){
// At some point this was added to the RPC spec as mandatory but at least in v1.0.0
// it was not included.
- store.put(KEY_IMAGE_SUPPORTED, new Boolean(false));
+ store.put(KEY_IMAGE_SUPPORTED, Boolean.FALSE);
}
}
@@ -189,4 +190,21 @@ public class SoftButtonCapabilities extends RPCStruct {
public Boolean getImageSupported() {
return getBoolean( KEY_IMAGE_SUPPORTED);
}
+
+ /**
+ * set the text support. If not included, the default value should be considered true that the button will support text.
+ * @param textSupported whether the button supports the use of text or not.
+ * @since 6.0
+ */
+ public void setTextSupported(Boolean textSupported) {
+ setValue(KEY_TEXT_SUPPORTED, textSupported);
+ }
+
+ /**
+ * get the text support.
+ * @return Boolean - the text is supported or not.
+ */
+ public Boolean getTextSupported() {
+ return getBoolean( KEY_TEXT_SUPPORTED);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
index ccce22d04..b2e299e24 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleData.java
@@ -864,4 +864,21 @@ public class SubscribeVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean(KEY_CLOUD_APP_VEHICLE_ID);
}
-}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
index c045961a3..a1f63aa71 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SubscribeVehicleDataResponse.java
@@ -514,4 +514,21 @@ public class SubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getCloudAppVehicleID(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleDataResult for the vehicle data item.
+ * @return a VehicleDataResult related to the vehicle data
+ */
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
index 82cb366d7..73634c17b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/SystemCapability.java
@@ -46,24 +46,25 @@ public class SystemCapability extends RPCStruct {
public static final String KEY_SYSTEM_CAPABILITY_TYPE = "systemCapabilityType";
public static final String KEY_NAVIGATION_CAPABILITY = "navigationCapability";
public static final String KEY_PHONE_CAPABILITY = "phoneCapability";
- public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
+ public static final String KEY_VIDEO_STREAMING_CAPABILITY = "videoStreamingCapability";
public static final String KEY_REMOTE_CONTROL_CAPABILITY = "remoteControlCapability";
public static final String KEY_APP_SERVICES_CAPABILITIES = "appServicesCapabilities";
-
+ public static final String KEY_SEAT_LOCATION_CAPABILITY = "seatLocationCapability";
+ public static final String KEY_DISPLAY_CAPABILITIES = "displayCapabilities";
public SystemCapability(){}
public SystemCapability(Hashtable<String, Object> hash) {
super(hash);
}
- /**
- * Create a systemCapability object
- * @param systemCapabilityType The type
- */
- public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
- this();
- setSystemCapabilityType(systemCapabilityType);
- }
+ /**
+ * Create a systemCapability object
+ * @param systemCapabilityType The type
+ */
+ public SystemCapability(@NonNull SystemCapabilityType systemCapabilityType){
+ this();
+ setSystemCapabilityType(systemCapabilityType);
+ }
/**
*
@@ -80,39 +81,48 @@ public class SystemCapability extends RPCStruct {
setValue(KEY_SYSTEM_CAPABILITY_TYPE, value);
}
- public RPCStruct getCapabilityForType(SystemCapabilityType type) {
- if(type == null) {
- return null;
- }else if (type.equals(SystemCapabilityType.NAVIGATION)) {
- return (RPCStruct) getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
- } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
- return (RPCStruct) getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
- } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)){
- return (RPCStruct) getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
- }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
- return (RPCStruct) getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
- }else if(type.equals(SystemCapabilityType.APP_SERVICES)){
- return (RPCStruct) getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
- }else{
+ public Object getCapabilityForType(SystemCapabilityType type) {
+ if (type == null) {
+ return null;
+ } else if (type.equals(SystemCapabilityType.NAVIGATION)) {
+ return getObject(NavigationCapability.class, KEY_NAVIGATION_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
+ return getObject(PhoneCapability.class, KEY_PHONE_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)) {
+ return getObject(VideoStreamingCapability.class, KEY_VIDEO_STREAMING_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.REMOTE_CONTROL)) {
+ return getObject(RemoteControlCapabilities.class, KEY_REMOTE_CONTROL_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.APP_SERVICES)) {
+ return getObject(AppServicesCapabilities.class, KEY_APP_SERVICES_CAPABILITIES);
+ } else if (type.equals(SystemCapabilityType.SEAT_LOCATION)) {
+ return getObject(SeatLocationCapability.class, KEY_SEAT_LOCATION_CAPABILITY);
+ } else if (type.equals(SystemCapabilityType.DISPLAYS)) {
+ return getObject(DisplayCapability.class, KEY_DISPLAY_CAPABILITIES);
+ } else {
return null;
}
}
- public void setCapabilityForType(SystemCapabilityType type, RPCStruct capability){
- if(type == null) {
+ public void setCapabilityForType(SystemCapabilityType type, Object capability) {
+ if (type == null) {
return;
- }else if(type.equals(SystemCapabilityType.NAVIGATION)){
+ } else if (type.equals(SystemCapabilityType.NAVIGATION)) {
setValue(KEY_NAVIGATION_CAPABILITY, capability);
- }else if(type.equals(SystemCapabilityType.PHONE_CALL)){
+ } else if (type.equals(SystemCapabilityType.PHONE_CALL)) {
setValue(KEY_PHONE_CAPABILITY, capability);
- }else if(type.equals(SystemCapabilityType.VIDEO_STREAMING)){
- setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
- }else if(type.equals(SystemCapabilityType.REMOTE_CONTROL)){
+ } else if (type.equals(SystemCapabilityType.VIDEO_STREAMING)) {
+ setValue(KEY_VIDEO_STREAMING_CAPABILITY, capability);
+ } else if (type.equals(SystemCapabilityType.REMOTE_CONTROL)) {
setValue(KEY_REMOTE_CONTROL_CAPABILITY, capability);
- }else if(type.equals(SystemCapabilityType.APP_SERVICES)){
- setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
- }else{
- return;
+ } else if (type.equals(SystemCapabilityType.APP_SERVICES)) {
+ setValue(KEY_APP_SERVICES_CAPABILITIES, capability);
+ } else if (type.equals(SystemCapabilityType.SEAT_LOCATION)) {
+ setValue(KEY_SEAT_LOCATION_CAPABILITY, capability);
+ } else if (type.equals(SystemCapabilityType.DISPLAYS)) {
+ setValue(KEY_DISPLAY_CAPABILITIES, capability);
+ } else {
+ return;
}
}
+
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
new file mode 100644
index 000000000..a92e8e28a
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/TemplateConfiguration.java
@@ -0,0 +1,99 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+
+import java.util.Hashtable;
+
+/**
+ * Used to set an alternate template layout to a window.
+ * @since 6.0
+ */
+public class TemplateConfiguration extends RPCStruct {
+ public static final String KEY_TEMPLATE = "template";
+ public static final String KEY_DAY_COLOR_SCHEME = "dayColorScheme";
+ public static final String KEY_NIGHT_COLOR_SCHEME = "nightColorScheme";
+
+ /**
+ * Constructs a new TemplateConfiguration object
+ * @param template Predefined or dynamically created window template.
+ * Currently only predefined window template layouts are defined.
+ */
+ public TemplateConfiguration(@NonNull String template) {
+ this();
+ setTemplate(template);
+ }
+
+ /**
+ * Constructs a new TemplateConfiguration object indicated by the Hashtable
+ * parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public TemplateConfiguration(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new TemplateConfiguration object
+ */
+ public TemplateConfiguration() {
+ }
+
+ /**
+ * Gets the template.
+ *
+ * @return String -an Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ */
+ public String getTemplate() {
+ return getString(KEY_TEMPLATE);
+ }
+
+ /**
+ * Sets the template. It can be Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ *
+ * @param template Predefined or dynamically created window template. Currently only predefined window template layouts are defined.
+ */
+ public void setTemplate(@NonNull String template) {
+ setValue(KEY_TEMPLATE, template);
+ }
+
+ /**
+ * Gets the dayColorScheme.
+ *
+ * @return TemplateColorScheme
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateColorScheme getDayColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_DAY_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the dayColorScheme.
+ *
+ * @param dayColorScheme TemplateColorScheme for the day
+ */
+ public void setDayColorScheme(TemplateColorScheme dayColorScheme) {
+ setValue(KEY_DAY_COLOR_SCHEME, dayColorScheme);
+ }
+
+ /**
+ * Gets the nightColorScheme.
+ *
+ * @return TemplateColorScheme
+ */
+ @SuppressWarnings("unchecked")
+ public TemplateColorScheme getNightColorScheme() {
+ return (TemplateColorScheme) getObject(TemplateColorScheme.class, KEY_NIGHT_COLOR_SCHEME);
+ }
+
+ /**
+ * Sets the nightColorScheme.
+ *
+ * @param nightColorScheme TemplateColorScheme for the night
+ */
+ public void setNightColorScheme(TemplateColorScheme nightColorScheme) {
+ setValue(KEY_NIGHT_COLOR_SCHEME, nightColorScheme);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java
new file mode 100644
index 000000000..7ad2d8d55
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppService.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/12/19 11:36 AM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCRequest;
+
+import java.util.Hashtable;
+
+/**
+ * Unpublish an existing service published by this application.
+ */
+public class UnpublishAppService extends RPCRequest {
+
+ public static final String KEY_SERVICE_ID = "serviceID";
+
+ /**
+ * Constructs a new UnpublishAppService object
+ */
+ public UnpublishAppService() {
+ super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
+ }
+
+ /**
+ * Constructs a new UnpublishAppService object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public UnpublishAppService(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new UnpublishAppService object with the required serviceID
+ * @param serviceID - set the service ID for the service to be unpublished
+ */
+ public UnpublishAppService(@NonNull String serviceID){
+ this();
+ setServiceID(serviceID);
+ }
+
+ // SETTERS AND GETTERS
+
+ /**
+ * The ID of the service to be unpublished.
+ * @param serviceID - set the service ID for the service to be unpublished
+ */
+ public void setServiceID(String serviceID){
+ setParameters(KEY_SERVICE_ID, serviceID);
+ }
+
+ /**
+ * The ID of the service to be unpublished.
+ * @return - get the service ID for the service to be unpublished
+ */
+ public String getServiceID(){
+ return getString(KEY_SERVICE_ID);
+ }
+
+} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java
new file mode 100644
index 000000000..01ae96d8a
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnpublishAppServiceResponse.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/12/19 11:37 AM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.protocol.enums.FunctionID;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+
+import java.util.Hashtable;
+
+/**
+ * The response to UnpublishAppService
+ */
+public class UnpublishAppServiceResponse extends RPCResponse {
+ /**
+ * Constructs a new UnpublishAppServiceResponse object
+ */
+ public UnpublishAppServiceResponse() {
+ super(FunctionID.UNPUBLISH_APP_SERVICE.toString());
+ }
+
+ /**
+ * Constructs a new UnpublishAppServiceResponse object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public UnpublishAppServiceResponse(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a new UnpublishAppServiceResponse object
+ * @param success whether the request is successfully processed
+ * @param resultCode whether the request is successfully processed
+ */
+ public UnpublishAppServiceResponse(@NonNull Boolean success, @NonNull Result resultCode) {
+ this();
+ setSuccess(success);
+ setResultCode(resultCode);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
index 134ab5976..f2bfb16dc 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleData.java
@@ -850,4 +850,21 @@ public class UnsubscribeVehicleData extends RPCRequest {
public Boolean getCloudAppVehicleID(){
return getBoolean( KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a boolean value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a boolean value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, Boolean vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a boolean value for OEM Custom VehicleData.
+ * @return a Boolean value.
+ */
+ public Boolean getOEMCustomVehicleData(String vehicleDataName){
+ return getBoolean(vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
index 6b3fb499f..580f399eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/UnsubscribeVehicleDataResponse.java
@@ -516,4 +516,21 @@ public class UnsubscribeVehicleDataResponse extends RPCResponse {
public VehicleDataResult getCloudAppVehicleID(){
return (VehicleDataResult) getObject(VehicleDataResult.class, KEY_CLOUD_APP_VEHICLE_ID);
}
+
+ /**
+ * Sets a value for OEM Custom VehicleData.
+ * @param vehicleDataName a String value
+ * @param vehicleDataState a VehicleDataResult value
+ */
+ public void setOEMCustomVehicleData(String vehicleDataName, VehicleDataResult vehicleDataState){
+ setParameters(vehicleDataName, vehicleDataState);
+ }
+
+ /**
+ * Gets a VehicleDataResult for the vehicle data item.
+ * @return a VehicleDataResult related to the vehicle data
+ */
+ public VehicleDataResult getOEMCustomVehicleData(String vehicleDataName){
+ return (VehicleDataResult) getObject(VehicleDataResult.class, vehicleDataName);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
index 09bd9bcbe..e467d0407 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VehicleDataResult.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
@@ -74,6 +74,7 @@ import java.util.Hashtable;
public class VehicleDataResult extends RPCStruct {
public static final String KEY_DATA_TYPE = "dataType";
public static final String KEY_RESULT_CODE = "resultCode";
+ public static final String KEY_OEM_CUSTOM_DATA_TYPE = "oemCustomDataType";
public VehicleDataResult() { }
/**
@@ -84,9 +85,9 @@ public class VehicleDataResult extends RPCStruct {
*
* @param hash the Hashtable to use
*/
- public VehicleDataResult(Hashtable<String, Object> hash) {
- super(hash);
- }
+ public VehicleDataResult(Hashtable<String, Object> hash) {
+ super(hash);
+ }
/**
* Individual published data request result.
@@ -94,21 +95,32 @@ public class VehicleDataResult extends RPCStruct {
* @param resultCode Published data result code.
*/
public VehicleDataResult(@NonNull VehicleDataType dataType, @NonNull VehicleDataResultCode resultCode){
- this();
- setDataType(dataType);
- setResultCode(resultCode);
+ this();
+ setDataType(dataType);
+ setResultCode(resultCode);
+ }
+
+ public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
+ setValue(KEY_RESULT_CODE, resultCode);
+ }
+
+ public VehicleDataResultCode getResultCode() {
+ return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
+ }
+
+ public void setDataType(@NonNull VehicleDataType dataType) {
+ setValue(KEY_DATA_TYPE, dataType);
}
- public void setDataType(@NonNull VehicleDataType dataType) {
- setValue(KEY_DATA_TYPE, dataType);
- }
- public VehicleDataType getDataType() {
- return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
- }
- public void setResultCode(@NonNull VehicleDataResultCode resultCode) {
- setValue(KEY_RESULT_CODE, resultCode);
- }
- public VehicleDataResultCode getResultCode() {
- return (VehicleDataResultCode) getObject(VehicleDataResultCode.class, KEY_RESULT_CODE);
- }
+ public VehicleDataType getDataType() {
+ return (VehicleDataType) getObject(VehicleDataType.class, KEY_DATA_TYPE);
+ }
+
+ public void setOEMCustomVehicleDataType(String oemCustomDataType) {
+ setValue(KEY_OEM_CUSTOM_DATA_TYPE, oemCustomDataType);
+ }
+
+ public String getOEMCustomVehicleDataType() {
+ return (String) getObject(String.class, KEY_OEM_CUSTOM_DATA_TYPE);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
index e3bd9425c..ca13ba74f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java
@@ -32,6 +32,7 @@
package com.smartdevicelink.proxy.rpc;
import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.util.SdlDataTypeConverter;
import java.util.Hashtable;
import java.util.List;
@@ -45,6 +46,9 @@ public class VideoStreamingCapability extends RPCStruct {
public static final String KEY_MAX_BITRATE = "maxBitrate";
public static final String KEY_SUPPORTED_FORMATS = "supportedFormats";
public static final String KEY_HAPTIC_SPATIAL_DATA_SUPPORTED = "hapticSpatialDataSupported";
+ public static final String KEY_DIAGONAL_SCREEN_SIZE = "diagonalScreenSize";
+ public static final String KEY_PIXEL_PER_INCH = "pixelPerInch";
+ public static final String KEY_SCALE = "scale";
public VideoStreamingCapability(){}
public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);}
@@ -92,4 +96,49 @@ public class VideoStreamingCapability extends RPCStruct {
public void setIsHapticSpatialDataSupported(Boolean hapticSpatialDataSupported) {
setValue(KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, hapticSpatialDataSupported);
}
+
+ /**
+ * @return the diagonal screen size in inches.
+ */
+ public Double getDiagonalScreenSize() {
+ Object object = getValue(KEY_DIAGONAL_SCREEN_SIZE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param diagonalScreenSize the diagonal screen size in inches.
+ */
+ public void setDiagonalScreenSize(Double diagonalScreenSize) {
+ setValue(KEY_DIAGONAL_SCREEN_SIZE, diagonalScreenSize);
+ }
+
+ /**
+ * @return the diagonal resolution in pixels divided by the diagonal screen size in inches.
+ */
+ public Double getPixelPerInch() {
+ Object object = getValue(KEY_PIXEL_PER_INCH);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param pixelPerInch the diagonal resolution in pixels divided by the diagonal screen size in inches.
+ */
+ public void setPixelPerInch(Double pixelPerInch) {
+ setValue(KEY_PIXEL_PER_INCH, pixelPerInch);
+ }
+
+ /**
+ * @return the scaling factor the app should use to change the size of the projecting view.
+ */
+ public Double getScale() {
+ Object object = getValue(KEY_SCALE);
+ return SdlDataTypeConverter.objectToDouble(object);
+ }
+
+ /**
+ * @param scale the scaling factor the app should use to change the size of the projecting view.
+ */
+ public void setScale(Double scale) {
+ setValue(KEY_SCALE, scale);
+ }
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
index afad87256..0fc981672 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java
@@ -78,6 +78,15 @@ public class VideoStreamingFormat extends RPCStruct {
}
@Override
+ public boolean equals(Object obj) {
+ if(obj != null && obj instanceof VideoStreamingFormat){
+ VideoStreamingFormat compareTo = (VideoStreamingFormat) obj;
+ return getCodec() == compareTo.getCodec() && getProtocol() == compareTo.getProtocol();
+ }
+ return false;
+ }
+
+ @Override
public String toString() {
return "codec=" + String.valueOf(getCodec()) +
", protocol=" + String.valueOf(getProtocol());
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
new file mode 100644
index 000000000..6974c82db
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowCapability.java
@@ -0,0 +1,208 @@
+package com.smartdevicelink.proxy.rpc;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.ImageType;
+import com.smartdevicelink.proxy.rpc.enums.MenuLayout;
+
+import java.util.Hashtable;
+import java.util.List;
+
+/**
+ * @since 6.0
+ */
+public class WindowCapability extends RPCStruct {
+ public static final String KEY_WINDOW_ID = "windowID";
+ public static final String KEY_TEXT_FIELDS = "textFields";
+ public static final String KEY_IMAGE_FIELDS = "imageFields";
+ public static final String KEY_IMAGE_TYPE_SUPPORTED = "imageTypeSupported";
+ public static final String KEY_TEMPLATES_AVAILABLE = "templatesAvailable";
+ public static final String KEY_NUM_CUSTOM_PRESETS_AVAILABLE = "numCustomPresetsAvailable";
+ public static final String KEY_BUTTON_CAPABILITIES = "buttonCapabilities";
+ public static final String KEY_SOFT_BUTTON_CAPABILITIES = "softButtonCapabilities";
+ public static final String KEY_MENU_LAYOUTS_AVAILABLE = "menuLayoutsAvailable";
+
+ public WindowCapability() {
+ }
+
+ public WindowCapability(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Sets the windowID. The specified ID of the window. Can be set to a predefined window, or omitted for the main window on the main display.
+ *
+ * @param windowID A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ */
+ public void setWindowID(Integer windowID) {
+ setValue(KEY_WINDOW_ID, windowID);
+ }
+
+ /**
+ * Gets the windowID.
+ *
+ * @return Integer
+ */
+ public Integer getWindowID() {
+ return getInteger(KEY_WINDOW_ID);
+ }
+
+ /**
+ * Get an array of TextField structures.
+ *
+ * @return the List of textFields
+ */
+ @SuppressWarnings("unchecked")
+ public List<TextField> getTextFields() {
+ return (List<TextField>) getObject(TextField.class, KEY_TEXT_FIELDS);
+ }
+
+ /**
+ * Set an array of TextField structures. It's set of all fields that support text data.
+ * {@code 1<= textFields.size() <= 100}
+ *
+ * @param textFields the List of textFields
+ */
+ public void setTextFields(List<TextField> textFields) {
+ setValue(KEY_TEXT_FIELDS, textFields);
+ }
+
+ /**
+ * Get an array of ImageField structures.
+ *
+ * @return the List of imageFields
+ */
+ @SuppressWarnings("unchecked")
+ public List<ImageField> getImageFields() {
+ return (List<ImageField>) getObject(ImageField.class, KEY_IMAGE_FIELDS);
+ }
+
+ /**
+ * Set an array of ImageField structures. A set of all fields that support images.
+ * {@code 1<= ImageFields.size() <= 100}
+ *
+ * @param imageFields the List of imageFields
+ */
+ public void setImageFields(List<ImageField> imageFields) {
+ setValue(KEY_IMAGE_FIELDS, imageFields);
+ }
+
+ /**
+ * Get an array of ImageType elements.
+ *
+ * @return the List of imageTypeSupported
+ */
+ @SuppressWarnings("unchecked")
+ public List<ImageType> getImageTypeSupported() {
+ return (List<ImageType>) getObject(ImageType.class, KEY_IMAGE_TYPE_SUPPORTED);
+ }
+
+ /**
+ * Set an array of ImageType elements.
+ * {@code 0<= imageTypeSupported.size() <= 1000}
+ *
+ * @param imageTypeSupported the List of ImageType
+ */
+ public void setImageTypeSupported(List<ImageType> imageTypeSupported) {
+ setValue(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported);
+ }
+
+ /**
+ * Get an array of templatesAvailable.
+ *
+ * @return the List of templatesAvailable
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getTemplatesAvailable() {
+ return (List<String>) getObject(String.class, KEY_TEMPLATES_AVAILABLE);
+ }
+
+ /**
+ * Set an array of templatesAvailable.
+ * {@code 0<= templatesAvailable.size() <= 100}
+ *
+ * @param templatesAvailable the List of String
+ */
+ public void setTemplatesAvailable(List<String> templatesAvailable) {
+ setValue(KEY_TEMPLATES_AVAILABLE, templatesAvailable);
+ }
+
+ /**
+ * Gets the numCustomPresetsAvailable.
+ *
+ * @return Integer
+ */
+ public Integer getNumCustomPresetsAvailable() {
+ return getInteger(KEY_NUM_CUSTOM_PRESETS_AVAILABLE);
+ }
+
+ /**
+ * Sets the numCustomPresetsAvailable. The number of on-window custom presets available (if any); otherwise omitted.
+ * {@code 1<= numCustomPresetsAvailable.size() <= 100}
+ *
+ * @param numCustomPresetsAvailable
+ */
+ public void setNumCustomPresetsAvailable(Integer numCustomPresetsAvailable) {
+ setValue(KEY_NUM_CUSTOM_PRESETS_AVAILABLE, numCustomPresetsAvailable);
+ }
+
+ /**
+ * Sets the buttonCapabilities portion of the WindowCapability class.
+ * {@code 1<= buttonCapabilities.size() <= 100}
+ *
+ * @param buttonCapabilities It refers to number of buttons and the capabilities of each on-window button.
+ */
+ public void setButtonCapabilities(List<ButtonCapabilities> buttonCapabilities) {
+ setValue(KEY_BUTTON_CAPABILITIES, buttonCapabilities);
+ }
+
+ /**
+ * Gets the buttonCapabilities portion of the WindowCapability class
+ *
+ * @return List<ButtonCapabilities>
+ * It refers to number of buttons and the capabilities of each on-window button.
+ */
+ @SuppressWarnings("unchecked")
+ public List<ButtonCapabilities> getButtonCapabilities() {
+ return (List<ButtonCapabilities>) getObject(ButtonCapabilities.class, KEY_BUTTON_CAPABILITIES);
+ }
+
+ /**
+ * Sets the softButtonCapabilities portion of the WindowCapability class.
+ * {@code 1<= softButtonCapabilities.size() <= 100}
+ *
+ * @param softButtonCapabilities It refers to number of soft buttons available on-window and the capabilities for each button.
+ */
+ public void setSoftButtonCapabilities(List<SoftButtonCapabilities> softButtonCapabilities) {
+ setValue(KEY_SOFT_BUTTON_CAPABILITIES, softButtonCapabilities);
+ }
+
+ /**
+ * Gets the softButtonCapabilities portion of the WindowCapability class
+ *
+ * @return List<SoftButtonCapabilities>
+ * It refers to number of soft buttons available on-window and the capabilities for each button.
+ */
+ @SuppressWarnings("unchecked")
+ public List<SoftButtonCapabilities> getSoftButtonCapabilities() {
+ return (List<SoftButtonCapabilities>) getObject(SoftButtonCapabilities.class, KEY_SOFT_BUTTON_CAPABILITIES);
+ }
+
+ /**
+ * An array of available menu layouts. If this parameter is not provided, only the `LIST` layout
+ * is assumed to be available
+ * @param menuLayout - An array of MenuLayouts
+ */
+ public void setMenuLayoutsAvailable(List<MenuLayout> menuLayout) {
+ setValue(KEY_MENU_LAYOUTS_AVAILABLE, menuLayout);
+ }
+
+ /**
+ * An array of available menu layouts. If this parameter is not provided, only the `LIST` layout
+ * is assumed to be available
+ * @return MenuLayout[]
+ */
+ @SuppressWarnings("unchecked")
+ public List<MenuLayout> getMenuLayoutsAvailable() {
+ return (List<MenuLayout>) getObject(MenuLayout.class, KEY_MENU_LAYOUTS_AVAILABLE);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
new file mode 100644
index 000000000..f57d9a415
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/WindowTypeCapabilities.java
@@ -0,0 +1,80 @@
+package com.smartdevicelink.proxy.rpc;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.proxy.RPCStruct;
+import com.smartdevicelink.proxy.rpc.enums.WindowType;
+
+import java.util.Hashtable;
+
+/**
+ * Used to inform an app how many window instances per type they can be created.
+ * @since 6.0
+ */
+public class WindowTypeCapabilities extends RPCStruct {
+ public static final String KEY_TYPE = "type";
+ public static final String KEY_MAXIMUM_NUMBER_OF_WINDOWS = "maximumNumberOfWindows";
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object
+ */
+ public WindowTypeCapabilities() {
+ }
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object indicated by the Hashtable parameter
+ *
+ * @param hash The Hashtable to use
+ */
+ public WindowTypeCapabilities(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ /**
+ * Constructs a newly allocated WindowTypeCapabilities object
+ *
+ * @param type Type of windows available, to create.
+ * @param maximumNumberOfWindows Number of windows available, to create.
+ */
+ public WindowTypeCapabilities(@NonNull WindowType type, @NonNull Integer maximumNumberOfWindows) {
+ this();
+ setType(type);
+ setMaximumNumberOfWindows(maximumNumberOfWindows);
+ }
+
+ /**
+ * set the type of Window
+ *
+ * @param type Type of windows available, to create.
+ */
+ public void setType(@NonNull WindowType type) {
+ setValue(KEY_TYPE, type);
+ }
+
+ /**
+ * get the type of Window
+ *
+ * @return WindowType
+ */
+ public WindowType getType() {
+ return (WindowType) getObject(WindowType.class, KEY_TYPE);
+ }
+
+ /**
+ * set the maximumNumberOfWindows
+ *
+ * @param maximumNumberOfWindows Number of windows available, to create.
+ */
+ public void setMaximumNumberOfWindows(@NonNull Integer maximumNumberOfWindows) {
+ setValue(KEY_MAXIMUM_NUMBER_OF_WINDOWS, maximumNumberOfWindows);
+ }
+
+ /**
+ * get the maximumNumberOfWindows
+ *
+ * @return Integer
+ */
+ public Integer getMaximumNumberOfWindows() {
+ return getInteger(KEY_MAXIMUM_NUMBER_OF_WINDOWS);
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
index 75c1e9461..d58a048a5 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ButtonName.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -188,6 +188,102 @@ public enum ButtonName{
* @see #OK
*/
PLAY_PAUSE,
+ /**
+ * Represents the center location button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_CENTER_LOCATION,
+ /**
+ * Represents the the zoom in button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ZOOM_IN,
+ /**
+ * Represents the zoom out button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ZOOM_OUT,
+ /**
+ * Represents the pan up button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP,
+ /**
+ * Represents the pan up-right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP_RIGHT,
+ /**
+ * Represents the pan right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_RIGHT,
+ /**
+ * Represents the pan down-right button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN_RIGHT,
+ /**
+ * Represents the pan down button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN,
+ /**
+ * Represents the pan down-left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_DOWN_LEFT,
+ /**
+ * Represents the pan left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_LEFT,
+ /**
+ * Represents the pan up-left button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_PAN_UP_LEFT,
+ /**
+ * Represents the title toggle button
+ * If supported, this toggles between a top-down view and an angled/3D view.
+ * If your app supports different, but substantially similar options, then you may implement those.
+ * If you don't implement these or similar options, do not subscribe to this button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_TILT_TOGGLE,
+ /**
+ * Represents the rotate clockwise button
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ROTATE_CLOCKWISE,
+ /**
+ * Represents the rotate counterclockwise button
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_ROTATE_COUNTERCLOCKWISE,
+ /**
+ * Represents the heading toggle button
+ * If supported, this toggles between locking the orientation to north or to the vehicle's heading.
+ * If your app supports different, but substantially similar options, then you may implement those.
+ * If you don't implement these or similar options, do not subscribe to this button.
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ NAV_HEADING_TOGGLE
;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
index d6a0a63aa..0990ef5ad 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/GlobalProperty.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -68,7 +68,12 @@ public enum GlobalProperty{
* The on-screen keyboard configuration of setGlobalProperties
*/
- KEYBOARDPROPERTIES;
+ KEYBOARDPROPERTIES,
+
+ /**
+ * The user seat location of setGlobalProperties
+ */
+ USERLOCATION;
/**
* Convert String to GlobalProperty
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
index c88591a23..9c7aa2722 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/ImageFieldName.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
* The name that identifies the field.
@@ -103,6 +103,12 @@ public enum ImageFieldName {
* @since SmartDeviceLink 5.0
*/
secondaryGraphic,
+ /**
+ * The image field for Alert
+ *
+ * @since SmartDeviceLink 6.0.0
+ */
+ alertIcon,
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java
new file mode 100644
index 000000000..fcda7b498
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MenuLayout.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Created by brettywhite on 7/17/19 12:00 PM
+ *
+ */
+
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * How the main menu or submenu is laid out on screen
+ */
+public enum MenuLayout {
+
+ LIST,
+
+ TILES,
+
+ ;
+
+ public static MenuLayout valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
new file mode 100644
index 000000000..35b8833c0
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedWindows.java
@@ -0,0 +1,52 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+import java.util.EnumSet;
+
+/**
+ * specifies what windows and IDs are predefined and pre-created on behalf of the app.
+ *
+ * The default window is always available and represents the app window on the main display.
+ * It's an equivalent to today's app window.
+ * For backward compatibility, this will ensure the app always has at least the default window on the main display.
+ * The app can choose to use this predefined enum element to specifically address app's main window or to duplicate window content.
+ * It is not possible to duplicate another window to the default window.
+ *
+ * The primary widget is a special widget, that can be associated with a service type, which is used by the HMI whenever a single widget needs to represent the whole app.
+ * The primary widget should be named as the app and can be pre-created by the HMI
+ * @since 6.0
+ */
+public enum PredefinedWindows {
+ /**
+ * The default window is a main window pre-created on behalf of the app.
+ */
+ DEFAULT_WINDOW (0),
+ /**
+ * The primary widget of the app.
+ */
+ PRIMARY_WIDGET (1),
+
+ ;
+
+
+ final int VALUE;
+ /**
+ * Private constructor
+ */
+ PredefinedWindows (int value) {
+ this.VALUE = value;
+ }
+
+ public static PredefinedWindows valueForInt(int value) {
+
+ for (PredefinedWindows anEnum : EnumSet.allOf(PredefinedWindows.class)) {
+ if (anEnum.getValue() == value) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
+
+ public int getValue(){
+ return VALUE;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
index 1df3bcba5..7bc9454aa 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -212,6 +212,10 @@ public enum Result {
* The data sent failed to pass CRC check in receiver end
*/
CORRUPTED_DATA,
+ /**
+ * The data sent needs to be encrypted
+ */
+ ENCRYPTION_NEEDED,
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
index 03e321e61..cf5d50976 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java
@@ -933,6 +933,10 @@ public enum StaticIconName {
return null;
}
+ /**
+ * Returns the string representation of the hex value associated with this static icon
+ * @return string of the hex value representation of this static icon
+ */
@Override
public String toString() {
return INTERNAL_NAME;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
index 69ead0602..758a33905 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java
@@ -148,6 +148,13 @@ package com.smartdevicelink.proxy.rpc.enums;
* <td align=center>N</td>
* <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
* </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</strong></td>
+ * </tr>
* </table>
*
*/
@@ -277,11 +284,57 @@ public enum SystemCapabilityType {
* <td>DisplayCapabilities</td>
* <td>Returns Display Capabilities</td>
* <td align=center>N</td>
+ * <td> Available Synchronously <strong>after</strong> Register App Interface response received</td>
+ * </tr>
+ * </table>
+ */
+ @Deprecated
+ DISPLAY (false),
+
+
+ /**
+ * @since 6.0
+ * Returns: List<DisplayCapability>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>DISPLAYS</td>
+ * <td>List<DisplayCapability></td>
+ * <td>Returns a list of Display Capability</td>
+ * <td align=center>Y</td>
+ * <td> <strong>Since 6.0</strong> Contain the display related information and all windows related to that display.</td>
+ * </tr>
+ * </table>
+ */
+ DISPLAYS (true),
+
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * Returns: List<PrerecordedSpeech>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>PRERECORDED_SPEECH</td>
+ * <td>prerecordedSpeechCapabilities</td>
+ * <td>Returns List<PrerecordedSpeech></td>
+ * <td align=center>N</td>
* <td>Available Synchronously <strong>after</strong> Register App Interface response received</td>
* </tr>
* </table>
*/
- DISPLAY (false),
+ PRERECORDED_SPEECH (false),
/**
* Available Synchronously after Register App Interface response <br>
@@ -347,6 +400,7 @@ public enum SystemCapabilityType {
* </tr>
* </table>
*/
+ @Deprecated
BUTTON (false),
/**
@@ -389,6 +443,7 @@ public enum SystemCapabilityType {
* </tr>
* </table>
*/
+ @Deprecated
PRESET_BANK (false),
/**
@@ -412,6 +467,7 @@ public enum SystemCapabilityType {
* </tr>
* </table>
*/
+ @Deprecated
SOFTBUTTON (false),
/**
@@ -475,6 +531,27 @@ public enum SystemCapabilityType {
*/
APP_SERVICES (true),
+ /**
+ * Available Synchronously after Register App Interface response <br>
+ * <table border="1" rules="all">
+ * <tr>
+ * <th>Enum Name</th>
+ * <th>Return Type</th>
+ * <th>Description</th>
+ * <th>Requires Async?</th>
+ * <th>Notes</th>
+ * </tr>
+ * <tr>
+ * <td>SEAT_LOCATION</td>
+ * <td>SeatLocationCapability</td>
+ * <td>Returns SEAT_LOCATION</td>
+ * <td align=center>N</td>
+ * <td>Available Asynchronously, Call is synchronous <strong>after</strong> initial call</td>
+ * </tr>
+ * </table>
+ */
+ SEAT_LOCATION (true),
+
;
boolean IS_QUERYABLE;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
index f7258b933..a8fe4bd38 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TextFieldName.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/** Names of the text fields that can appear on the display.
*
@@ -154,7 +154,7 @@ public enum TextFieldName {
tertiaryText,
/** Optional text to label an app menu button (for certain touchscreen platforms).
*
- */
+ */
menuTitle,
/**
* Optional name / title of intended location for SendLocation.
@@ -175,11 +175,17 @@ public enum TextFieldName {
*/
addressLines,
/**
- * Optional hone number of intended location / establishment (if applicable) for SendLocation.
+ * Optional phone number of intended location / establishment (if applicable) for SendLocation.
*
* @since SmartDeviceLink 4.0
*/
phoneNumber,
+ /**
+ * Optional title of the template that will be displayed
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ templateTitle,
;
/**
* Convert String to TextFieldName
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
index 3ec32481a..f661ca7db 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataType.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.proxy.rpc.enums;
/**
@@ -161,6 +161,12 @@ public enum VehicleDataType {
* Notifies VEHICLEDATA_CLOUDAPPVEHICLEID may be subscribed
*/
VEHICLEDATA_CLOUDAPPVEHICLEID,
+ /**
+ * Notifies VEHICLEDATA_OEM_CUSTOM_DATA may be subscribed
+ *
+ * @since SmartDeviceLink 6.0
+ */
+ VEHICLEDATA_OEM_CUSTOM_DATA,
;
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
new file mode 100644
index 000000000..754b0433c
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/WindowType.java
@@ -0,0 +1,30 @@
+package com.smartdevicelink.proxy.rpc.enums;
+
+/**
+ * The type of the window to be created. Main window or widget.
+ * @since 6.0
+ */
+public enum WindowType {
+ /**
+ * This window type describes the main window on a display.
+ */
+ MAIN,
+ /**
+ * A widget is a small window that the app can create to provide information and soft buttons for quick app control.
+ */
+ WIDGET;
+
+ /**
+ * Convert String to WindowType
+ *
+ * @param value String
+ * @return WindowType
+ */
+ public static WindowType valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index 09919c598..ded3a9cd9 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec;
import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol;
+import com.smartdevicelink.util.DebugTool;
import java.util.List;
@@ -44,12 +45,15 @@ import java.util.List;
public class VideoStreamingParameters {
private final VideoStreamingProtocol DEFAULT_PROTOCOL = VideoStreamingProtocol.RAW;
private final VideoStreamingCodec DEFAULT_CODEC = VideoStreamingCodec.H264;
+ private final VideoStreamingFormat[] CURRENTLY_SUPPORTED_FORMATS = { new VideoStreamingFormat(VideoStreamingProtocol.RTP, VideoStreamingCodec.H264),
+ new VideoStreamingFormat(VideoStreamingProtocol.RAW, VideoStreamingCodec.H264) };
private final int DEFAULT_WIDTH = 1024;
private final int DEFAULT_HEIGHT = 576;
private final int DEFAULT_DENSITY = 240;
private final int DEFAULT_FRAMERATE = 30;
private final int DEFAULT_BITRATE = 512000;
private final int DEFAULT_INTERVAL = 5;
+ private final static double DEFAULT_SCALE = 1.0;
private int displayDensity;
@@ -132,14 +136,30 @@ public class VideoStreamingParameters {
*/
public void update(VideoStreamingCapability capability){
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
+ double scale = DEFAULT_SCALE;
+ if(capability.getScale() != null) { scale = capability.getScale(); }
ImageResolution resolution = capability.getPreferredResolution();
if(resolution!=null){
- if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight(resolution.getResolutionHeight()); }
- if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth(resolution.getResolutionWidth()); }
+
+ if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }
+ if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth((int)(resolution.getResolutionWidth() / scale)); }
}
- List<VideoStreamingFormat> formats = capability.getSupportedFormats();
+
+ // This should be the last call as it will return out once a suitable format is found
+ final List<VideoStreamingFormat> formats = capability.getSupportedFormats();
if(formats != null && formats.size()>0){
- this.format = formats.get(0);
+ for(VideoStreamingFormat format : formats){
+ for(int i = 0; i < CURRENTLY_SUPPORTED_FORMATS.length; i ++){
+ if(CURRENTLY_SUPPORTED_FORMATS[i].equals(format) ){
+ this.format = format;
+ return;
+ }
+ }
+ }
+ DebugTool.logWarning("The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
+
+ //TODO In the future we should set format to null, but might be a breaking change
+ // For now, format will remain whatever was set prior to this update
}
}
diff --git a/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java b/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
index 9aebffd48..9b3831dab 100644
--- a/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
+++ b/base/src/main/java/com/smartdevicelink/trace/OpenRPCMessage.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.trace;
import com.smartdevicelink.proxy.RPCMessage;
@@ -51,7 +51,7 @@ class OpenRPCMessage extends RPCMessage {
public String msgDump() {
StringBuilder pd = new StringBuilder();
- pd.append(this.getFunctionName() + " " + this.getMessageType());
+ pd.append(this.getFunctionName()).append(" ").append(this.getMessageType());
msgDump(pd);
diff --git a/base/src/main/java/com/smartdevicelink/util/CompareUtils.java b/base/src/main/java/com/smartdevicelink/util/CompareUtils.java
new file mode 100644
index 000000000..141b6ed35
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/util/CompareUtils.java
@@ -0,0 +1,23 @@
+package com.smartdevicelink.util;
+
+public class CompareUtils {
+
+ public static boolean areStringsEqual(String string1, String string2, boolean ignoreCase, boolean nullIsEqual){
+
+ if (string1 == null) {
+ if (string2 == null) {
+ return nullIsEqual;
+ } else {
+ return false;
+ }
+ } else {
+ //At least String 1 is not null, use it for the remaining checks
+ if (ignoreCase) {
+ return string1.equalsIgnoreCase(string2);
+ } else {
+ return string1.equals(string2);
+ }
+ }
+ }
+
+}
diff --git a/base/src/main/java/com/smartdevicelink/util/DebugTool.java b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
index f683c25af..dbf9185a8 100644
--- a/base/src/main/java/com/smartdevicelink/util/DebugTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/DebugTool.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.util;
import android.util.Log;
@@ -77,6 +77,7 @@ public class DebugTool {
return false;
}
+ @SuppressWarnings("ConstantConditions")
private static String prependProxyVersionNumberToString(String string) {
if (BuildConfig.VERSION_NAME != null && string != null) {
string = BuildConfig.VERSION_NAME + ": " + string;
@@ -163,21 +164,21 @@ public class DebugTool {
protected static String getLine(Throwable ex) {
if (ex == null) { return null; }
- String toPrint = ex.toString() + " :" + ex.getMessage();
+ StringBuilder toPrint = new StringBuilder(ex.toString() + " :" + ex.getMessage());
for (int i=0; i<ex.getStackTrace().length; i++) {
StackTraceElement elem = ex.getStackTrace()[i];
- toPrint += "\n " + elem.toString();
+ toPrint.append("\n ").append(elem.toString());
}
if (ex instanceof SdlException) {
SdlException sdlEx = (SdlException) ex;
if (sdlEx.getInnerException() != null && sdlEx != sdlEx.getInnerException()) {
- toPrint += "\n nested:\n";
- toPrint += getLine(sdlEx.getInnerException());
+ toPrint.append("\n nested:\n");
+ toPrint.append(getLine(sdlEx.getInnerException()));
}
}
- return toPrint;
+ return toPrint.toString();
}
@@ -378,8 +379,7 @@ public class DebugTool {
}
if (message.getBulkData() != null) hash.put(RPCStruct.KEY_BULK_DATA, message.getBulkData());
} else {
- final Hashtable<String, Object> mhash = JsonRPCMarshaller.unmarshall(message.getData());
- hash = mhash;
+ hash = JsonRPCMarshaller.unmarshall(message.getData());
}
return hash;
}
diff --git a/base/src/main/java/com/smartdevicelink/util/FileUtls.java b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
index b422cbbb4..5f317340b 100644
--- a/base/src/main/java/com/smartdevicelink/util/FileUtls.java
+++ b/base/src/main/java/com/smartdevicelink/util/FileUtls.java
@@ -44,11 +44,21 @@ import java.nio.file.Files;
public class FileUtls {
-
+ /**
+ * When using on Android, this method should only be used for Android Oreo and newer
+ * @param file the path to the file
+ * @return a byte array representation of the file if one exists
+ */
public static byte[] getFileData(String file){
return getFileData(file,null);
}
+ /**
+ * When using on Android, this method should only be used for Android Oreo and newer
+ * @param filePath the path to the file
+ * @param fileName the name of the file
+ * @return a byte array representation of the file if one exists
+ */
public static byte[] getFileData(String filePath, String fileName){
if(filePath != null && filePath.length() > 0) {
File file;
diff --git a/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java b/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
index 09014f954..3eee85a05 100644
--- a/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
+++ b/base/src/main/java/com/smartdevicelink/util/HttpRequestTask.java
@@ -138,7 +138,7 @@ public class HttpRequestTask extends AsyncTask<String, String, String> {
String inputLine;
while ((inputLine = reader.readLine()) != null)
- buffer.append(inputLine + "\n");
+ buffer.append(inputLine).append("\n");
if (buffer.length() == 0) {
// Stream was empty. No point in parsing.
if(cb!=null){
diff --git a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
index 3ee00b387..f125fb5ac 100644
--- a/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
+++ b/base/src/main/java/com/smartdevicelink/util/NativeLogTool.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+/*
+ * Copyright (c) 2017 - 2019, SmartDeviceLink Consortium, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
package com.smartdevicelink.util;
import android.util.Log;
@@ -113,7 +113,6 @@ public class NativeLogTool {
int bytesWritten = 0;
int substrSize = 0;
- String tag = source;
String chunk = null;
try {
for (int idx=0;idx < logMsg.length();idx += substrSize) {
@@ -121,23 +120,23 @@ public class NativeLogTool {
chunk = logMsg.substring(idx, idx + substrSize);
switch (ltarg) {
case Info:
- bytesWritten = Log.i(tag, chunk);
+ bytesWritten = Log.i(source, chunk);
break;
case Warning:
- bytesWritten = Log.w(tag, chunk);
+ bytesWritten = Log.w(source, chunk);
break;
case Error:
- bytesWritten = Log.e(tag, chunk);
+ bytesWritten = Log.e(source, chunk);
break;
}
if (bytesWritten < chunk.length()) {
- Log.e(TAG, "Calling Log.e: msg length=" + chunk.length() + ", bytesWritten=" + bytesWritten);
+ Log.e(TAG, "Calling Log.e: msg length=" + chunk.length() + ", bytesWritten=" + bytesWritten);
}
}
} catch (Exception ex) {
- Log.e(TAG, "Failure writing " + ltarg.name() + " fragments to android log:" + ex.toString());
+ Log.e(TAG, "Failure writing " + ltarg.name() + " fragments to android log:" + ex.toString());
return false;
}
return true;
}
-}
+}
diff --git a/base/src/main/java/com/smartdevicelink/util/Version.java b/base/src/main/java/com/smartdevicelink/util/Version.java
index 7ba0e026c..80f4dd7ba 100644
--- a/base/src/main/java/com/smartdevicelink/util/Version.java
+++ b/base/src/main/java/com/smartdevicelink/util/Version.java
@@ -32,6 +32,8 @@
package com.smartdevicelink.util;
+import android.support.annotation.NonNull;
+
public class Version {
final int major,minor,patch;
@@ -93,6 +95,32 @@ public class Version {
return -1;
}
+ /**
+ *
+ * @param minVersion the lowest version to be used in the comparison
+ * @param maxVersion the highest version to be used in the comparison
+ * @return -1 if this number is not between minVersion and maxVersion or if minVersion is greater than maxVersion, <br> 0 if the number is
+ * equal to either minVersion or maxVersion <br> 1 if the number is between the minVersion and maxVersion
+ */
+ public int isBetween(@NonNull Version minVersion, @NonNull Version maxVersion){
+ if(minVersion.isNewerThan(maxVersion) == 1){
+ return -1;
+ }
+
+ int resultsForMin = this.isNewerThan(minVersion);
+ int resultsForMax = this.isNewerThan(maxVersion);
+
+ if(resultsForMin == 0 || resultsForMax == 0){
+ return 0;
+ //return resultsForMin >= 0 && resultsForMax <=0;
+ }else if (resultsForMin == 1 && resultsForMax == -1 ){
+ return 1;
+ }else{
+ return -1;
+ }
+
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@@ -103,4 +131,6 @@ public class Version {
builder.append(patch);
return builder.toString();
}
+
+
}
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java
new file mode 120000
index 000000000..f35552f46
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java
@@ -0,0 +1 @@
+../../../../../../../base/src/main/java/com/smartdevicelink/managers/ServiceEncryptionListener.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
new file mode 120000
index 000000000..62dacca1e
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java
@@ -0,0 +1 @@
+../../../../../../../../base/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleConfigurationUpdate.java \ No newline at end of file
diff --git a/baseAndroid/src/main/java/com/smartdevicelink/util/CompareUtils.java b/baseAndroid/src/main/java/com/smartdevicelink/util/CompareUtils.java
new file mode 120000
index 000000000..9d331ba9c
--- /dev/null
+++ b/baseAndroid/src/main/java/com/smartdevicelink/util/CompareUtils.java
@@ -0,0 +1 @@
+../../../../../../../base/src/main/java/com/smartdevicelink/util/CompareUtils.java \ No newline at end of file
diff --git a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
index 4292c086c..2bc02fa2f 100644
--- a/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
+++ b/hello_sdl_java/src/main/java/com/smartdevicelink/java/SdlService.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -61,6 +62,8 @@ public class SdlService {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -133,6 +136,23 @@ public class SdlService {
@Override
public void onError(SdlManager sdlManager, String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
@@ -232,7 +252,7 @@ public class SdlService {
});
// sub menu parent cell
- MenuCell mainCell3 = new MenuCell("Test Cell 3 (sub menu)", null, Arrays.asList(subCell1,subCell2));
+ MenuCell mainCell3 = new MenuCell("Test Cell 3 (sub menu)", MenuLayout.LIST, null, Arrays.asList(subCell1,subCell2));
MenuCell mainCell4 = new MenuCell("Show Perform Interaction", null, null, new MenuSelectionListener() {
@Override
diff --git a/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java b/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
index cc6ebf243..779c357ee 100644
--- a/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
+++ b/hello_sdl_java_ee/src/main/java/com/smartdevicelink/SdlService.java
@@ -37,6 +37,7 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.managers.SdlManager;
import com.smartdevicelink.managers.SdlManagerListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.screen.choiceset.ChoiceCell;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSet;
import com.smartdevicelink.managers.screen.choiceset.ChoiceSetSelectionListener;
@@ -61,6 +62,8 @@ public class SdlService {
private static final String TAG = "SDL Service";
private static final String APP_NAME = "Hello Sdl";
+ private static final String APP_NAME_ES = "Hola Sdl";
+ private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";
private static final String ICON_FILENAME = "hello_sdl_icon.png";
@@ -133,6 +136,23 @@ public class SdlService {
@Override
public void onError(SdlManager sdlManager, String info, Exception e) {
}
+
+ @Override
+ public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){
+ String appName;
+ switch (language) {
+ case ES_MX:
+ appName = APP_NAME_ES;
+ break;
+ case FR_CA:
+ appName = APP_NAME_FR;
+ break;
+ default:
+ return null;
+ }
+
+ return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null);
+ }
};
diff --git a/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java b/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
index 72e92c24b..abbdd9638 100644
--- a/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
+++ b/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
@@ -32,5 +32,5 @@ package com.smartdevicelink;
// THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
public final class BuildConfig {
- public static final String VERSION_NAME = "4.9.1";
+ public static final String VERSION_NAME = "4.10.0";
} \ No newline at end of file
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
index 146382de9..83eb5f9bc 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManager.java
@@ -34,8 +34,10 @@ package com.smartdevicelink.managers;
import android.support.annotation.NonNull;
import android.util.Log;
+
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lifecycle.LifecycleManager;
import com.smartdevicelink.managers.permission.PermissionManager;
import com.smartdevicelink.managers.screen.ScreenManager;
@@ -43,22 +45,35 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
-import com.smartdevicelink.proxy.rpc.*;
+import com.smartdevicelink.proxy.rpc.ChangeRegistration;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SetAppIcon;
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.transport.BaseTransportConfig;
import com.smartdevicelink.transport.enums.TransportType;
import com.smartdevicelink.util.DebugTool;
import com.smartdevicelink.util.Version;
-import java.util.*;
+import org.json.JSONException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
/**
@@ -80,6 +95,7 @@ public class SdlManager extends BaseSdlManager{
private SdlArtwork appIcon;
private SdlManagerListener managerListener;
private List<Class<? extends SdlSecurityBase>> sdlSecList;
+ private ServiceEncryptionListener serviceEncryptionListener;
// Managers
@@ -105,6 +121,8 @@ public class SdlManager extends BaseSdlManager{
Log.i(TAG,"Proxy is connected. Now initializing.");
synchronized (this){
if(!initStarted){
+ changeRegistrationRetry = 0;
+ checkLifecycleConfiguration();
initialize();
initStarted = true;
}
@@ -184,7 +202,7 @@ public class SdlManager extends BaseSdlManager{
private void notifyDevListener(String info) {
if (managerListener != null) {
if (getState() == BaseSubManager.ERROR){
- managerListener.onError(this,info, null);
+ managerListener.onError(this, info, null);
} else {
managerListener.onStart(this);
}
@@ -212,6 +230,60 @@ public class SdlManager extends BaseSdlManager{
}
@Override
+ protected void checkLifecycleConfiguration() {
+ final Language actualLanguage = lifecycleManager.getRegisterAppInterfaceResponse().getLanguage();
+
+ if (actualLanguage != null && !actualLanguage.equals(hmiLanguage)) {
+
+ final LifecycleConfigurationUpdate lcu = managerListener.managerShouldUpdateLifecycle(actualLanguage);
+
+ if (lcu != null) {
+ ChangeRegistration changeRegistration = new ChangeRegistration(actualLanguage, actualLanguage);
+ changeRegistration.setAppName(lcu.getAppName());
+ changeRegistration.setNgnMediaScreenAppName(lcu.getShortAppName());
+ changeRegistration.setTtsName(lcu.getTtsName());
+ changeRegistration.setVrSynonyms(lcu.getVoiceRecognitionCommandNames());
+ changeRegistration.setOnRPCResponseListener(new OnRPCResponseListener() {
+ @Override
+ public void onResponse(int correlationId, RPCResponse response) {
+ if (response.getSuccess()) {
+ // go through and change sdlManager properties that were changed via the LCU update
+ hmiLanguage = actualLanguage;
+
+ if (lcu.getAppName() != null) {
+ appName = lcu.getAppName();
+ }
+
+ if (lcu.getShortAppName() != null) {
+ shortAppName = lcu.getShortAppName();
+ }
+
+ if (lcu.getTtsName() != null) {
+ ttsChunks = lcu.getTtsName();
+ }
+
+ if (lcu.getVoiceRecognitionCommandNames() != null) {
+ vrSynonyms = lcu.getVoiceRecognitionCommandNames();
+ }
+ }
+ try {
+ Log.v(TAG, response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(int correlationId, Result resultCode, String info) {
+ Log.e(TAG, "Change Registration onError: " + resultCode + " | Info: " + info);
+ }
+ });
+ _internalInterface.sendRPC(changeRegistration);
+ }
+ }
+ }
+
+ @Override
protected void initialize(){
// Instantiate sub managers
this.permissionManager = new PermissionManager(_internalInterface);
@@ -238,6 +310,10 @@ public class SdlManager extends BaseSdlManager{
this.screenManager.dispose();
}
+ if (this.lifecycleManager != null) {
+ this.lifecycleManager.stop();
+ }
+
if(managerListener != null){
managerListener.onDestroy(this);
managerListener = null;
@@ -248,7 +324,6 @@ public class SdlManager extends BaseSdlManager{
// MANAGER GETTERS
-
/**
* Gets the PermissionManager. <br>
* <strong>Note: PermissionManager should be used only after SdlManager.start() CompletionListener callback is completed successfully.</strong>
@@ -471,7 +546,7 @@ public class SdlManager extends BaseSdlManager{
_internalInterface = lifecycleManager.getInternalInterface(SdlManager.this);
if (sdlSecList != null && !sdlSecList.isEmpty()) {
- lifecycleManager.setSdlSecurityClassList(sdlSecList);
+ lifecycleManager.setSdlSecurity(sdlSecList, serviceEncryptionListener);
}
//Setup the notification queue
@@ -643,12 +718,24 @@ public class SdlManager extends BaseSdlManager{
* Sets the Security libraries
* @param secList The list of security class(es)
*/
+ @Deprecated
public Builder setSdlSecurity(List<Class<? extends SdlSecurityBase>> secList) {
sdlManager.sdlSecList = secList;
return this;
}
/**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public Builder setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ sdlManager.sdlSecList = secList;
+ sdlManager.serviceEncryptionListener = listener;
+ return this;
+ }
+
+ /**
* Set the SdlManager Listener
* @param listener the listener
*/
@@ -706,4 +793,12 @@ public class SdlManager extends BaseSdlManager{
}
}
+ /**
+ * Start a secured RPC service
+ */
+ public void startRPCEncryption() {
+ if (lifecycleManager != null) {
+ lifecycleManager.startRPCEncryption();
+ }
+ }
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
index ee44f0d54..44d1e091a 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/SdlManagerListener.java
@@ -31,6 +31,9 @@
*/
package com.smartdevicelink.managers;
+import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+
public interface SdlManagerListener extends BaseSdlManagerListener {
/**
@@ -49,4 +52,17 @@ public interface SdlManagerListener extends BaseSdlManagerListener {
* @param e the exception
*/
void onError(SdlManager manager, String info, Exception e);
+
+ /**
+ * Called when the SDL manager detected a language mismatch. In case of a language mismatch the
+ * manager should change the apps registration by updating the lifecycle configuration to the
+ * specified language. If the app can support the specified language it should return an Object
+ * of LifecycleConfigurationUpdate, otherwise it should return null to indicate that the language
+ * is not supported.
+ *
+ * @param language The language of the connected head unit the manager is trying to update the configuration.
+ * @return An object of LifecycleConfigurationUpdate if the head unit language is supported,
+ * otherwise null to indicate that the language is not supported.
+ */
+ LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language);
}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index f13b523aa..eb947fe0a 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
@@ -36,6 +36,7 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
+import com.smartdevicelink.util.DebugTool;
/**
* A class that extends SdlFile, representing artwork (JPEG, PNG, or BMP) to be uploaded to core
@@ -97,8 +98,8 @@ public class SdlArtwork extends SdlFile implements Cloneable{
@Override
- public void setType(@NonNull FileType fileType) {
- if(fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
+ public void setType(FileType fileType) {
+ if(fileType == null || fileType.equals(FileType.GRAPHIC_JPEG) || fileType.equals(FileType.GRAPHIC_PNG)
|| fileType.equals(FileType.GRAPHIC_BMP)){
super.setType(fileType);
}else{
@@ -135,26 +136,17 @@ public class SdlArtwork extends SdlFile implements Cloneable{
*/
@Override
public SdlArtwork clone() {
- final SdlArtwork clone;
- try {
- clone = (SdlArtwork) super.clone();
+ try{
+ SdlArtwork artwork = (SdlArtwork) super.clone();
+ if(artwork != null){
+ artwork.imageRPC = artwork.createImageRPC();
+ }
+ return artwork;
} catch (CloneNotSupportedException e) {
- throw new RuntimeException("superclass messed up", e);
- }
- clone.setName(this.getName());
- clone.setFilePath(this.getFilePath());
- if (this.getFileData() != null){
- byte[] data = new byte[this.getFileData().length];
- for (int i = 0; i < this.getFileData().length; i++) {
- data[i] = this.getFileData()[i];
+ if(DebugTool.isDebugEnabled()){
+ throw new RuntimeException("Clone not supported by super class");
}
- clone.setFileData(data);
}
- clone.setType(this.getType());
- clone.setPersistent(this.isPersistent());
- clone.setStaticIcon(this.isStaticIcon());
- clone.isTemplate = this.isTemplate;
- clone.imageRPC = this.createImageRPC();
- return clone;
+ return null;
}
} \ No newline at end of file
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
new file mode 100644
index 000000000..1d5915bf4
--- /dev/null
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/EncryptionLifecycleManager.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2019 Livio, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Livio Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.smartdevicelink.managers.lifecycle;
+
+import android.support.annotation.NonNull;
+
+import com.smartdevicelink.managers.ServiceEncryptionListener;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+
+class EncryptionLifecycleManager extends BaseEncryptionLifecycleManager {
+
+ EncryptionLifecycleManager(@NonNull ISdl internalInterface, ServiceEncryptionListener listener) {
+ super(internalInterface, listener);
+ }
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
index c82d7c3c6..5ae5cd8f1 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/lifecycle/LifecycleManager.java
@@ -32,22 +32,60 @@
package com.smartdevicelink.managers.lifecycle;
+import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.util.Log;
+
import com.smartdevicelink.SdlConnection.ISdlConnectionListener;
import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.managers.SdlManager;
+import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.proxy.*;
-import com.smartdevicelink.proxy.interfaces.*;
-import com.smartdevicelink.proxy.rpc.*;
-import com.smartdevicelink.proxy.rpc.enums.*;
-import com.smartdevicelink.proxy.rpc.listeners.*;
+import com.smartdevicelink.proxy.RPCMessage;
+import com.smartdevicelink.proxy.RPCNotification;
+import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.RPCResponse;
+import com.smartdevicelink.proxy.SystemCapabilityManager;
+import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
+import com.smartdevicelink.proxy.interfaces.ISdl;
+import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
+import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.interfaces.OnSystemCapabilityListener;
+import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
+import com.smartdevicelink.proxy.rpc.OnButtonEvent;
+import com.smartdevicelink.proxy.rpc.OnButtonPress;
+import com.smartdevicelink.proxy.rpc.OnHMIStatus;
+import com.smartdevicelink.proxy.rpc.OnSystemRequest;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterface;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
+import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
+import com.smartdevicelink.proxy.rpc.SubscribeButton;
+import com.smartdevicelink.proxy.rpc.SystemRequest;
+import com.smartdevicelink.proxy.rpc.TTSChunk;
+import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
+import com.smartdevicelink.proxy.rpc.UnregisterAppInterface;
+import com.smartdevicelink.proxy.rpc.VehicleType;
+import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
+import com.smartdevicelink.proxy.rpc.enums.AppInterfaceUnregisteredReason;
+import com.smartdevicelink.proxy.rpc.enums.ButtonName;
+import com.smartdevicelink.proxy.rpc.enums.FileType;
+import com.smartdevicelink.proxy.rpc.enums.HMILevel;
+import com.smartdevicelink.proxy.rpc.enums.Language;
+import com.smartdevicelink.proxy.rpc.enums.RequestType;
+import com.smartdevicelink.proxy.rpc.enums.Result;
+import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
+import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
+import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
+import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.security.SdlSecurityBase;
import com.smartdevicelink.streaming.audio.AudioStreamingCodec;
import com.smartdevicelink.streaming.audio.AudioStreamingParams;
@@ -64,7 +102,7 @@ import java.util.Vector;
import java.util.concurrent.CopyOnWriteArrayList;
/**
- * The lifecycle manager creates a centeral point for all SDL session logic to converge. It should only be used by
+ * 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)
@@ -72,7 +110,7 @@ public class LifecycleManager extends BaseLifecycleManager {
private static final String TAG = "Lifecycle Manager";
- public static final Version MAX_SUPPORTED_RPC_VERSION = new Version(5, 1, 0);
+ public static final Version MAX_SUPPORTED_RPC_VERSION = new Version(6, 0, 0);
// Protected Correlation IDs
private final int REGISTER_APP_INTERFACE_CORRELATION_ID = 65529,
@@ -100,6 +138,7 @@ public class LifecycleManager extends BaseLifecycleManager {
private final HashMap<Integer, CopyOnWriteArrayList<OnRPCRequestListener>> rpcRequestListeners;
protected final SystemCapabilityManager systemCapabilityManager;
+ private EncryptionLifecycleManager encryptionLifecycleManager;
protected RegisterAppInterfaceResponse raiResponse = null;
@@ -128,7 +167,6 @@ public class LifecycleManager extends BaseLifecycleManager {
this.session = new SdlSession(sdlConnectionListener, config);
this.systemCapabilityManager = new SystemCapabilityManager(internalInterface);
-
}
public void start(){
@@ -141,6 +179,15 @@ public class LifecycleManager extends BaseLifecycleManager {
}
+ /**
+ * Start a secured RPC service
+ */
+ public void startRPCEncryption() {
+ if (session != null) {
+ session.startService(SessionType.RPC, session.getSessionId(), true);
+ }
+ }
+
public void stop(){
session.close();
}
@@ -419,8 +466,16 @@ public class LifecycleManager extends BaseLifecycleManager {
}
break;
case ON_APP_INTERFACE_UNREGISTERED:
- Log.v(TAG, "on app interface unregistered");
- cleanProxy();
+
+ OnAppInterfaceUnregistered onAppInterfaceUnregistered = (OnAppInterfaceUnregistered) message;
+
+ if (!onAppInterfaceUnregistered.getReason().equals(AppInterfaceUnregisteredReason.LANGUAGE_CHANGE)) {
+ Log.v(TAG, "on app interface unregistered");
+ cleanProxy();
+ }else{
+ Log.v(TAG, "re-registering for language change");
+ processLanguageChange();
+ }
break;
case UNREGISTER_APP_INTERFACE:
Log.v(TAG, "unregister app interface");
@@ -434,6 +489,19 @@ public class LifecycleManager extends BaseLifecycleManager {
};
+ private void processLanguageChange(){
+ if (session != null) {
+ if (session.getIsConnected()) {
+ session.close();
+ }
+ try {
+ session.startSession();
+ } catch (SdlException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
/* *******************************************************************************************************
********************************** INTERNAL - RPC LISTENERS !! END !! *********************************
*********************************************************************************************************/
@@ -714,7 +782,7 @@ public class LifecycleManager extends BaseLifecycleManager {
message.format(rpcSpecVersion,true);
byte[] msgBytes = JsonRPCMarshaller.marshall(message, (byte)getProtocolVersion().getMajor());
- ProtocolMessage pm = new ProtocolMessage();
+ final ProtocolMessage pm = new ProtocolMessage();
pm.setData(msgBytes);
if (session != null){
pm.setSessionID(session.getSessionId());
@@ -723,7 +791,24 @@ public class LifecycleManager extends BaseLifecycleManager {
pm.setMessageType(MessageType.RPC);
pm.setSessionType(SessionType.RPC);
pm.setFunctionID(FunctionID.getFunctionId(message.getFunctionName()));
- pm.setPayloadProtected(message.isPayloadProtected());
+
+ if (encryptionLifecycleManager != null && encryptionLifecycleManager.isEncryptionReady() && encryptionLifecycleManager.getRPCRequiresEncryption(message.getFunctionID())) {
+ pm.setPayloadProtected(true);
+ } else {
+ pm.setPayloadProtected(message.isPayloadProtected());
+ }
+ if (pm.getPayloadProtected() && (encryptionLifecycleManager == null || !encryptionLifecycleManager.isEncryptionReady())){
+ String errorInfo = "Trying to send an encrypted message and there is no secured service";
+ if (message.getMessageType().equals((RPCMessage.KEY_REQUEST))) {
+ RPCRequest request = (RPCRequest) message;
+ OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
+ if (listener != null) {
+ listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
+ }
+ }
+ DebugTool.logWarning(errorInfo);
+ return;
+ }
if(RPCMessage.KEY_REQUEST.equals(message.getMessageType())){ // Request Specifics
pm.setRPCType((byte)0x00);
@@ -1092,6 +1177,11 @@ public class LifecycleManager extends BaseLifecycleManager {
public Version getProtocolVersion() {
return LifecycleManager.this.getProtocolVersion();
}
+
+ @Override
+ public void startRPCEncryption() {
+ LifecycleManager.this.startRPCEncryption();
+ }
};
/* *******************************************************************************************************
@@ -1323,12 +1413,26 @@ public class LifecycleManager extends BaseLifecycleManager {
if (session != null && session.getIsConnected()) {
session.close();
}
+ if (encryptionLifecycleManager != null){
+ encryptionLifecycleManager.dispose();
+ }
}
+ @Deprecated
public void setSdlSecurityClassList(List<Class<? extends SdlSecurityBase>> list) {
_secList = list;
}
+ /**
+ * Sets the security libraries and a callback to notify caller when there is update to encryption service
+ * @param secList The list of security class(es)
+ * @param listener The callback object
+ */
+ public void setSdlSecurity(@NonNull List<Class<? extends SdlSecurityBase>> secList, ServiceEncryptionListener listener) {
+ this._secList = secList;
+ this.encryptionLifecycleManager = new EncryptionLifecycleManager(internalInterface, listener);
+ }
+
private void processRaiResponse(RegisterAppInterfaceResponse rai) {
if (rai == null) return;
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java b/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
index f470b8a68..df14bfa6f 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/screen/choiceset/ChoiceSetManager.java
@@ -33,7 +33,6 @@
package com.smartdevicelink.managers.screen.choiceset;
import android.support.annotation.NonNull;
-
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.proxy.interfaces.ISdl;