summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Kast <Julian.kast@livio.io>2020-03-12 10:12:53 -0400
committerGitHub <noreply@github.com>2020-03-12 10:12:53 -0400
commit1c504e7f81407983e489d1373a7dde84de68cd9a (patch)
tree6434ccec15450de81e3e744d1e314da29090ea89
parent3dae17bdbbc163c5ce8747cb1e0a35842708c225 (diff)
parentf8a9b3229795ad1abff756261a177cff3308dfb1 (diff)
downloadsdl_android-bugfix/issue_1257.tar.gz
Merge branch 'develop' into bugfix/issue_1257bugfix/issue_1257
-rw-r--r--.github/workflows/android.yml9
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java388
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java3
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java4
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java111
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MessageTypeTests.java94
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java111
-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/TimerModeTests.java107
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java115
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java33
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java8
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java27
-rw-r--r--android/sdl_android/src/main/res/values/sdl.xml2
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java30
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java6
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java57
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java57
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Result.java1
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/StaticIconName.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TimerMode.java64
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java58
-rw-r--r--javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java30
42 files changed, 1296 insertions, 221 deletions
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 99e4a5029..31d0e4547 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -1,6 +1,6 @@
name: GitHub CI
-on: [push]
+on: [push, pull_request]
jobs:
test:
@@ -8,7 +8,7 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v1
+ uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v1
@@ -17,7 +17,7 @@ jobs:
- name: Sdl Android Tests
# For more info, please check out: https://github.com/marketplace/actions/android-emulator-runner
- uses: reactivecircus/android-emulator-runner@v1
+ uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./android/gradlew -p ./android :sdl_android:connectedCheck
@@ -35,7 +35,6 @@ jobs:
run: ./javaEE/gradlew -p ./javaEE test
- name: Codecov
- uses: codecov/codecov-action@v1.0.4
+ uses: codecov/codecov-action@v1.0.6
with:
- token: ${{secrets.CODECOV_TOKEN}}
yml: ./codecov.yml
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 18905a747..0b4761f2c 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
@@ -136,21 +136,6 @@ public class FileManagerTests extends AndroidTestCase2 {
}
};
- private Answer<Void> onListFilesFailure = new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- RPCRequest message = (RPCRequest) args[0];
- if(message instanceof ListFiles){
- int correlationId = message.getCorrelationID();
- ListFilesResponse listFilesResponse = new ListFilesResponse();
- listFilesResponse.setSuccess(false);
- message.getOnRPCResponseListener().onResponse(correlationId, listFilesResponse);
- }
- return null;
- }
- };
-
private Answer<Void> onPutFileSuccess = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
@@ -182,38 +167,40 @@ public class FileManagerTests extends AndroidTestCase2 {
}
};
- private Answer<Void> onSendRequestsSuccess = new Answer<Void>() {
+ private Answer<Void> onListDeleteRequestSuccess = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if(rpcs.get(0) instanceof PutFile){
- for(RPCRequest message : rpcs){
+ if (rpcs.get(0) instanceof DeleteFile) {
+ for (RPCRequest message : rpcs) {
int correlationId = message.getCorrelationID();
listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(true);
- listener.onResponse(correlationId, putFileResponse);
+ DeleteFileResponse deleteFileResponse = new DeleteFileResponse();
+ deleteFileResponse.setSuccess(true);
+ listener.onResponse(correlationId, deleteFileResponse);
}
+ listener.onFinished();
}
return null;
}
};
- private Answer<Void> onListDeleteRequestSuccess = new Answer<Void>() {
+ private Answer<Void> onListDeleteRequestFail = new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
if (rpcs.get(0) instanceof DeleteFile) {
+ Result resultCode = Result.REJECTED;
for (RPCRequest message : rpcs) {
int correlationId = message.getCorrelationID();
listener.addCorrelationId(correlationId);
DeleteFileResponse deleteFileResponse = new DeleteFileResponse();
deleteFileResponse.setSuccess(true);
- listener.onResponse(correlationId, deleteFileResponse);
+ listener.onError(correlationId, resultCode, "Binary data empty");
}
listener.onFinished();
}
@@ -221,20 +208,28 @@ public class FileManagerTests extends AndroidTestCase2 {
}
};
- private Answer<Void> onListDeleteRequestFail = new Answer<Void>() {
+ private Answer<Void> onSendRequestsFailPartialOnError = new Answer<Void>() {
@Override
- public Void answer(InvocationOnMock invocation) {
+ public Void answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if (rpcs.get(0) instanceof DeleteFile) {
+ if (rpcs.get(0) instanceof PutFile) {
Result resultCode = Result.REJECTED;
+ boolean flip = false;
for (RPCRequest message : rpcs) {
int correlationId = message.getCorrelationID();
listener.addCorrelationId(correlationId);
- DeleteFileResponse deleteFileResponse = new DeleteFileResponse();
- deleteFileResponse.setSuccess(true);
- listener.onError(correlationId, resultCode, "Binary data empty");
+ PutFileResponse putFileResponse = new PutFileResponse();
+ if (flip) {
+ putFileResponse.setSuccess(true);
+ flip = false;
+ listener.onResponse(correlationId, putFileResponse);
+ } else {
+ flip = true;
+ putFileResponse.setSuccess(false);
+ listener.onError(correlationId, resultCode, "Binary data empty");
+ }
}
listener.onFinished();
}
@@ -436,12 +431,16 @@ public class FileManagerTests extends AndroidTestCase2 {
verify(internalInterface, times(5)).sendRequests(any(List.class),any(OnMultipleRequestListener.class));
}
- public void testInitializationSuccess(){
+ /**
+ * Testing the initialization of FileManager
+ */
+ public void testInitializationSuccess() {
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -453,22 +452,6 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
- public void testInitializationFailure(){
- ISdl internalInterface = mock(ISdl.class);
-
- doAnswer(onListFilesFailure).when(internalInterface).sendRPCRequest(any(ListFiles.class));
-
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertFalse(success);
- assertEquals(fileManager.getState(), BaseSubManager.ERROR);
- assertEquals(BaseFileManager.SPACE_AVAILABLE_MAX_VALUE, fileManager.getBytesAvailable());
- }
- });
- }
-
/**
* Test file upload, success
*/
@@ -498,13 +481,17 @@ public class FileManagerTests extends AndroidTestCase2 {
assertEquals(Test.GENERAL_INT, fileManager.getBytesAvailable());
}
- public void testFileUploadFailure(){
+ /**
+ * Testing failed file upload.
+ */
+ public void testFileUploadFailure() {
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
- doAnswer(onPutFileFailure).when(internalInterface).sendRPCRequest(any(PutFile.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileFailure).when(internalInterface).sendRPC(any(PutFile.class));
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -521,12 +508,16 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
- public void testFileUploadForStaticIcon(){
+ /**
+ * Testing uploadFile for a staticIcon, verifying that it doesn't actually upload.
+ */
+ public void testFileUploadForStaticIcon() {
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -540,14 +531,82 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
});
+ verify(internalInterface, times(1)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Testing uploadFiles for staticIcons, verifying that it doesn't actually upload.
+ */
+ public void testMultipleFileUploadsForStaticIcon() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
+ List<SdlArtwork> testStaticIconUpload = new ArrayList<>();
+ testStaticIconUpload.add(artwork);
+ testStaticIconUpload.add(artwork2);
+ fileManager.uploadFiles(testStaticIconUpload, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors == null);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(0)).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+ }
+
+ /**
+ * Testing uploadFiles for static icons and nonStatic icons in the same list.
+ */
+ public void testMultipleFileUploadsForPartialStaticIcon() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
+ SdlArtwork artwork2 = new SdlArtwork(StaticIconName.FILENAME);
+ List<SdlFile> testFileuploads = new ArrayList<>();
+ testFileuploads.add(artwork);
+ testFileuploads.add(artwork2);
+ testFileuploads.add(validFile);
+ fileManager.uploadFiles(testFileuploads, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertTrue(errors == null);
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(1)).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
}
- public void testInvalidSdlFileInput(){
+ /**
+ * Test to make sure you cannot upload an SdlFile with invalid data
+ */
+ public void testInvalidSdlFileInput() {
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -578,6 +637,12 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
+ /**
+ * Used to try and upload SdlFiles with invalid data, throw an assert error if file uploads
+ *
+ * @param fileManager - FileManager used to manage and upload files
+ * @param sdlFile - SdlFile with invalid data to test uploading
+ */
private void checkForUploadFailure(FileManager fileManager, SdlFile sdlFile){
boolean error = false;
@@ -593,6 +658,10 @@ public class FileManagerTests extends AndroidTestCase2 {
assertTrue(error);
}
+ /**
+ * Test Invalid SdlArtWork FileTypes
+ * SdlArtwork FileTypes can only be: GRAPHIC_BMP, GRAPHIC_PNG or GRAPHIC_JPEG
+ */
public void testInvalidSdlArtworkInput(){
SdlArtwork sdlArtwork = new SdlArtwork();
// Set invalid type
@@ -647,99 +716,65 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
- public void testMultipleFileUploadPartialFailure(){
- final String failureReason = "No space available";
-
+ /**
+ * Testing uploading multiple files with some failing.
+ */
+ public void testMultipleFileUploadPartialFailure() {
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onSendRequestsFailPartialOnError).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
- Answer<Void> onSendRequestsFailure = new Answer<Void>() {
- private int responseNum = 0;
- @Override
- public Void answer(InvocationOnMock invocation) {
- Object[] args = invocation.getArguments();
- List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
- OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
- if(rpcs.get(0) instanceof PutFile){
- for(RPCRequest message : rpcs){
- int correlationId = message.getCorrelationID();
- listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse();
- if(responseNum++ % 2 == 0){
- listener.onError(correlationId, Result.OUT_OF_MEMORY, failureReason);
- }else{
- putFileResponse.setSuccess(true);
- listener.onResponse(correlationId, putFileResponse);
- }
- }
- }
- return null;
- }
- };
- doAnswer(onSendRequestsFailure).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+ SdlFile validFile2 = new SdlFile();
+ validFile2.setName(Test.GENERAL_STRING + "2");
+ validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
- fileManager.start(new CompletionListener() {
- @Override
- public void onComplete(boolean success) {
- assertTrue(success);
- final String baseFileName = "file";
- int fileNum = 0;
- final List<SdlFile> filesToUpload = new ArrayList<>();
- SdlFile sdlFile = new SdlFile();
- sdlFile.setName(baseFileName + fileNum++);
- Uri uri = Uri.parse("android.resource://" + mTestContext.getPackageName() + "/drawable/ic_sdl");
- sdlFile.setUri(uri);
- filesToUpload.add(sdlFile);
+ SdlFile validFile3 = new SdlFile();
+ validFile3.setName(Test.GENERAL_STRING + "3");
+ validFile3.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile3.setPersistent(false);
+ validFile3.setType(FileType.GRAPHIC_JPEG);
- sdlFile = new SdlFile();
- sdlFile.setName(baseFileName + fileNum++);
- sdlFile.setResourceId(com.smartdevicelink.test.R.drawable.ic_sdl);
- filesToUpload.add(sdlFile);
+ validFile.setType(FileType.AUDIO_WAVE);
- sdlFile = new SdlFile();
- sdlFile.setName(baseFileName + fileNum++);
- sdlFile.setFileData(Test.GENERAL_BYTE_ARRAY);
- sdlFile.setPersistent(true);
- sdlFile.setType(FileType.BINARY);
- filesToUpload.add(sdlFile);
+ final List<SdlFile> filesToUpload = new ArrayList<>();
+ filesToUpload.add(validFile);
+ filesToUpload.add(validFile2);
+ filesToUpload.add(validFile3);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(0);
+ fileManagerConfig.setFileRetryCount(0);
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
fileManager.uploadFiles(filesToUpload,
new MultipleFileCompletionListener() {
@Override
public void onComplete(Map<String, String> errors) {
- assertNotNull(errors);
- for(int i = 0; i < filesToUpload.size(); i++){
- if(i % 2 == 0){
- assertTrue(errors.containsKey(filesToUpload.get(i).getName()));
- assertEquals(FileManager.buildErrorString(Result.OUT_OF_MEMORY,
- failureReason), errors.get(filesToUpload.get(i).getName()));
- }else{
- assertFalse(errors.containsKey(filesToUpload.get(i).getName()));
- }
- }
- List <String> uploadedFileNames = fileManager.getRemoteFileNames();
- for(int i = 0; i < filesToUpload.size(); i++){
- if(i % 2 == 0){
- assertFalse(uploadedFileNames.contains(filesToUpload.get(i).getName()));
- }else{
- assertTrue(uploadedFileNames.contains(filesToUpload.get(i).getName()));
- }
- }
+ assertTrue(errors.size() == 2);
}
});
}
});
+ assertFalse(fileManager.hasUploadedFile(validFile) && fileManager.hasUploadedFile(validFile3));
+ assertTrue(fileManager.hasUploadedFile(validFile2));
}
+ /**
+ * Testing uploading multiple SdlArtwork files.
+ */
public void testMultipleArtworkUploadSuccess(){
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
- doAnswer(onSendRequestsSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -775,16 +810,20 @@ public class FileManagerTests extends AndroidTestCase2 {
});
}
+ /**
+ * Testing uploading persistent SdlFile
+ */
public void testPersistentFileUploaded(){
ISdl internalInterface = mock(ISdl.class);
- doAnswer(onListFilesSuccess).when(internalInterface).sendRPCRequest(any(ListFiles.class));
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
final SdlFile file = new SdlFile();
file.setName(Test.GENERAL_STRING_LIST.get(0));
file.setPersistent(true);
- final FileManager fileManager = new FileManager(internalInterface, mTestContext);
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
fileManager.start(new CompletionListener() {
@Override
public void onComplete(boolean success) {
@@ -860,3 +899,88 @@ public class FileManagerTests extends AndroidTestCase2 {
assertTrue(artwork1.equals(artwork2));
}
}
+
+/**
+ * Tests overwrite property for uploading a file.
+ * Checks to make sure file does not overwrite itself if overwrite property is set to false
+ */
+ public void testOverwriteFileProperty() {
+ ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onPutFileSuccess).when(internalInterface).sendRPC(any(PutFile.class));
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ validFile.setOverwrite(false);
+ fileManager.uploadFile(validFile, new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ assertTrue(success);
+ }
+ });
+
+ }
+ });
+ }
+ });
+ verify(internalInterface, times(2)).sendRPC(any(RPCMessage.class));
+ }
+
+ /**
+ * Tests overwrite property for uploading a list of files.
+ * Checks to make sure files do not overwrite themselves if overwrite property is set to false.
+ */
+ public void testOverWriteFilePropertyListFiles() {
+ final ISdl internalInterface = mock(ISdl.class);
+
+ doAnswer(onListFilesSuccess).when(internalInterface).sendRPC(any(ListFiles.class));
+ doAnswer(onListFileUploadSuccess).when(internalInterface).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+
+ final SdlFile validFile2 = new SdlFile();
+ validFile2.setName(Test.GENERAL_STRING + "2");
+ validFile2.setFileData(Test.GENERAL_BYTE_ARRAY);
+ validFile2.setPersistent(false);
+ validFile2.setType(FileType.GRAPHIC_JPEG);
+
+ final List<SdlFile> list = new ArrayList<>();
+ list.add(validFile);
+ list.add(validFile2);
+
+ FileManagerConfig fileManagerConfig = new FileManagerConfig();
+ fileManagerConfig.setArtworkRetryCount(2);
+ fileManagerConfig.setFileRetryCount(4);
+
+ final FileManager fileManager = new FileManager(internalInterface, mTestContext, fileManagerConfig);
+ fileManager.start(new CompletionListener() {
+ @Override
+ public void onComplete(boolean success) {
+ fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ validFile.setOverwrite(false);
+ validFile2.setOverwrite(false);
+ fileManager.uploadFiles(list, new MultipleFileCompletionListener() {
+ @Override
+ public void onComplete(Map<String, String> errors) {
+ assertNull(errors);
+ }
+ });
+ }
+ });
+
+ }
+ });
+ verify(internalInterface, times(1)).sendRequests(any(List.class), any(OnMultipleRequestListener.class));
+ }
+}
+
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
index 22e2cba2f..34b3f71aa 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/RpcConverterTest.java
@@ -25,6 +25,7 @@ public class RpcConverterTest extends AndroidTestCase2 {
FunctionID[] functionIDs = FunctionID.values();
for(FunctionID functionID : functionIDs) {
switch (functionID){
+ case RESERVED:
case SYNC_P_DATA:
case ON_SYNC_P_DATA:
case ENCODED_SYNC_P_DATA:
@@ -54,6 +55,7 @@ public class RpcConverterTest extends AndroidTestCase2 {
rpcClassName.append(RPC_PACKAGE);
switch (functionID) {
+ case RESERVED:
case SYNC_P_DATA:
case ON_SYNC_P_DATA:
case ENCODED_SYNC_P_DATA:
@@ -91,6 +93,7 @@ public class RpcConverterTest extends AndroidTestCase2 {
for(FunctionID functionID : functionIDs){
switch (functionID){
+ case RESERVED:
case SYNC_P_DATA:
case ON_SYNC_P_DATA:
case ENCODED_SYNC_P_DATA:
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
index cdc7375df..cc59924d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/AppInterfaceUnregisteredReasonTests.java
@@ -42,6 +42,8 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
AppInterfaceUnregisteredReason enumAppAuthorized = AppInterfaceUnregisteredReason.valueForString(example);
example = "PROTOCOL_VIOLATION";
AppInterfaceUnregisteredReason enumProtocolViolation = AppInterfaceUnregisteredReason.valueForString(example);
+ example = "UNSUPPORTED_HMI_RESOURCE";
+ AppInterfaceUnregisteredReason enumUnsupportedHMIResource = AppInterfaceUnregisteredReason.valueForString(example);
assertNotNull("USER_EXIT returned null", enumUserExit);
assertNotNull("IGNITION_OFF returned null", enumIgnitionOff);
@@ -55,6 +57,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
assertNotNull("FACTORY_DEFAULTS returned null", enumFactoryDefaults);
assertNotNull("APP_UNAUTHORIZED returned null", enumAppAuthorized);
assertNotNull("PROTOCOL_VIOLATION returned null", enumProtocolViolation);
+ assertNotNull("UNSUPPORTED_HMI_RESOURCE returned null", enumUnsupportedHMIResource);
}
/**
@@ -104,6 +107,7 @@ public class AppInterfaceUnregisteredReasonTests extends TestCase {
enumTestList.add(AppInterfaceUnregisteredReason.FACTORY_DEFAULTS);
enumTestList.add(AppInterfaceUnregisteredReason.APP_UNAUTHORIZED);
enumTestList.add(AppInterfaceUnregisteredReason.PROTOCOL_VIOLATION);
+ enumTestList.add(AppInterfaceUnregisteredReason.UNSUPPORTED_HMI_RESOURCE);
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/MaintenanceModeStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java
new file mode 100644
index 000000000..9254cd2b2
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MaintenanceModeStatusTests.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2020 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.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MaintenanceModeStatus;
+
+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.MaintenanceModeStatus}
+ */
+public class MaintenanceModeStatusTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "NORMAL";
+ MaintenanceModeStatus enumNormal = MaintenanceModeStatus.valueForString(example);
+ example = "NEAR";
+ MaintenanceModeStatus enumNear = MaintenanceModeStatus.valueForString(example);
+ example = "ACTIVE";
+ MaintenanceModeStatus enumActive = MaintenanceModeStatus.valueForString(example);
+ example = "FEATURE_NOT_PRESENT";
+ MaintenanceModeStatus enumFeatureNotPResent = MaintenanceModeStatus.valueForString(example);
+
+ assertNotNull("NORMAL returned null", enumNormal);
+ assertNotNull("NEAR returned null", enumNear);
+ assertNotNull("ACTIVE returned null", enumActive);
+ assertNotNull("FEATURE_NOT_PRESENT returned null", enumFeatureNotPResent);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "normAL";
+ try {
+ MaintenanceModeStatus temp = MaintenanceModeStatus.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 {
+ MaintenanceModeStatus temp = MaintenanceModeStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of MaintenanceModeStatus.
+ */
+ public void testListEnum() {
+ List<MaintenanceModeStatus> enumValueList = Arrays.asList(MaintenanceModeStatus.values());
+
+ List<MaintenanceModeStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(MaintenanceModeStatus.NORMAL);
+ enumTestList.add(MaintenanceModeStatus.NEAR);
+ enumTestList.add(MaintenanceModeStatus.ACTIVE);
+ enumTestList.add(MaintenanceModeStatus.FEATURE_NOT_PRESENT);
+
+ 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/MessageTypeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MessageTypeTests.java
new file mode 100644
index 000000000..354948cdf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/MessageTypeTests.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2020 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.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.MessageType;
+
+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.MessageType}
+ */
+public class MessageTypeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums() {
+ int example = 0;
+ MessageType enumRequest = MessageType.valueForInt(example);
+ example = 1;
+ MessageType enumResponse = MessageType.valueForInt(example);
+ example = 2;
+ MessageType enumNotification = MessageType.valueForInt(example);
+
+ assertNotNull("REQUEST returned null", enumRequest);
+ assertNotNull("RESPONSE returned null", enumResponse);
+ assertNotNull("NOTIFICATION returned null", enumNotification);
+
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum() {
+ int example = 3;
+ try {
+ MessageType temp = MessageType.valueForInt(example);
+ assertNull("Result of valueForString should be null.", temp);
+ } catch (IllegalArgumentException exception) {
+ fail("Invalid enum throws IllegalArgumentException.");
+ }
+ }
+
+
+ /**
+ * Verifies the possible enum values of MessageType.
+ */
+ public void testListEnum() {
+ List<MessageType> enumValueList = Arrays.asList(MessageType.values());
+
+ List<MessageType> enumTestList = new ArrayList<>();
+ enumTestList.add(MessageType.REQUEST);
+ enumTestList.add(MessageType.RESPONSE);
+ enumTestList.add(MessageType.NOTIFICATION);
+
+ 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/PermissionStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java
new file mode 100644
index 000000000..2a11db43f
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/PermissionStatusTests.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2020 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.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.PermissionStatus;
+
+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.PermissionStatus}
+ */
+public class PermissionStatusTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "ALLOWED";
+ PermissionStatus enumAllowed = PermissionStatus.valueForString(example);
+ example = "DISALLOWED";
+ PermissionStatus enumDisallowed = PermissionStatus.valueForString(example);
+ example = "USER_DISALLOWED";
+ PermissionStatus enumUserDisallowed = PermissionStatus.valueForString(example);
+ example = "USER_CONSENT_PENDING";
+ PermissionStatus enumUserConsentPending = PermissionStatus.valueForString(example);
+
+ assertNotNull("ALLOWED returned null", enumAllowed);
+ assertNotNull("DISALLOWED returned null", enumDisallowed);
+ assertNotNull("USER_DISALLOWED returned null", enumUserDisallowed);
+ assertNotNull("USER_CONSENT_PENDING returned null", enumUserConsentPending);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "DISALLOwed";
+ try {
+ PermissionStatus temp = PermissionStatus.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 {
+ PermissionStatus temp = PermissionStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of PermissionStatus.
+ */
+ public void testListEnum() {
+ List<PermissionStatus> enumValueList = Arrays.asList(PermissionStatus.values());
+
+ List<PermissionStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(PermissionStatus.ALLOWED);
+ enumTestList.add(PermissionStatus.DISALLOWED);
+ enumTestList.add(PermissionStatus.USER_DISALLOWED);
+ enumTestList.add(PermissionStatus.USER_CONSENT_PENDING);
+
+ 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 f3b374b4c..8bfec0490 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
@@ -28,6 +28,8 @@ public class ResultTests extends TestCase {
Result enumOutOfMemory = Result.valueForString(example);
example = "TOO_MANY_PENDING_REQUESTS";
Result enumTooManyPendingRequests = Result.valueForString(example);
+ example = "CHAR_LIMIT_EXCEEDED";
+ Result enumCharLimitExceeded = Result.valueForString(example);
example = "INVALID_ID";
Result enumInvalidId = Result.valueForString(example);
example = "DUPLICATE_NAME";
@@ -96,6 +98,7 @@ public class ResultTests extends TestCase {
assertNotNull("UNSUPPORTED_REQUEST returned null", enumUnsupportedRequest);
assertNotNull("OUT_OF_MEMORY returned null", enumOutOfMemory);
assertNotNull("TOO_MANY_PENDING_REQUESTS returned null", enumTooManyPendingRequests);
+ assertNotNull("CHAR_LIMIT_EXCEEDED returned null", enumCharLimitExceeded);
assertNotNull("INVALID_ID returned null", enumInvalidId);
assertNotNull("DUPLICATE_NAME returned null", enumDuplicateName);
assertNotNull("TOO_MANY_APPLICATIONS returned null", enumTooManyApplications);
@@ -169,6 +172,7 @@ public class ResultTests extends TestCase {
enumTestList.add(Result.UNSUPPORTED_REQUEST);
enumTestList.add(Result.OUT_OF_MEMORY);
enumTestList.add(Result.TOO_MANY_PENDING_REQUESTS);
+ enumTestList.add(Result.CHAR_LIMIT_EXCEEDED);
enumTestList.add(Result.INVALID_ID);
enumTestList.add(Result.DUPLICATE_NAME);
enumTestList.add(Result.TOO_MANY_APPLICATIONS);
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java
new file mode 100644
index 000000000..892159a0d
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/TimerModeTests.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2020 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.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.TimerMode;
+
+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.TimerMode}
+ */
+public class TimerModeTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "UP";
+ TimerMode enumUp = TimerMode.valueForString(example);
+ example = "DOWN";
+ TimerMode enumDown = TimerMode.valueForString(example);
+ example = "NONE";
+ TimerMode enumNone = TimerMode.valueForString(example);
+
+ assertNotNull("UP returned null", enumUp);
+ assertNotNull("DOWN returned null", enumDown);
+ assertNotNull("NONE returned null", enumNone);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "NonE";
+ try {
+ TimerMode temp = TimerMode.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 {
+ TimerMode temp = TimerMode.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of TimerMode.
+ */
+ public void testListEnum() {
+ List<TimerMode> enumValueList = Arrays.asList(TimerMode.values());
+
+ List<TimerMode> enumTestList = new ArrayList<>();
+ enumTestList.add(TimerMode.UP);
+ enumTestList.add(TimerMode.DOWN);
+ enumTestList.add(TimerMode.NONE);
+
+ 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/VehicleDataActiveStatusTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java
new file mode 100644
index 000000000..b6ba15a7a
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/VehicleDataActiveStatusTests.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2020 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.test.rpc.enums;
+
+import com.smartdevicelink.proxy.rpc.enums.VehicleDataActiveStatus;
+
+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.VehicleDataActiveStatus}
+ */
+public class VehicleDataActiveStatusTests extends TestCase {
+
+ /**
+ * Verifies that the enum values are not null upon valid assignment.
+ */
+ public void testValidEnums () {
+ String example = "INACTIVE_NOT_CONFIRMED";
+ VehicleDataActiveStatus enumInactiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "INACTIVE_CONFIRMED";
+ VehicleDataActiveStatus enumInactiveConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "ACTIVE_NOT_CONFIRMED";
+ VehicleDataActiveStatus enumActiveNotConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "ACTIVE_CONFIRMED";
+ VehicleDataActiveStatus enumActiveConfirmed = VehicleDataActiveStatus.valueForString(example);
+ example = "FAULT";
+ VehicleDataActiveStatus enumFault = VehicleDataActiveStatus.valueForString(example);
+
+ assertNotNull("INACTIVE_NOT_CONFIRMED returned null", enumInactiveNotConfirmed);
+ assertNotNull("INACTIVE_CONFIRMED returned null", enumInactiveConfirmed);
+ assertNotNull("ACTIVE_NOT_CONFIRMED returned null", enumActiveNotConfirmed);
+ assertNotNull("ACTIVE_CONFIRMED returned null", enumActiveConfirmed);
+ assertNotNull("FAULT returned null", enumFault);
+ }
+
+ /**
+ * Verifies that an invalid assignment is null.
+ */
+ public void testInvalidEnum () {
+ String example = "FauLt";
+ try {
+ VehicleDataActiveStatus temp = VehicleDataActiveStatus.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 {
+ VehicleDataActiveStatus temp = VehicleDataActiveStatus.valueForString(example);
+ assertNull("Result of valueForString should be null.", temp);
+ }
+ catch (NullPointerException exception) {
+ fail("Null string throws NullPointerException.");
+ }
+ }
+
+ /**
+ * Verifies the possible enum values of VehicleDataActiveStatus.
+ */
+ public void testListEnum() {
+ List<VehicleDataActiveStatus> enumValueList = Arrays.asList(VehicleDataActiveStatus.values());
+
+ List<VehicleDataActiveStatus> enumTestList = new ArrayList<>();
+ enumTestList.add(VehicleDataActiveStatus.INACTIVE_NOT_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.INACTIVE_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.ACTIVE_NOT_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.ACTIVE_CONFIRMED);
+ enumTestList.add(VehicleDataActiveStatus.FAULT);
+
+ 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/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlArtwork.java
index e7db70ee6..ad837aae3 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
@@ -51,7 +51,7 @@ public class SdlArtwork extends SdlFile implements Cloneable{
/**
* Creates a new instance of SdlArtwork
*/
- public SdlArtwork(){}
+ public SdlArtwork() {}
/**
* Creates a new instance of SdlArtwork
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
index 3b6b80af0..05164cab5 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
@@ -43,18 +43,20 @@ import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
* A class representing data to be uploaded to core
*/
public class SdlFile{
- private String fileName;
- private int id = -1;
- private Uri uri;
- private byte[] fileData;
- private FileType fileType;
- private boolean persistentFile;
- private boolean isStaticIcon;
+ private String fileName;
+ private int id = -1;
+ private Uri uri;
+ private byte[] fileData;
+ private FileType fileType;
+ private boolean persistentFile;
+ private boolean isStaticIcon;
+ // Overwrite property by default is set to true in SdlFile constructors indicating that a file can be overwritten
+ private boolean overwrite = true;
/**
* Creates a new instance of SdlFile
*/
- public SdlFile(){}
+ public SdlFile() { }
/**
* Creates a new instance of SdlFile
@@ -255,4 +257,19 @@ public class SdlFile{
// return comparison
return hashCode() == o.hashCode();
}
+/**
+ * Gets the overwrite property for an SdlFile by default its set to true
+ * @return a boolean value that indicates if a file can be overwritten.
+ */
+ public boolean getOverwrite() {
+ return overwrite;
+ }
+
+ /**
+ * Sets the overwrite property for an SdlFile by default its set to true
+ * @param overwrite a boolean value that indicates if a file can be overwritten
+ */
+ public void setOverwrite(boolean overwrite) {
+ this.overwrite = overwrite;
+ }
} \ No newline at end of file
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
index e787fb77d..d046fe5ad 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCRequestFactory.java
@@ -1022,7 +1022,7 @@ public class RPCRequestFactory {
{
DeviceInfo msg = new DeviceInfo();
msg.setHardware(android.os.Build.MODEL);
- msg.setOs(DeviceInfo.DEVICE_OS);
+ msg.setOs("Android");
msg.setOsVersion(Build.VERSION.RELEASE);
msg.setCarrier(carrierName);
return msg;
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 5c886ff67..f6f5c7688 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
@@ -6721,7 +6721,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
DeviceInfo deviceInfo = new DeviceInfo();
deviceInfo.setHardware(android.os.Build.MODEL);
- deviceInfo.setOs(DeviceInfo.DEVICE_OS);
+ deviceInfo.setOs("Android");
deviceInfo.setOsVersion(Build.VERSION.RELEASE);
deviceInfo.setCarrier(carrierName);
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
index 7ebcec1c2..d72987a88 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/MultiplexUsbTransport.java
@@ -249,7 +249,7 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
if(!stateProgress){//We are trying to weed through the bad packet info until we get something
//Log.w(TAG, "Packet State Machine did not move forward from state - "+ psm.getState()+". PSM being Reset.");
psm.reset();
- buffer = new byte[READ_BUFFER_SIZE];
+ continue; //Move to the next iteration of the loop
}
if(psm.getState() == SdlPsm.FINISHED_STATE){
@@ -259,9 +259,11 @@ public class MultiplexUsbTransport extends MultiplexBaseTransport{
packet.setTransportRecord(getTransportRecord());
handler.obtainMessage(SdlRouterService.MESSAGE_READ, packet).sendToTarget();
}
- //We put a trace statement in the message read so we can avoid all the extra bytes
+ //Reset the PSM now that we have a finished packet.
+ //We will continue to loop through the data to see if any other packet
+ //is present.
psm.reset();
- buffer = new byte[READ_BUFFER_SIZE]; //FIXME just do an array copy and send off
+ continue; //Move to the next iteration of the loop
}
}
} catch (IOException e) {
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 3abd61094..bd86f86c2 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
@@ -69,6 +69,7 @@ import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.os.RemoteException;
+import android.service.notification.StatusBarNotification;
import android.support.annotation.NonNull;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
@@ -138,7 +139,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 = 10;
+ protected static final int ROUTER_SERVICE_VERSION_NUMBER = 11;
private static final String ROUTER_SERVICE_PROCESS = "com.smartdevicelink.router";
@@ -1443,8 +1444,9 @@ public class SdlRouterService extends Service{
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
builder.setContentIntent(pendingIntent);
- if(chronometerLength > 0 && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ if(chronometerLength > (FOREGROUND_TIMEOUT/1000) && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//The countdown method is only available in SDKs >= 24
+ // Only add countdown if it is over the min timeout
builder.setWhen(chronometerLength + System.currentTimeMillis());
builder.setUsesChronometer(true);
builder.setChronometerCountDown(true);
@@ -1516,6 +1518,27 @@ public class SdlRouterService extends Service{
synchronized (NOTIFICATION_LOCK) {
if (isForeground && !isPrimaryTransportConnected()) { //Ensure that the service is in the foreground and no longer connected to a transport
this.stopForeground(true);
+ NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
+ if (notificationManager!= null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ try {
+ boolean notificationHasDisplayed = false;
+ StatusBarNotification[] notifications = notificationManager.getActiveNotifications();
+ for (StatusBarNotification notification : notifications) {
+ if(notification != null && FOREGROUND_SERVICE_ID == notification.getId()){
+ DebugTool.logInfo("Service notification is being displayed");
+ notificationHasDisplayed = true;
+ break;
+ }
+ }
+ if (notificationHasDisplayed) {
+ notificationManager.deleteNotificationChannel(SDL_NOTIFICATION_CHANNEL_ID);
+ }
+ //else leave the notification channel alone to avoid deleting it before the
+ //foreground service notification has a chance to be displayed.
+ } catch (Exception e){
+ DebugTool.logError("Issue when deleting notification channel", e);
+ }
+ }
isForeground = false;
}
}
diff --git a/android/sdl_android/src/main/res/values/sdl.xml b/android/sdl_android/src/main/res/values/sdl.xml
index 2b3a85a05..16553ad29 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">10</integer>
+ <integer name="sdl_router_service_version_value">11</integer>
<string name="sdl_router_service_is_custom_name" translatable="false">sdl_custom_router</string>
</resources>
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 b2c9bd8a2..6dd65b40b 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
@@ -325,7 +325,12 @@ abstract class BaseFileManager extends BaseSubManager {
*/
public void uploadFile(@NonNull final SdlFile file, final CompletionListener listener) {
if (file.isStaticIcon()) {
- Log.w(TAG, "Static icons don't need to be uploaded");
+ Log.w(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ listener.onComplete(true);
+ return;
+ }
+ if (!file.getOverwrite() && hasUploadedFile(file)) {
+ Log.w(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
listener.onComplete(true);
return;
}
@@ -386,16 +391,29 @@ abstract class BaseFileManager extends BaseSubManager {
* @param files list of SdlFiles with file name and one of A) fileData, B) Uri, or C) resourceID set
* @param listener callback that is called once core responds to all upload requests
*/
- public void uploadFiles(@NonNull List<? extends SdlFile> files, final MultipleFileCompletionListener listener){
- if(files.isEmpty()){
+ public void uploadFiles(@NonNull List<? extends SdlFile> files, final MultipleFileCompletionListener listener) {
+ if (files.isEmpty()) {
return;
}
final List<PutFile> putFileRequests = new ArrayList<>();
- for(SdlFile file : files){
+ for (SdlFile file : files) {
+ if (file.isStaticIcon()) {
+ Log.w(TAG, String.format("%s is a static icon and doesn't need to be uploaded", file.getName()));
+ continue;
+ }
+ if (!file.getOverwrite() && hasUploadedFile(file)) {
+ Log.w(TAG, String.format("%s has already been uploaded and the overwrite property is set to false. It will not be uploaded again", file.getName()));
+ continue;
+ }
putFileRequests.add(createPutFile(file));
}
- final Map<String, String> errors = new HashMap<>();
- sendMultipleFileOperations(putFileRequests, listener, errors);
+ // if all files are static icons we complete listener with no errors
+ if (putFileRequests.isEmpty()) {
+ listener.onComplete(null);
+ } else {
+ final Map<String, String> errors = new HashMap<>();
+ sendMultipleFileOperations(putFileRequests, listener, errors);
+ }
}
/**
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 1000e3c1f..731504735 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
@@ -56,8 +56,7 @@ import java.util.List;
abstract class BaseVoiceCommandManager extends BaseSubManager {
- List<VoiceCommand> voiceCommands;
- List<VoiceCommand> oldVoiceCommands;
+ List<VoiceCommand> voiceCommands, oldVoiceCommands;
List<AddCommand> inProgressUpdate;
@@ -127,7 +126,10 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
waitingOnHMIUpdate = false;
lastVoiceCommandId = voiceCommandIdMin;
updateIdsOnVoiceCommands(voiceCommands);
- oldVoiceCommands = new ArrayList<>(voiceCommands);
+ this.oldVoiceCommands = new ArrayList<>();
+ if (this.voiceCommands != null && !this.voiceCommands.isEmpty()) {
+ this.oldVoiceCommands.addAll(this.voiceCommands);
+ }
this.voiceCommands = new ArrayList<>(voiceCommands);
update();
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 964000dad..b82443414 100644
--- a/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
+++ b/base/src/main/java/com/smartdevicelink/protocol/enums/FunctionID.java
@@ -43,6 +43,8 @@ public enum FunctionID{
ENCODED_SYNC_P_DATA(65536, "EncodedSyncPData"),
ON_ENCODED_SYNC_P_DATA(98304, "OnEncodedSyncPData"),
+ RESERVED(0, "RESERVED"),
+
// REQUESTS & RESPONSES
REGISTER_APP_INTERFACE(1, "RegisterAppInterface"),
UNREGISTER_APP_INTERFACE(2, "UnregisterAppInterface"),
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
index 2322b2f24..8113f2add 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/DeviceInfo.java
@@ -108,6 +108,7 @@ public class DeviceInfo extends RPCStruct{
public static final String KEY_OS_VERSION = "osVersion";
public static final String KEY_CARRIER = "carrier";
public static final String KEY_MAX_NUMBER_RFCOMM_PORTS = "maxNumberRFCOMMPorts";
+ @Deprecated
public static final String DEVICE_OS = "Android";
public DeviceInfo() { }
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
index ed4c21dba..31690e0ab 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/AppInterfaceUnregisteredReason.java
@@ -113,6 +113,12 @@ public enum AppInterfaceUnregisteredReason {
* @since SmartDeviceLink 4.0
*/
PROTOCOL_VIOLATION,
+ /**
+ * The HMI does not support resource.
+ *
+ * @since SmartDeviceLink 4.1
+ */
+ UNSUPPORTED_HMI_RESOURCE,
;
/**
* Convert String to AppInterfaceUnregisteredReason
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
index a91bd4d37..a9d530c0b 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/BitsPerSample.java
@@ -52,14 +52,14 @@ public enum BitsPerSample {
*/
_16_BIT("16_BIT");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private BitsPerSample(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private BitsPerSample(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static BitsPerSample valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
index dd0669795..00f912478 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Dimension.java
@@ -51,14 +51,14 @@ public enum Dimension {
*/
_3D("3D");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private Dimension(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private Dimension(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
index 109aef943..0c7c4f7e3 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/DisplayType.java
@@ -99,10 +99,10 @@ public enum DisplayType {
;
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private DisplayType(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private DisplayType(String value) {
+ this.VALUE = value;
}
public static DisplayType valueForString(String value) {
@@ -121,6 +121,6 @@ public enum DisplayType {
@Override
public String toString() {
- return INTERNAL_NAME;
+ return VALUE;
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
index f0ffcbed1..d8a720914 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/HMILevel.java
@@ -71,14 +71,14 @@ public enum HMILevel {
*/
HMI_NONE("NONE");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private HMILevel(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private HMILevel(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
index 99ab804eb..032a53bbe 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Jingle.java
@@ -41,14 +41,14 @@ public enum Jingle{
LISTEN("LISTEN_JINGLE"),
HELP("HELP_JINGLE");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private Jingle(String name){
- this.INTERNAL_NAME = name;
+ private Jingle(String value){
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static Jingle valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
index d0671fdc3..dab768296 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/Language.java
@@ -249,16 +249,16 @@ public enum Language {
TH_TH("TH-TH");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private Language(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private Language(String value) {
+ this.VALUE = value;
}
/**
* Returns a String representing a kind of Language
*/
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
/**
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
new file mode 100644
index 000000000..ebc4ed366
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MaintenanceModeStatus.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017 - 2020, 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;
+
+/**
+ * Reflects the status of a vehicle maintenance mode.
+ *
+ * @since SmartDeviceLink 2.0.0
+ */
+public enum MaintenanceModeStatus {
+ NORMAL,
+ NEAR,
+ ACTIVE,
+ FEATURE_NOT_PRESENT;
+
+ /**
+ * Convert String to MaintenanceModeStatus
+ * @param value String
+ * @return MaintenanceModeStatus
+ */
+ public static MaintenanceModeStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java
new file mode 100644
index 000000000..fe6152ee3
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MessageType.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017 - 2020, 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;
+
+import java.util.EnumSet;
+
+/**
+ * Enumeration linking message types with function types in WiPro protocol. Assumes
+ * enumeration starts at value 0.
+ *
+ * @since SmartDeviceLink 1.0.0
+ */
+public enum MessageType {
+ REQUEST(0),
+ RESPONSE(1),
+ NOTIFICATION(2);
+
+ private final int VALUE;
+
+ /**
+ * Private constructor
+ */
+ private MessageType (int value) {
+ this.VALUE = value;
+ }
+
+ /**
+ * Convert value to MessageType
+ * @param value int
+ * @return MessageType
+ */
+ public static MessageType valueForInt(int value) {
+ for (MessageType anEnum : EnumSet.allOf(MessageType.class)) {
+ if (anEnum.getValue() == value) {
+ return anEnum;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the value for the MessageType
+ * @return value for the MessageType
+ */
+ public int getValue(){
+ return VALUE;
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
index 07750b81f..23623fd8c 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/MetadataType.java
@@ -102,14 +102,14 @@ public enum MetadataType {
;
- private final String internalName;
+ private final String VALUE;
- private MetadataType(String internalName) {
- this.internalName = internalName;
+ private MetadataType(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.internalName;
+ return this.VALUE;
}
public static MetadataType valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
new file mode 100644
index 000000000..17b53d7a2
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PermissionStatus.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2017 - 2020, 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;
+
+/**
+ * Enumeration that describes possible permission states of a policy table entry.
+ *
+ * @since SmartDeviceLink 2.0.0
+ */
+public enum PermissionStatus {
+ ALLOWED,
+ DISALLOWED,
+ USER_DISALLOWED,
+ USER_CONSENT_PENDING;
+
+ /**
+ * Convert String to PermissionStatus
+ * @param value String
+ * @return PermissionStatus
+ */
+ public static PermissionStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
index 74f01165c..23439b007 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/PredefinedLayout.java
@@ -139,16 +139,16 @@ public enum PredefinedLayout {
LARGE_GRAPHIC_ONLY("LARGE_GRAPHIC_ONLY"),
;
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private PredefinedLayout(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private PredefinedLayout(String value) {
+ this.VALUE = value;
}
/**
* Returns a String representing a PredefinedLayout
*/
public String toString() {
- return this.INTERNAL_NAME;
+ return this.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 7bc9454aa..512cee9d2 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
@@ -69,6 +69,7 @@ public enum Result {
* delivered yet). There is a limit of 1000 pending requests at a time
*/
TOO_MANY_PENDING_REQUESTS,
+ CHAR_LIMIT_EXCEEDED,
/**
* <p>One of the provided IDs is not valid. For example:</p>
* <ul>
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
index 05cdc5519..10ab40020 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SamplingRate.java
@@ -64,14 +64,14 @@ public enum SamplingRate {
*/
_44KHZ("44KHZ");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private SamplingRate(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private SamplingRate(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static SamplingRate valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
index 82019ca99..f11025445 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SoftButtonType.java
@@ -52,14 +52,14 @@ public enum SoftButtonType {
*/
SBT_BOTH("BOTH");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private SoftButtonType(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private SoftButtonType(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static SoftButtonType valueForString(String value) {
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 cf5d50976..e3cbc7226 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
@@ -913,10 +913,10 @@ public enum StaticIconName {
;
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private StaticIconName(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private StaticIconName(String value) {
+ this.VALUE = value;
}
public static StaticIconName valueForString(String value) {
@@ -939,7 +939,7 @@ public enum StaticIconName {
*/
@Override
public String toString() {
- return INTERNAL_NAME;
+ return VALUE;
}
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java
index c78640a1e..18a3ad949 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemContext.java
@@ -73,14 +73,14 @@ public enum SystemContext {
*/
SYSCTXT_ALERT("ALERT");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private SystemContext(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private SystemContext(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static SystemContext valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TimerMode.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TimerMode.java
new file mode 100644
index 000000000..c901d3adf
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TimerMode.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017 - 2020, 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;
+
+/**
+ * @since SmartDeviceLink 1.0.0
+ */
+public enum TimerMode {
+ /**
+ * Causes the media clock timer to update from 0:00 to a specified time
+ */
+ UP,
+ /**
+ * Causes the media clock timer to update from a specified time to 0:00
+ */
+ DOWN,
+ /**
+ * Indicates to not use the media clock timer
+ */
+ NONE;
+
+ /**
+ * Convert String to TimerMode
+ *
+ * @param value String
+ * @return TimerMode
+ */
+ public static TimerMode valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java
index 4cab304f7..165fc21c9 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/TriggerSource.java
@@ -53,14 +53,14 @@ public enum TriggerSource {
TS_KEYBOARD("KEYBOARD");
- private final String INTERNAL_NAME;
+ private final String VALUE;
- private TriggerSource(String internalName) {
- this.INTERNAL_NAME = internalName;
+ private TriggerSource(String value) {
+ this.VALUE = value;
}
public String toString() {
- return this.INTERNAL_NAME;
+ return this.VALUE;
}
public static TriggerSource valueForString(String value) {
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
new file mode 100644
index 000000000..0afd389ee
--- /dev/null
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/enums/VehicleDataActiveStatus.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 - 2020, 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;
+
+/**
+ * Reflects the status of given vehicle component.
+ *
+ * @since SmartDeviceLink 2.0.0
+ */
+public enum VehicleDataActiveStatus {
+ INACTIVE_NOT_CONFIRMED,
+ INACTIVE_CONFIRMED,
+ ACTIVE_NOT_CONFIRMED,
+ ACTIVE_CONFIRMED,
+ FAULT;
+
+ /**
+ * Convert String to VehicleDataActiveStatus
+ * @param value String
+ * @return VehicleDataActiveStatus
+ */
+ public static VehicleDataActiveStatus valueForString(String value) {
+ try {
+ return valueOf(value);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
index f40ff237d..3b0a5e845 100644
--- a/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
+++ b/javaSE/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java
@@ -39,12 +39,14 @@ import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
* A class representing data to be uploaded to core
*/
public class SdlFile{
- private String fileName;
- private String filePath;
- private byte[] fileData;
- private FileType fileType;
- private boolean persistentFile;
- private boolean isStaticIcon;
+ private String fileName;
+ private String filePath;
+ private byte[] fileData;
+ private FileType fileType;
+ private boolean persistentFile;
+ private boolean isStaticIcon;
+ // Overwrite property by default is set to true in SdlFile constructors indicating that a file can be overwritten
+ private boolean overwrite = true;
/**
* Creates a new instance of SdlFile
@@ -219,4 +221,20 @@ public class SdlFile{
// return comparison
return hashCode() == o.hashCode();
}
+
+ /**
+ * Gets the overwrite property for an SdlFile by default its set to true
+ * @return a boolean value that indicates if a file can be overwritten.
+ */
+ public boolean getOverwrite() {
+ return overwrite;
+ }
+
+ /**
+ * Sets the overwrite property for an SdlFile by default its set to true
+ * @param overwrite a boolean value that indicates if a file can be overwritten
+ */
+ public void setOverwrite(boolean overwrite) {
+ this.overwrite = overwrite;
+ }
} \ No newline at end of file