summaryrefslogtreecommitdiff
path: root/base/src
diff options
context:
space:
mode:
authorRHenigan <heniganr1@gmail.com>2020-03-19 14:58:25 -0400
committerRHenigan <heniganr1@gmail.com>2020-03-19 15:24:47 -0400
commite504c0373670cefb7ef92ed5070806597b55a2c3 (patch)
tree7dbd5c82bc80e92c5638113ce84530801492355e /base/src
parentf8a9b3229795ad1abff756261a177cff3308dfb1 (diff)
downloadsdl_android-e504c0373670cefb7ef92ed5070806597b55a2c3.tar.gz
Scale Workaround for High Res Ford/Linc displays
Diffstat (limited to 'base/src')
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java7
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java42
2 files changed, 49 insertions, 0 deletions
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
index 244c34395..3eb082670 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -6,6 +6,7 @@ import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.protocol.enums.SessionType;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.RPCRequest;
+import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
@@ -219,6 +220,12 @@ public interface ISdl {
void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener);
/**
+ * Get RegisterAppInterfaceResponse
+ * @return the RegisterAppInterfaceResponse if available, null if not
+ */
+ RegisterAppInterfaceResponse getRegisterAppInterfaceResponse();
+
+ /**
* Check if capability is supported
* @param systemCapabilityType a system capability type that should be checked for support
* @return Boolean whether or not the supplied capability type is supported on the connected module
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index ded3a9cd9..4612434fb 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -134,6 +134,48 @@ public class VideoStreamingParameters {
* @see com.smartdevicelink.proxy.SystemCapabilityManager
* @see VideoStreamingCapability
*/
+ public void update(VideoStreamingCapability capability, String vehicleMake){
+ if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
+ double scale = DEFAULT_SCALE;
+ if(capability.getScale() != null) { scale = capability.getScale(); }
+ ImageResolution resolution = capability.getPreferredResolution();
+ if(resolution!=null){
+
+ if((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() !=null && resolution.getResolutionWidth() > 800))) {
+ scale = 1.0 / 0.75;
+ }
+
+ if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }
+ if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth((int)(resolution.getResolutionWidth() / scale)); }
+ }
+
+ // This should be the last call as it will return out once a suitable format is found
+ final List<VideoStreamingFormat> formats = capability.getSupportedFormats();
+ if(formats != null && formats.size()>0){
+ for(VideoStreamingFormat format : formats){
+ for(int i = 0; i < CURRENTLY_SUPPORTED_FORMATS.length; i ++){
+ if(CURRENTLY_SUPPORTED_FORMATS[i].equals(format) ){
+ this.format = format;
+ return;
+ }
+ }
+ }
+ DebugTool.logWarning("The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
+
+ //TODO In the future we should set format to null, but might be a breaking change
+ // For now, format will remain whatever was set prior to this update
+ }
+
+ }
+
+ /**
+ * Update the values contained in the capability that should have been returned through the SystemCapabilityManager.
+ * This update will use the most preferred streaming format from the module.
+ * @param capability the video streaming capability returned from the SystemCapabilityManager
+ * @see com.smartdevicelink.proxy.SystemCapabilityManager
+ * @see VideoStreamingCapability
+ */
+ @Deprecated
public void update(VideoStreamingCapability capability){
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
double scale = DEFAULT_SCALE;