summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-21 15:38:41 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-21 15:38:41 -0400
commitb667a9b159f6d7443acdcd1b5b230652dbd576b8 (patch)
treee1416419b659a11a0fb4bdb9d094a01dd8bfd7d9
parent4283bb73a2683c9a5a142552f341e898573076e2 (diff)
parentee8e3f15a1222853a7f64c6760e2ee51524e492e (diff)
downloadsdl_android-b667a9b159f6d7443acdcd1b5b230652dbd576b8.tar.gz
Merge branch 'develop' into feature/fix_scm_package
# Conflicts: # base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java # base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java # base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/file/FileManagerTests.java26
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java6
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java18
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java149
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java23
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java77
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java69
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java25
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java17
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java8
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java43
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java19
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java12
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java38
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java37
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java85
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java11
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java14
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java80
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java5
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java19
25 files changed, 217 insertions, 596 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
index b33c4f494..7c4fb11ff 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/SdlManagerTests.java
@@ -1,6 +1,7 @@
package com.smartdevicelink.managers;
import android.content.Context;
+
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.livio.taskmaster.Taskmaster;
@@ -18,7 +19,6 @@ import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.test.TestValues;
@@ -404,10 +404,6 @@ public class SdlManagerTests {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
}
};
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 dccd7c10b..8908346d2 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
@@ -72,10 +72,9 @@ public class FileManagerTests {
RPCRequest message = (RPCRequest) args[0];
if (message instanceof PutFile) {
int correlationId = message.getCorrelationID();
- Result resultCode = Result.REJECTED;
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(false);
- message.getOnRPCResponseListener().onError(correlationId, resultCode, "Binary data empty");
+ PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ message.getOnRPCResponseListener().onResponse(correlationId, putFileResponse);
}
return null;
}
@@ -88,13 +87,12 @@ public class FileManagerTests {
List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
if (rpcs.get(0) instanceof PutFile) {
- Result resultCode = Result.REJECTED;
for (RPCRequest message : rpcs) {
int correlationId = message.getCorrelationID();
listener.addCorrelationId(correlationId);
- PutFileResponse putFileResponse = new PutFileResponse();
- putFileResponse.setSuccess(true);
- listener.onError(correlationId, resultCode, "Binary data empty");
+ PutFileResponse putFileResponse = new PutFileResponse(false, Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, putFileResponse);
}
listener.onFinished();
}
@@ -197,13 +195,12 @@ public class FileManagerTests {
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.onError(correlationId, resultCode, "Binary data empty");
+ DeleteFileResponse deleteFileResponse = new DeleteFileResponse(false, Result.REJECTED);
+ deleteFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, deleteFileResponse);
}
listener.onFinished();
}
@@ -218,7 +215,6 @@ public class FileManagerTests {
List<RPCRequest> rpcs = (List<RPCRequest>) args[0];
OnMultipleRequestListener listener = (OnMultipleRequestListener) args[1];
if (rpcs.get(0) instanceof PutFile) {
- Result resultCode = Result.REJECTED;
boolean flip = false;
for (RPCRequest message : rpcs) {
int correlationId = message.getCorrelationID();
@@ -231,7 +227,9 @@ public class FileManagerTests {
} else {
flip = true;
putFileResponse.setSuccess(false);
- listener.onError(correlationId, resultCode, "Binary data empty");
+ putFileResponse.setResultCode(Result.REJECTED);
+ putFileResponse.setInfo("Binary data empty");
+ listener.onResponse(correlationId, putFileResponse);
}
}
listener.onFinished();
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
index 8e16c3ed0..b16889934 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/SubscribeButtonManagerTest.java
@@ -61,9 +61,9 @@ public class SubscribeButtonManagerTest {
Object[] args = invocation.getArguments();
RPCRequest message = (RPCRequest) args[0];
if(message instanceof SubscribeButton){
- SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse();
- subscribeButtonResponse.setSuccess(false);
- message.getOnRPCResponseListener().onError(message.getCorrelationID(), Result.GENERIC_ERROR, "Fail");
+ SubscribeButtonResponse subscribeButtonResponse = new SubscribeButtonResponse(false, Result.GENERIC_ERROR);
+ subscribeButtonResponse.setInfo("Fail");
+ message.getOnRPCResponseListener().onResponse(message.getCorrelationID(), subscribeButtonResponse);
}
return null;
}
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
index da8b48d8c..92670c7d4 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SdlProxyBaseTests.java
@@ -15,6 +15,7 @@ import com.smartdevicelink.proxy.SdlProxyBase;
import com.smartdevicelink.proxy.SdlProxyBuilder;
import com.smartdevicelink.proxy.SdlProxyConfigurationResources;
import com.smartdevicelink.proxy.interfaces.IProxyListenerALM;
+import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.ShowResponse;
import com.smartdevicelink.proxy.rpc.Speak;
@@ -229,15 +230,14 @@ public class SdlProxyBaseTests {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- onErrorListenerCounter++;
- remainingRequestsExpected--;
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
- onResponseListenerCounter++;
- remainingRequestsExpected--;
+ if (response.getSuccess()) {
+ onResponseListenerCounter++;
+ remainingRequestsExpected--;
+ } else {
+ onErrorListenerCounter++;
+ remainingRequestsExpected--;
+ }
}
};
try {
@@ -280,7 +280,7 @@ public class SdlProxyBaseTests {
while (rpcsTempList.size() != 0){
RPCRequest request = rpcsTempList.remove(0);
if (request instanceof Speak) {
- requestsMap.get(request).onError(request.getCorrelationID(), Result.DISALLOWED, "ERROR");
+ requestsMap.get(request).onResponse(request.getCorrelationID(), new GenericResponse(false, Result.DISALLOWED));
} else if (request instanceof Show) {
requestsMap.get(request).onResponse(request.getCorrelationID(), new ShowResponse(true, Result.SUCCESS));
}
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 af3f70501..90dba74bd 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
@@ -40,7 +40,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
-import androidx.annotation.NonNull;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.SparseArray;
@@ -49,6 +48,8 @@ import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.Surface;
+import androidx.annotation.NonNull;
+
import com.livio.taskmaster.Taskmaster;
import com.smartdevicelink.BuildConfig;
import com.smartdevicelink.Dispatcher.IDispatchingStrategy;
@@ -58,7 +59,6 @@ import com.smartdevicelink.SdlConnection.SdlSession;
import com.smartdevicelink.encoder.VirtualDisplayEncoder;
import com.smartdevicelink.exception.SdlException;
import com.smartdevicelink.exception.SdlExceptionCause;
-//import com.smartdevicelink.managers.video.HapticInterfaceManager;
import com.smartdevicelink.managers.ServiceEncryptionListener;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
import com.smartdevicelink.managers.lifecycle.RpcConverter;
@@ -68,7 +68,6 @@ import com.smartdevicelink.protocol.ProtocolMessage;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.MessageType;
import com.smartdevicelink.protocol.enums.SessionType;
-import com.smartdevicelink.protocol.heartbeat.HeartbeatMonitor;
import com.smartdevicelink.proxy.LockScreenManager.OnLockScreenIconDownloadedListener;
import com.smartdevicelink.proxy.callbacks.InternalProxyMessage;
import com.smartdevicelink.proxy.callbacks.OnError;
@@ -106,7 +105,6 @@ import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TouchType;
import com.smartdevicelink.proxy.rpc.enums.UpdateMode;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
@@ -160,6 +158,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.ScheduledExecutorService;
+//import com.smartdevicelink.managers.video.HapticInterfaceManager;
+
/**
* @deprecated use {@link com.smartdevicelink.managers.SdlManager} instead.
@@ -2144,7 +2144,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
RPCRequest request = (RPCRequest) message;
OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
if (listener != null) {
- listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
+ GenericResponse response = new GenericResponse(false, Result.REJECTED);
+ response.setInfo(errorInfo);
+ listener.onResponse(request.getCorrelationID(), response);
}
}
DebugTool.logWarning(TAG, errorInfo);
@@ -2207,23 +2209,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
}
/**
- * Only call this method for a PutFile response. It will cause a class cast exception if not.
- * @param correlationId correlation id of the packet being updated
- * @param bytesWritten how many bytes were written
- * @param totalSize the total size in bytes
- */
- @SuppressWarnings("unused")
- public void onPacketProgress(int correlationId, long bytesWritten, long totalSize){
- synchronized(ON_UPDATE_LISTENER_LOCK){
- if(rpcResponseListeners !=null
- && rpcResponseListeners.indexOfKey(correlationId)>=0){
- ((OnPutFileUpdateListener)rpcResponseListeners.get(correlationId)).onUpdate(correlationId, bytesWritten, totalSize);
- }
- }
-
- }
-
- /**
* Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
* <p>Will automatically remove the listener for the list of listeners on completion.
* @param msg The RPCResponse message that was received
@@ -2236,11 +2221,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
if(rpcResponseListeners !=null
&& rpcResponseListeners.indexOfKey(correlationId)>=0){
OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
- if(msg.getSuccess()){
- listener.onResponse(correlationId, msg);
- }else{
- listener.onError(correlationId, msg.getResultCode(), msg.getInfo());
- }
+ listener.onResponse(correlationId, msg);
rpcResponseListeners.remove(correlationId);
return true;
}
@@ -2258,9 +2239,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
synchronized(ON_UPDATE_LISTENER_LOCK){
if(rpcResponseListeners!=null
&& listener !=null){
- if(listener.getListenerType() == OnRPCResponseListener.UPDATE_LISTENER_TYPE_PUT_FILE){
- ((OnPutFileUpdateListener)listener).setTotalSize(totalSize);
- }
listener.onStart(correlationId);
rpcResponseListeners.put(correlationId, listener);
}
@@ -4517,27 +4495,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} catch (SdlException e) {
e.printStackTrace();
if (listener != null) {
- listener.onError(correlationId, Result.GENERIC_ERROR, e.toString());
- }
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener != null) {
- listener.onError(correlationId, resultCode, info);
- listener.onUpdate(rpcs.size());
- }
- try {
- // recurse after onError
- sendSequentialRequests(rpcs, listener);
- } catch (SdlException e) {
- e.printStackTrace();
- if (listener != null) {
- listener.onError(correlationId, Result.GENERIC_ERROR, e.toString());
+ GenericResponse genericResponse = new GenericResponse(false, Result.GENERIC_ERROR);
+ genericResponse.setInfo(e.toString());
+ listener.onResponse(correlationId, genericResponse);
}
}
}
@@ -4555,7 +4515,9 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
} catch (SdlException e) {
e.printStackTrace();
if (listener != null) {
- listener.onError(0, Result.GENERIC_ERROR, e.toString());
+ GenericResponse response = new GenericResponse(false, Result.REJECTED);
+ response.setInfo(e.toString());
+ listener.onResponse(0, response);
}
}
}
@@ -4619,17 +4581,6 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
listener.getSingleRpcResponseListener().onResponse(correlationId, response);
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- if (devOnRPCResponseListener != null){
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener.getSingleRpcResponseListener() != null) {
- listener.getSingleRpcResponseListener().onError(correlationId, resultCode, info);
- }
- }
});
}
sendRPCMessagePrivate(request);
@@ -7603,17 +7554,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* core to elsewhere in the system.
* @throws SdlException if an unrecoverable error is encountered
*/
- @SuppressWarnings("unused")
- public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
- //msg.setOnPutFileUpdateListener(cb);
- startRPCStream(inputStream, msg);
- }
-
+// @SuppressWarnings("unused")
+// public void putFileStream(InputStream inputStream, @NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
+// PutFile msg = new PutFile(fileName, FileType.BINARY);
+// msg.setCorrelationID(10000);
+// msg.setSystemFile(true);
+// msg.setOffset(offset);
+// msg.setLength(length);
+// //msg.setOnPutFileUpdateListener(cb);
+// startRPCStream(inputStream, msg);
+// }
+//
/**
* Used to push a binary stream of file data onto the module from a mobile device.
* Responses are captured through callback on IProxyListener.
@@ -7660,17 +7611,17 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* core to elsewhere in the system.
* @throws SdlException if an unrecoverable error is encountered
*/
- @SuppressWarnings("unused")
- public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
- PutFile msg = new PutFile(fileName, FileType.BINARY);
- msg.setCorrelationID(10000);
- msg.setSystemFile(true);
- msg.setOffset(offset);
- msg.setLength(length);
- //msg.setOnPutFileUpdateListener(cb);
-
- return startRPCStream(msg);
- }
+// @SuppressWarnings("unused")
+// public OutputStream putFileStream(@NonNull String fileName, Long offset, Long length, FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, OnPutFileUpdateListener cb) throws SdlException {
+// PutFile msg = new PutFile(fileName, FileType.BINARY);
+// msg.setCorrelationID(10000);
+// msg.setSystemFile(true);
+// msg.setOffset(offset);
+// msg.setLength(length);
+// //msg.setOnPutFileUpdateListener(cb);
+//
+// return startRPCStream(msg);
+// }
/**
* Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
@@ -7686,7 +7637,7 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* @param iCorrelationID - A unique ID that correlates each RPCRequest and RPCResponse.
* @return RPCStreamController - If the putFileStream was not started successfully null is returned, otherwise a valid object reference is returned
* @throws SdlException if an unrecoverable error is encountered
- * @see #putFileStream(String, String, Long, FileType, Boolean, Boolean, Boolean, Integer, OnPutFileUpdateListener)
+// * @see #putFileStream(String, String, Long, FileType, Boolean, Boolean, Boolean, Integer, OnPutFileUpdateListener)
*/
@SuppressWarnings("unused")
@Deprecated
@@ -7724,19 +7675,19 @@ public abstract class SdlProxyBase<proxyListenerType extends IProxyListenerBase>
* returned .
* @throws SdlException if an unrecoverable error is encountered
*/
- @SuppressWarnings("unused")
- public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb ) throws SdlException {
- PutFile msg = new PutFile(fileName, fileType);
- msg.setCorrelationID(correlationId);
- msg.setPersistentFile(isPersistentFile);
- msg.setSystemFile(isSystemFile);
- msg.setOffset(offset);
- msg.setLength(0L);
- msg.setPayloadProtected(isPayloadProtected);
- //msg.setOnPutFileUpdateListener(cb);
-
- return startPutFileStream(path,msg);
- }
+// @SuppressWarnings("unused")
+// public RPCStreamController putFileStream(String path, @NonNull String fileName, Long offset, @NonNull FileType fileType, Boolean isPersistentFile, Boolean isSystemFile, Boolean isPayloadProtected, Integer correlationId, OnPutFileUpdateListener cb ) throws SdlException {
+// PutFile msg = new PutFile(fileName, fileType);
+// msg.setCorrelationID(correlationId);
+// msg.setPersistentFile(isPersistentFile);
+// msg.setSystemFile(isSystemFile);
+// msg.setOffset(offset);
+// msg.setLength(0L);
+// msg.setPayloadProtected(isPayloadProtected);
+// //msg.setOnPutFileUpdateListener(cb);
+//
+// return startPutFileStream(path,msg);
+// }
/**
* Used to push a stream of putfile RPC's containing binary data from a mobile device to the module.
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
index 5d32aa391..91623dd9d 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/streaming/StreamRPCPacketizer.java
@@ -44,8 +44,6 @@ import com.smartdevicelink.proxy.interfaces.IProxyListenerBase;
import com.smartdevicelink.proxy.interfaces.IPutFileResponseListener;
import com.smartdevicelink.proxy.rpc.PutFile;
import com.smartdevicelink.proxy.rpc.PutFileResponse;
-import com.smartdevicelink.proxy.rpc.enums.Result;
-import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
import com.smartdevicelink.util.Version;
import java.io.IOException;
@@ -65,7 +63,7 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
private Object mPauseLock;
private boolean mPaused;
private boolean isRPCProtected = false;
- private OnPutFileUpdateListener callBack;
+ //private OnPutFileUpdateListener callBack;
private Version rpcSpecVersion;
@@ -223,9 +221,9 @@ public class StreamRPCPacketizer extends AbstractPacketizer implements IPutFileR
{
handleStreamException(null,null," Error, PutFile offset invalid for file: " + sFileName);
}
- if(callBack!=null){
- callBack.onStart(_request.getCorrelationID(), lFileSize);
- }
+// if(callBack!=null){
+// callBack.onStart(_request.getCorrelationID(), lFileSize);
+// }
while (!Thread.interrupted()) {
synchronized (mPauseLock)
diff --git a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
index 5dc9a3e75..8332f9d0e 100644
--- a/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/BaseSdlManager.java
@@ -38,6 +38,7 @@ import com.smartdevicelink.managers.file.FileManagerConfig;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.LifecycleConfigurationUpdate;
import com.smartdevicelink.managers.lifecycle.LifecycleManager;
+import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.managers.permission.PermissionManager;
import com.smartdevicelink.managers.screen.ScreenManager;
import com.smartdevicelink.protocol.enums.FunctionID;
@@ -46,7 +47,6 @@ import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.ChangeRegistration;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
@@ -56,7 +56,6 @@ import com.smartdevicelink.proxy.rpc.TTSChunk;
import com.smartdevicelink.proxy.rpc.TemplateColorScheme;
import com.smartdevicelink.proxy.rpc.enums.AppHMIType;
import com.smartdevicelink.proxy.rpc.enums.Language;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
@@ -200,6 +199,12 @@ abstract class BaseSdlManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
// go through and change sdlManager properties that were changed via the LCU update
hmiLanguage = actualHMILanguage;
language = actualLanguage;
@@ -219,18 +224,10 @@ abstract class BaseSdlManager {
if (lcu.getVoiceRecognitionCommandNames() != null) {
vrSynonyms = lcu.getVoiceRecognitionCommandNames();
}
+ } else {
+ DebugTool.logError(TAG, "Change Registration onError: " + response.getResultCode() + " | Info: " + response.getInfo());
+ retryChangeRegistration();
}
- try {
- DebugTool.logInfo(TAG, response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Change Registration onError: " + resultCode + " | Info: " + info);
- retryChangeRegistration();
}
});
this.sendRPC(changeRegistration);
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 c08cb17e0..6056cdbf6 100644
--- a/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java
@@ -146,24 +146,21 @@ abstract class BaseFileManager extends BaseSubManager {
@Override
public void onResponse(int correlationId, RPCResponse response) {
ListFilesResponse listFilesResponse = (ListFilesResponse) response;
- if(listFilesResponse.getSuccess()){
+ if (listFilesResponse.getSuccess()) {
bytesAvailable = listFilesResponse.getSpaceAvailable() != null ? listFilesResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
- if(listFilesResponse.getFilenames() != null){
+ if (listFilesResponse.getFilenames() != null) {
remoteFiles.addAll(listFilesResponse.getFilenames());
}
// on callback set manager to ready state
transitionToState(BaseSubManager.READY);
+ } else {
+ // file list could not be received. assume that setting can work and allow SDLManager to start
+ DebugTool.logError(TAG, "File Manager could not list files");
+ bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
+ transitionToState(BaseSubManager.READY);
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- // file list could not be received. assume that setting can work and allow SDLManager to start
- DebugTool.logError(TAG, "File Manager could not list files");
- bytesAvailable = SPACE_AVAILABLE_MAX_VALUE;
- transitionToState(BaseSubManager.READY);
- }
});
internalInterface.sendRPC(listFiles);
}
@@ -273,23 +270,6 @@ abstract class BaseFileManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- final RPCRequest request = requestMap.get(correlationId);
- if (request != null) {
- if (!deletionOperation) {
- if (shouldReUploadFile(((PutFile) request).getSdlFileName(), ((PutFile) request).getFileType())) {
- request.setOnRPCResponseListener(null);
- requestsToResend.add(request);
- } else {
- errors.put(((PutFile) request).getSdlFileName(), buildErrorString(resultCode, info));
- }
- } else {
- errors.put(((DeleteFile) request).getSdlFileName(), buildErrorString(resultCode, info));
- }
- }
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
if (response instanceof PutFileResponse) {
@@ -310,9 +290,22 @@ abstract class BaseFileManager extends BaseSubManager {
uploadedEphemeralFileNames.remove(((DeleteFile) requestMap.get(correlationId)).getSdlFileName());
}
}
+ } else {
+ final RPCRequest request = requestMap.get(correlationId);
+ if (request != null) {
+ if (!deletionOperation) {
+ if (shouldReUploadFile(((PutFile) request).getSdlFileName(), ((PutFile) request).getFileType())) {
+ request.setOnRPCResponseListener(null);
+ requestsToResend.add(request);
+ } else {
+ errors.put(((PutFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
+ }
+ } else {
+ errors.put(((DeleteFile) request).getSdlFileName(), buildErrorString(response.getResultCode(), response.getInfo()));
+ }
+ }
}
}
-
};
internalInterface.sendRequests(requests, onMultipleRequestListener);
}
@@ -342,19 +335,15 @@ abstract class BaseFileManager extends BaseSubManager {
bytesAvailable = putFileResponse.getSpaceAvailable() != null ? putFileResponse.getSpaceAvailable() : SPACE_AVAILABLE_MAX_VALUE;
remoteFiles.add(file.getName());
uploadedEphemeralFileNames.add(file.getName());
- }
- if (listener != null) {
- listener.onComplete(putFileResponse.getSuccess());
- }
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- if (shouldReUploadFile(file.getName(), file.getType())) {
- uploadFile(file, listener);
- } else if (listener != null) {
- listener.onComplete(false);
+ if (listener != null) {
+ listener.onComplete(true);
+ }
+ } else {
+ if (shouldReUploadFile(file.getName(), file.getType())) {
+ uploadFile(file, listener);
+ } else if (listener != null) {
+ listener.onComplete(false);
+ }
}
}
});
@@ -369,9 +358,9 @@ abstract class BaseFileManager extends BaseSubManager {
*/
private boolean shouldReUploadFile(String fileName, FileType fileType) {
if (!failedFileUploadsIndex.containsKey(fileName)) {
- if (fileType.equals(FileType.GRAPHIC_JPEG) ||
- fileType.equals(FileType.GRAPHIC_BMP) ||
- fileType.equals(FileType.GRAPHIC_PNG)) {
+ if (FileType.GRAPHIC_JPEG.equals(fileType) ||
+ FileType.GRAPHIC_BMP.equals(fileType) ||
+ FileType.GRAPHIC_PNG.equals(fileType)) {
failedFileUploadsIndex.put(fileName, fileManagerConfig.getArtworkRetryCount());
} else {
failedFileUploadsIndex.put(fileName, fileManagerConfig.getFileRetryCount());
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index 7b184f3af..77fac4cfe 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -54,6 +54,7 @@ import com.smartdevicelink.proxy.interfaces.IAudioStreamListener;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.interfaces.ISdlServiceListener;
import com.smartdevicelink.proxy.interfaces.IVideoStreamListener;
+import com.smartdevicelink.proxy.rpc.GenericResponse;
import com.smartdevicelink.proxy.rpc.OnAppInterfaceUnregistered;
import com.smartdevicelink.proxy.rpc.OnButtonEvent;
import com.smartdevicelink.proxy.rpc.OnButtonPress;
@@ -79,7 +80,6 @@ import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SdlDisconnectedReason;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
-import com.smartdevicelink.proxy.rpc.listeners.OnPutFileUpdateListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCRequestListener;
@@ -208,17 +208,6 @@ abstract class BaseLifecycleManager {
listener.getSingleRpcResponseListener().onResponse(correlationId, response);
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- if (devOnRPCResponseListener != null) {
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener.getSingleRpcResponseListener() != null) {
- listener.getSingleRpcResponseListener().onError(correlationId, resultCode, info);
- }
- }
});
}
sendRPCMessagePrivate(request, false);
@@ -268,20 +257,6 @@ abstract class BaseLifecycleManager {
// recurse after onResponse
sendSequentialRPCs(messages, listener);
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (devOnRPCResponseListener != null) {
- devOnRPCResponseListener.onError(correlationId, resultCode, info);
- }
- if (listener != null) {
- listener.onError(correlationId, resultCode, info);
- listener.onUpdate(messages.size());
-
- }
- // recurse after onError
- sendSequentialRPCs(messages, listener);
- }
});
sendRPCMessagePrivate(request, false);
} else {
@@ -528,24 +503,6 @@ abstract class BaseLifecycleManager {
}
/**
- * Only call this method for a PutFile response. It will cause a class cast exception if not.
- *
- * @param correlationId correlation id of the packet being updated
- * @param bytesWritten how many bytes were written
- * @param totalSize the total size in bytes
- */
- @SuppressWarnings("unused")
- private void onPacketProgress(int correlationId, long bytesWritten, long totalSize) {
- synchronized (ON_UPDATE_LISTENER_LOCK) {
- if (rpcResponseListeners != null
- && rpcResponseListeners.containsKey(correlationId)) {
- ((OnPutFileUpdateListener) rpcResponseListeners.get(correlationId)).onUpdate(correlationId, bytesWritten, totalSize);
- }
- }
-
- }
-
- /**
* Will provide callback to the listener either onFinish or onError depending on the RPCResponses result code,
* <p>Will automatically remove the listener for the list of listeners on completion.
*
@@ -559,10 +516,8 @@ abstract class BaseLifecycleManager {
if (rpcResponseListeners != null
&& rpcResponseListeners.containsKey(correlationId)) {
OnRPCResponseListener listener = rpcResponseListeners.get(correlationId);
- if (msg.getSuccess()) {
+ if (listener != null) {
listener.onResponse(correlationId, msg);
- } else {
- listener.onError(correlationId, msg.getResultCode(), msg.getInfo());
}
rpcResponseListeners.remove(correlationId);
return true;
@@ -576,15 +531,11 @@ abstract class BaseLifecycleManager {
*
* @param listener that will get called back when a response is received
* @param correlationId of the RPCRequest that was sent
- * @param totalSize only include if this is an OnPutFileUpdateListener. Otherwise it will be ignored.
*/
- private void addOnRPCResponseListener(OnRPCResponseListener listener, int correlationId, int totalSize) {
+ private void addOnRPCResponseListener(OnRPCResponseListener listener, int correlationId) {
synchronized (ON_UPDATE_LISTENER_LOCK) {
if (rpcResponseListeners != null
&& listener != null) {
- if (listener.getListenerType() == OnRPCResponseListener.UPDATE_LISTENER_TYPE_PUT_FILE) {
- ((OnPutFileUpdateListener) listener).setTotalSize(totalSize);
- }
listener.onStart(correlationId);
rpcResponseListeners.put(correlationId, listener);
}
@@ -733,7 +684,9 @@ abstract class BaseLifecycleManager {
// Test for illegal correlation ID
if (request.getCorrelationID() == REGISTER_APP_INTERFACE_CORRELATION_ID || request.getCorrelationID() == UNREGISTER_APP_INTERFACE_CORRELATION_ID || request.getCorrelationID() == PoliciesFetcher.POLICIES_CORRELATION_ID) {
if (listener != null) {
- request.getOnRPCResponseListener().onError(request.getCorrelationID(), Result.REJECTED, "Invalid correlation ID. The correlation ID, " + request.getCorrelationID() + " , is a reserved correlation ID.");
+ GenericResponse response = new GenericResponse(false, Result.REJECTED);
+ response.setInfo("Invalid correlation ID. The correlation ID, " + request.getCorrelationID() + " , is a reserved correlation ID.");
+ request.getOnRPCResponseListener().onResponse(request.getCorrelationID(), response);
}
return;
}
@@ -741,7 +694,9 @@ abstract class BaseLifecycleManager {
// Prevent developer from sending RAI or UAI manually
if (request.getFunctionName().equals(FunctionID.REGISTER_APP_INTERFACE.toString()) || request.getFunctionName().equals(FunctionID.UNREGISTER_APP_INTERFACE.toString())) {
if (listener != null) {
- request.getOnRPCResponseListener().onError(request.getCorrelationID(), Result.REJECTED, "The RPCRequest, " + message.getFunctionName() + ", is un-allowed to be sent manually by the developer.");
+ GenericResponse response = new GenericResponse(false, Result.REJECTED);
+ response.setInfo("The RPCRequest, " + message.getFunctionName() + ", is un-allowed to be sent manually by the developer.");
+ request.getOnRPCResponseListener().onResponse(request.getCorrelationID(), response);
}
return;
}
@@ -801,7 +756,9 @@ abstract class BaseLifecycleManager {
RPCRequest request = (RPCRequest) message;
OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
if (listener != null) {
- listener.onError(request.getCorrelationID(), Result.ABORTED, errorInfo);
+ GenericResponse response = new GenericResponse(false, Result.ABORTED);
+ response.setInfo(errorInfo);
+ request.getOnRPCResponseListener().onResponse(request.getCorrelationID(), response);
}
}
DebugTool.logWarning(TAG, errorInfo);
@@ -819,7 +776,7 @@ abstract class BaseLifecycleManager {
OnRPCResponseListener listener = ((RPCRequest) message).getOnRPCResponseListener();
if (listener != null) {
- addOnRPCResponseListener(listener, corrId, msgBytes.length);
+ addOnRPCResponseListener(listener, corrId);
}
}
} else if (RPCMessage.KEY_RESPONSE.equals(message.getMessageType())) { // Response Specifics
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
index a20661612..ede4d7fbe 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java
@@ -58,7 +58,6 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageType;
import com.smartdevicelink.proxy.rpc.enums.MediaClockFormat;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.WindowType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCListener;
@@ -619,13 +618,6 @@ abstract class BaseSystemCapabilityManager {
}
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (scListener != null) {
- scListener.onError(info);
- }
- }
});
request.setCorrelationID(CorrelationIdGenerator.generateId());
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
index ba9e8aa53..3bdde236a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseSubscribeButtonManager.java
@@ -13,7 +13,6 @@ import com.smartdevicelink.proxy.rpc.OnButtonPress;
import com.smartdevicelink.proxy.rpc.SubscribeButton;
import com.smartdevicelink.proxy.rpc.UnsubscribeButton;
import com.smartdevicelink.proxy.rpc.enums.ButtonName;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
@@ -124,12 +123,11 @@ abstract class BaseSubscribeButtonManager extends BaseSubManager {
unsubscribeButtonRequest.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- onButtonListeners.remove(buttonName);
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- listener.onError("Attempt to unsubscribe to button named " + buttonName + " Failed. ResultCode: " + resultCode + " info: " + info);
+ if (response.getSuccess()) {
+ onButtonListeners.remove(buttonName);
+ } else {
+ listener.onError("Attempt to unsubscribe to button named " + buttonName + " Failed. ResultCode: " + response.getResultCode() + " info: " + response.getInfo());
+ }
}
});
internalInterface.sendRPC(unsubscribeButtonRequest);
@@ -146,13 +144,12 @@ abstract class BaseSubscribeButtonManager extends BaseSubManager {
subscribeButtonRequest.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- onButtonListeners.put(buttonName, new CopyOnWriteArrayList<OnButtonListener>());
- onButtonListeners.get(buttonName).add(listener);
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- listener.onError("Attempt to subscribe to button named " + buttonName + " Failed . ResultCode: " + resultCode + " info: " + info);
+ if (response.getSuccess()) {
+ onButtonListeners.put(buttonName, new CopyOnWriteArrayList<OnButtonListener>());
+ onButtonListeners.get(buttonName).add(listener);
+ } else {
+ listener.onError("Attempt to subscribe to button named " + buttonName + " Failed . ResultCode: " + response.getResultCode() + " info: " + response.getInfo());
+ }
}
});
internalInterface.sendRPC(subscribeButtonRequest);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
index a07e60f20..ad43b5526 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/BaseTextAndGraphicManager.java
@@ -40,10 +40,10 @@ import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
+import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DisplayCapability;
import com.smartdevicelink.proxy.rpc.MetadataTags;
@@ -54,7 +54,6 @@ import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.MetadataType;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
@@ -308,11 +307,6 @@ abstract class BaseTextAndGraphicManager extends BaseSubManager {
handleResponse(response.getSuccess());
}
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- handleResponse(false);
- }
-
private void handleResponse(boolean success){
if (success){
updateCurrentScreenDataState(inProgressUpdate);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java
index 106806562..00b3824e1 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonReplaceOperation.java
@@ -10,7 +10,6 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
import com.smartdevicelink.proxy.rpc.SoftButtonCapabilities;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SoftButtonType;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
@@ -229,14 +228,6 @@ class SoftButtonReplaceOperation extends Task {
completionListener.onComplete(response.getSuccess());
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
- if (completionListener != null) {
- completionListener.onComplete(false);
- }
- }
});
show.setMainField1(currentMainField1);
show.setSoftButtons(softButtons);
@@ -285,14 +276,6 @@ class SoftButtonReplaceOperation extends Task {
completionListener.onComplete(response.getSuccess());
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logWarning(TAG, "Failed to update soft buttons with text buttons");
- if (completionListener != null) {
- completionListener.onComplete(false);
- }
- }
});
show.setMainField1(currentMainField1);
show.setSoftButtons(textButtons);
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java
index 355c6aeaf..4ef5e715a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/SoftButtonTransitionOperation.java
@@ -5,7 +5,6 @@ import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Show;
import com.smartdevicelink.proxy.rpc.SoftButton;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
@@ -53,13 +52,6 @@ class SoftButtonTransitionOperation extends Task {
}
onFinished();
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- DebugTool.logWarning(TAG, "Failed to transition soft button to new state. " + info);
- onFinished();
- }
});
show.setMainField1(currentMainField1);
show.setSoftButtons(currentStateSoftButtonsForObjects(softButtonObjects));
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
index 6e606b62d..6cc0283d9 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/CheckChoiceVROptionalOperation.java
@@ -41,7 +41,6 @@ import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.Choice;
import com.smartdevicelink.proxy.rpc.CreateInteractionChoiceSet;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCResponseListener;
import com.smartdevicelink.util.DebugTool;
@@ -86,12 +85,6 @@ class CheckChoiceVROptionalOperation extends Task {
sendTestChoiceWithVR();
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logWarning(TAG, "Head unit doesn't support choices with no VR. Error: " + info + " resultCode: " + resultCode);
- sendTestChoiceWithVR();
- }
});
if (internalInterface.get() != null) {
@@ -123,17 +116,6 @@ class CheckChoiceVROptionalOperation extends Task {
CheckChoiceVROptionalOperation.super.onFinished();
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "There was an error in the check choice vr optional operation. Send test choice with VR failed. Error: " + info + " resultCode: " + resultCode);
- isVROptional = false;
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onError(info);
- }
-
- CheckChoiceVROptionalOperation.super.onFinished();
- }
});
if (internalInterface.get() != null) {
@@ -146,24 +128,17 @@ class CheckChoiceVROptionalOperation extends Task {
delete.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- if (response.getSuccess() != null){
+ if (response.getSuccess()){
DebugTool.logInfo(TAG, "Delete choice test set: "+ response.getSuccess());
+ if (checkChoiceVROptionalInterface != null){
+ checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
+ }
+ } else {
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
+ if (checkChoiceVROptionalInterface != null){
+ checkChoiceVROptionalInterface.onError(response.getInfo());
+ }
}
-
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onCheckChoiceVROperationComplete(isVROptional);
- }
-
- CheckChoiceVROptionalOperation.super.onFinished();
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
- if (checkChoiceVROptionalInterface != null){
- checkChoiceVROptionalInterface.onError(info);
- }
-
CheckChoiceVROptionalOperation.super.onFinished();
}
});
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
index de328b8eb..8672b1b83 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/DeleteChoicesOperation.java
@@ -40,7 +40,6 @@ import com.smartdevicelink.managers.CompletionListener;
import com.smartdevicelink.proxy.RPCResponse;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.DeleteInteractionChoiceSet;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.util.DebugTool;
@@ -91,17 +90,15 @@ class DeleteChoicesOperation extends Task {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (completionListener != null) {
- completionListener.onComplete(false);
- }
- DebugTool.logError(TAG, "Failed to delete choice: " + info + " | Corr ID: " + correlationId);
-
- DeleteChoicesOperation.super.onFinished();
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
+ if (!response.getSuccess()) {
+ if (completionListener != null) {
+ completionListener.onComplete(false);
+ }
+ DebugTool.logError(TAG, "Failed to delete choice: " + response.getInfo() + " | Corr ID: " + correlationId);
+
+ DeleteChoicesOperation.super.onFinished();
+ }
}
});
}
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
index ffce35694..d8a921b8a 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PreloadChoicesOperation.java
@@ -51,7 +51,6 @@ import com.smartdevicelink.proxy.rpc.Image;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.util.DebugTool;
@@ -171,14 +170,11 @@ class PreloadChoicesOperation extends Task {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "There was an error uploading a choice cell: "+ info + " resultCode: " + resultCode);
- choiceError = true;
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
-
+ if (!response.getSuccess()) {
+ DebugTool.logError(TAG, "There was an error uploading a choice cell: "+ response.getInfo() + " resultCode: " + response.getResultCode());
+ choiceError = true;
+ }
}
});
}else{
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
index 7038a48ab..121b1f6c0 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentChoiceSetOperation.java
@@ -159,14 +159,6 @@ class PresentChoiceSetOperation extends Task {
}
DebugTool.logInfo(TAG, "Success Setting keyboard properties in present choice set operation");
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (listener != null){
- listener.onComplete(false);
- }
- DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
- }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(setGlobalProperties);
@@ -187,6 +179,7 @@ class PresentChoiceSetOperation extends Task {
choiceSetSelectionListener.onError(response.getInfo());
}
finishOperation();
+ return;
}
PerformInteractionResponse performInteractionResponse = (PerformInteractionResponse) response;
@@ -199,16 +192,6 @@ class PresentChoiceSetOperation extends Task {
finishOperation();
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Presenting Choice set failed: " + resultCode + ", " + info);
-
- if (choiceSetSelectionListener != null){
- choiceSetSelectionListener.onError(resultCode + ", " + info);
- }
- finishOperation();
- }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(pi);
@@ -225,14 +208,12 @@ class PresentChoiceSetOperation extends Task {
setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- updatedKeyboardProperties = false;
- DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
- PresentChoiceSetOperation.super.onFinished();
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ if (response.getSuccess()) {
+ updatedKeyboardProperties = false;
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ } else {
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
+ }
PresentChoiceSetOperation.super.onFinished();
}
});
@@ -272,11 +253,6 @@ class PresentChoiceSetOperation extends Task {
public void onResponse(int correlationId, RPCResponse response) {
DebugTool.logInfo(TAG, "Canceled the presented choice set " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "Error canceling the presented choice set " + resultCode + " " + info);
- }
});
if (internalInterface.get() != null){
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
index 446826616..33db35607 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/choiceset/PresentKeyboardOperation.java
@@ -124,12 +124,9 @@ class PresentKeyboardOperation extends Task {
pi.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- finishOperation();
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + info + " resultCode: " + resultCode);
+ if (!response.getSuccess()) {
+ DebugTool.logError(TAG, "There was an error presenting the keyboard. Finishing operation - choice set manager - . Error: " + response.getInfo() + " resultCode: " + response.getResultCode());
+ }
finishOperation();
}
});
@@ -167,11 +164,6 @@ class PresentKeyboardOperation extends Task {
public void onResponse(int correlationId, RPCResponse response) {
DebugTool.logInfo(TAG, "Canceled the presented keyboard " + ((response.getResultCode() == Result.SUCCESS) ? "successfully" : "unsuccessfully"));
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "Error canceling the presented keyboard " + resultCode + " " + info);
- }
});
if (internalInterface.get() != null){
internalInterface.get().sendRPC(cancelInteraction);
@@ -213,15 +205,6 @@ class PresentKeyboardOperation extends Task {
}
DebugTool.logInfo(TAG, "Success Setting keyboard properties in present keyboard operation - choice manager");
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- if (listener != null){
- listener.onComplete(false);
- }
- DebugTool.logError(TAG, "Error Setting keyboard properties in present keyboard operation - choice manager - " + info);
- super.onError(correlationId, resultCode, info);
- }
});
if (internalInterface.get() != null){
@@ -239,14 +222,12 @@ class PresentKeyboardOperation extends Task {
setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
@Override
public void onResponse(int correlationId, RPCResponse response) {
- updatedKeyboardProperties = false;
- DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
- PresentKeyboardOperation.super.onFinished();
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + resultCode + ", " + info);
+ if (response.getSuccess()) {
+ updatedKeyboardProperties = false;
+ DebugTool.logInfo(TAG, "Successfully reset choice keyboard properties to original config");
+ } else {
+ DebugTool.logError(TAG, "Failed to reset choice keyboard properties to original config " + response.getResultCode() + ", " + response.getInfo());
+ }
PresentKeyboardOperation.super.onFinished();
}
});
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
index cd95f1ce8..c4c18ee16 100644
--- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseMenuManager.java
@@ -36,34 +36,33 @@ import androidx.annotation.NonNull;
import com.smartdevicelink.managers.BaseSubManager;
import com.smartdevicelink.managers.CompletionListener;
+import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.managers.file.FileManager;
import com.smartdevicelink.managers.file.MultipleFileCompletionListener;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.lifecycle.OnSystemCapabilityListener;
+import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.managers.lifecycle.SystemCapabilityManager;
import com.smartdevicelink.proxy.interfaces.ISdl;
import com.smartdevicelink.proxy.rpc.AddCommand;
import com.smartdevicelink.proxy.rpc.AddSubMenu;
import com.smartdevicelink.proxy.rpc.DeleteCommand;
import com.smartdevicelink.proxy.rpc.DeleteSubMenu;
import com.smartdevicelink.proxy.rpc.DisplayCapability;
-import com.smartdevicelink.managers.ManagerUtility;
import com.smartdevicelink.proxy.rpc.MenuParams;
import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
-import com.smartdevicelink.proxy.rpc.ShowAppMenu;
import com.smartdevicelink.proxy.rpc.SetGlobalProperties;
+import com.smartdevicelink.proxy.rpc.ShowAppMenu;
import com.smartdevicelink.proxy.rpc.WindowCapability;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.enums.SystemContext;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
@@ -285,11 +284,6 @@ abstract class BaseMenuManager extends BaseSubManager {
DebugTool.logError(TAG, "Open Main Menu Request Failed");
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "Open Main Menu onError: "+ resultCode+ " | Info: "+ info);
- }
});
internalInterface.sendRPC(showAppMenu);
return true;
@@ -334,11 +328,6 @@ abstract class BaseMenuManager extends BaseSubManager {
DebugTool.logError(TAG, "Open Sub Menu Request Failed");
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info){
- DebugTool.logError(TAG, "Open Sub Menu onError: "+ resultCode+ " | Info: "+ info);
- }
});
internalInterface.sendRPC(showAppMenu);
@@ -381,13 +370,10 @@ abstract class BaseMenuManager extends BaseSubManager {
public void onResponse(int correlationId, RPCResponse response) {
if (response.getSuccess()) {
DebugTool.logInfo(TAG, "Menu Configuration successfully set: " + menuConfiguration.toString());
+ } else {
+ DebugTool.logError(TAG, "onError: " + response.getResultCode() + " | Info: " + response.getInfo());
}
}
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "onError: " + resultCode + " | Info: " + info);
- }
});
internalInterface.sendRPC(setGlobalProperties);
} else {
@@ -1175,16 +1161,15 @@ abstract class BaseMenuManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Result: " + resultCode.toString() + " Info: " + info);
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
- try {
- DebugTool.logInfo(TAG, "Main Menu response: " + response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Main Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
}
}
});
@@ -1214,19 +1199,18 @@ abstract class BaseMenuManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Failed to send sub menu commands: "+ info);
- if (listener != null){
- listener.onComplete(false);
- }
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
- try {
- DebugTool.logInfo(TAG, "Sub Menu response: "+ response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Sub Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Failed to send sub menu commands: "+ response.getInfo());
+ if (listener != null){
+ listener.onComplete(false);
+ }
}
}
});
@@ -1267,16 +1251,15 @@ abstract class BaseMenuManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- DebugTool.logError(TAG, "Result: " + resultCode.toString() + " Info: " + info);
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
- try {
- DebugTool.logInfo(TAG, "Dynamic Sub Menu response: " + response.serializeJSON().toString());
- } catch (JSONException e) {
- e.printStackTrace();
+ if (response.getSuccess()) {
+ try {
+ DebugTool.logInfo(TAG, "Dynamic Sub Menu response: " + response.serializeJSON().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ DebugTool.logError(TAG, "Result: " + response.getResultCode() + " Info: " + response.getInfo());
}
}
});
@@ -1331,10 +1314,6 @@ abstract class BaseMenuManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
}
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 c615408fd..f96452bb2 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
@@ -46,7 +46,6 @@ import com.smartdevicelink.proxy.rpc.OnCommand;
import com.smartdevicelink.proxy.rpc.OnHMIStatus;
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener;
import com.smartdevicelink.util.DebugTool;
@@ -206,11 +205,6 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
-
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {}
});
@@ -245,11 +239,6 @@ abstract class BaseVoiceCommandManager extends BaseSubManager {
}
@Override
- public void onError(int correlationId, Result resultCode, String info) {
-
- }
-
- @Override
public void onResponse(int correlationId, RPCResponse response) {
}
});
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
index 462a73283..9e63827fa 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnMultipleRequestListener.java
@@ -32,7 +32,6 @@
package com.smartdevicelink.proxy.rpc.listeners;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.rpc.enums.Result;
import java.util.Vector;
@@ -43,7 +42,6 @@ public abstract class OnMultipleRequestListener extends OnRPCResponseListener {
final Vector<Integer> correlationIds;
OnRPCResponseListener rpcResponseListener;
- private static String TAG = "OnMultipleRequestListener";
public OnMultipleRequestListener(){
setListenerType(UPDATE_LISTENER_TYPE_MULTIPLE_REQUESTS);
@@ -53,17 +51,6 @@ public abstract class OnMultipleRequestListener extends OnRPCResponseListener {
@Override
public void onResponse(int correlationId, RPCResponse response) {
OnMultipleRequestListener.this.onResponse(correlationId, response);
- update(correlationId);
- }
-
- @Override
- public void onError(int correlationId, Result resultCode, String info) {
- super.onError(correlationId, resultCode, info);
- OnMultipleRequestListener.this.onError(correlationId, resultCode, info);
- update(correlationId);
- }
-
- private synchronized void update(int correlationId){
correlationIds.remove(Integer.valueOf(correlationId));
onUpdate(correlationIds.size());
if(correlationIds.size() == 0){
@@ -82,7 +69,6 @@ public abstract class OnMultipleRequestListener extends OnRPCResponseListener {
*/
public abstract void onUpdate(int remainingRequests);
public abstract void onFinished();
- public abstract void onError(int correlationId, Result resultCode, String info);
public OnRPCResponseListener getSingleRpcResponseListener(){
return rpcResponseListener;
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java
deleted file mode 100644
index cac4ec523..000000000
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnPutFileUpdateListener.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2019, Livio, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Livio Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package com.smartdevicelink.proxy.rpc.listeners;
-
-import com.smartdevicelink.proxy.RPCResponse;
-
-@Deprecated
-public abstract class OnPutFileUpdateListener extends OnRPCResponseListener{
-
- long totalSize = 0;
-
- public OnPutFileUpdateListener(){
- setListenerType(UPDATE_LISTENER_TYPE_PUT_FILE);
- }
-
- @Override
- public final void onStart(int correlationId) {
- super.onStart(correlationId);
- onStart(correlationId, totalSize); //We do this so we can send back the total size
- }
-
- public void onStart(int correlationId, long totalSize){
-
- }
-
- @Override
- public final void onResponse(int correlationId, RPCResponse response) {
- onResponse(correlationId, response, totalSize); //Calling our special abstract method
- }
- /**
- * Called when the putfile request is responded to.
- * @param correlationId correlation ID tied to the original response
- * @param response the PutFile response RPC
- * @param totalSize total size of the file sent
- */
- public abstract void onResponse(int correlationId, RPCResponse response, long totalSize);
-
- /**
- * onUpdate is called during a putfile stream request
- * @param correlationId of the original request
- * @param bytesWritten the amount of bytes that have been written so far
- * @param totalSize total size of the file that is being sent
- */
- public void onUpdate(int correlationId, long bytesWritten, long totalSize){
-
- };
-
- public final void setTotalSize(long totalSize){
- this.totalSize = totalSize;
- }
-}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
index 85a32c02e..87f3968eb 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCListener.java
@@ -44,10 +44,7 @@ public abstract class OnRPCListener {
* Generic listener type that will work for most RPCs
*/
public final static int UPDATE_LISTENER_TYPE_BASE_RPC = 0;
- /**
- * Listener type specific to putfile
- */
- public final static int UPDATE_LISTENER_TYPE_PUT_FILE = 1;
+
/**
* Listener type specific to sendRequests and sendSequentialRequests
*/
diff --git a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
index 89b082326..e664b05e8 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/rpc/listeners/OnRPCResponseListener.java
@@ -33,7 +33,6 @@ package com.smartdevicelink.proxy.rpc.listeners;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCResponse;
-import com.smartdevicelink.proxy.rpc.enums.Result;
public abstract class OnRPCResponseListener extends OnRPCListener {
@@ -68,22 +67,4 @@ public abstract class OnRPCResponseListener extends OnRPCListener {
* for a PutFile request, the message parameter should be cast to a PutFileResponse class.
*/
public abstract void onResponse(int correlationId, final RPCResponse response);
-
- /**
- * @deprecated This method has been deprecated in favor of just using the onResponse callback. In the next
- * version this method will be removed and all responses successful or not will be returned
- * through the onResponse method callback.
- *
- * Called when there was some sort of error during the original request.
- * @param correlationId
- * @param resultCode
- * @param info
- */
- @Deprecated
- public void onError(int correlationId, Result resultCode, String info){
-
- };
-
-
-
}