Skip to content

Commit e504c03

Browse files
committed
Scale Workaround for High Res Ford/Linc displays
1 parent f8a9b32 commit e504c03

6 files changed

Lines changed: 66 additions & 3 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/test/proxy/SystemCapabilityManagerTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,9 @@ public boolean removeOnRPCListener(FunctionID messageId, OnRPCListener listener)
950950
@Override
951951
public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) { }
952952

953+
@Override
954+
public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse(){return null;}
955+
953956
@Override
954957
public SdlMsgVersion getSdlMsgVersion(){
955958
return null;

android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,11 @@ public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCap
866866
proxy.getCapability(systemCapabilityType, scListener);
867867
}
868868

869+
@Override
870+
public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
871+
return proxy.getRegisterAppInterfaceResponse();
872+
}
873+
869874
@Override
870875
public boolean isCapabilitySupported(SystemCapabilityType systemCapabilityType){
871876
return proxy.isCapabilitySupported(systemCapabilityType);

android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
9595
private IVideoStreamListener streamListener;
9696
private boolean isTransportAvailable = false;
9797
private boolean hasStarted;
98+
private String vehicleMake;
9899

99100
// INTERNAL INTERFACES
100101

@@ -176,10 +177,10 @@ public void onNotified(RPCNotification notification) {
176177
};
177178

178179
// MANAGER APIs
179-
180180
public VideoStreamManager(ISdl internalInterface){
181181
super(internalInterface);
182182

183+
vehicleMake = internalInterface.getRegisterAppInterfaceResponse().getVehicleType().getMake();
183184
virtualDisplayEncoder = new VirtualDisplayEncoder();
184185
hmiLevel = HMILevel.HMI_NONE;
185186

@@ -218,7 +219,7 @@ private void getVideoStreamingParams(){
218219
@Override
219220
public void onCapabilityRetrieved(Object capability) {
220221
VideoStreamingParameters params = new VideoStreamingParameters();
221-
params.update((VideoStreamingCapability)capability); //Streaming parameters are ready time to stream
222+
params.update((VideoStreamingCapability)capability, vehicleMake); //Streaming parameters are ready time to stream
222223
VideoStreamManager.this.parameters = params;
223224

224225
checkState();
@@ -270,7 +271,7 @@ public void startRemoteDisplayStream(Context context, Class<? extends SdlRemoteD
270271
@Override
271272
public void onCapabilityRetrieved(Object capability) {
272273
VideoStreamingParameters params = new VideoStreamingParameters();
273-
params.update((VideoStreamingCapability)capability); //Streaming parameters are ready time to stream
274+
params.update((VideoStreamingCapability)capability, vehicleMake); //Streaming parameters are ready time to stream
274275
startStreaming(params, encrypted);
275276
}
276277

android/sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,11 @@ public Object getCapability(SystemCapabilityType systemCapabilityType){
444444
return SdlProxyBase.this.getCapability(systemCapabilityType);
445445
}
446446

447+
@Override
448+
public RegisterAppInterfaceResponse getRegisterAppInterfaceResponse() {
449+
return SdlProxyBase.this.getRegisterAppInterfaceResponse();
450+
}
451+
447452
@Override
448453
public void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener) {
449454
SdlProxyBase.this.getCapability(systemCapabilityType, scListener);

base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.smartdevicelink.protocol.enums.SessionType;
77
import com.smartdevicelink.proxy.RPCMessage;
88
import com.smartdevicelink.proxy.RPCRequest;
9+
import com.smartdevicelink.proxy.rpc.RegisterAppInterfaceResponse;
910
import com.smartdevicelink.proxy.rpc.SdlMsgVersion;
1011
import com.smartdevicelink.proxy.rpc.enums.SystemCapabilityType;
1112
import com.smartdevicelink.proxy.rpc.listeners.OnMultipleRequestListener;
@@ -218,6 +219,12 @@ public interface ISdl {
218219
*/
219220
void getCapability(SystemCapabilityType systemCapabilityType, OnSystemCapabilityListener scListener);
220221

222+
/**
223+
* Get RegisterAppInterfaceResponse
224+
* @return the RegisterAppInterfaceResponse if available, null if not
225+
*/
226+
RegisterAppInterfaceResponse getRegisterAppInterfaceResponse();
227+
221228
/**
222229
* Check if capability is supported
223230
* @param systemCapabilityType a system capability type that should be checked for support

base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,48 @@ public void update(VideoStreamingParameters params){
134134
* @see com.smartdevicelink.proxy.SystemCapabilityManager
135135
* @see VideoStreamingCapability
136136
*/
137+
public void update(VideoStreamingCapability capability, String vehicleMake){
138+
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
139+
double scale = DEFAULT_SCALE;
140+
if(capability.getScale() != null) { scale = capability.getScale(); }
141+
ImageResolution resolution = capability.getPreferredResolution();
142+
if(resolution!=null){
143+
144+
if((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() !=null && resolution.getResolutionWidth() > 800))) {
145+
scale = 1.0 / 0.75;
146+
}
147+
148+
if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }
149+
if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth((int)(resolution.getResolutionWidth() / scale)); }
150+
}
151+
152+
// This should be the last call as it will return out once a suitable format is found
153+
final List<VideoStreamingFormat> formats = capability.getSupportedFormats();
154+
if(formats != null && formats.size()>0){
155+
for(VideoStreamingFormat format : formats){
156+
for(int i = 0; i < CURRENTLY_SUPPORTED_FORMATS.length; i ++){
157+
if(CURRENTLY_SUPPORTED_FORMATS[i].equals(format) ){
158+
this.format = format;
159+
return;
160+
}
161+
}
162+
}
163+
DebugTool.logWarning("The VideoStreamingFormat has not been updated because none of the provided formats are supported.");
164+
165+
//TODO In the future we should set format to null, but might be a breaking change
166+
// For now, format will remain whatever was set prior to this update
167+
}
168+
169+
}
170+
171+
/**
172+
* Update the values contained in the capability that should have been returned through the SystemCapabilityManager.
173+
* This update will use the most preferred streaming format from the module.
174+
* @param capability the video streaming capability returned from the SystemCapabilityManager
175+
* @see com.smartdevicelink.proxy.SystemCapabilityManager
176+
* @see VideoStreamingCapability
177+
*/
178+
@Deprecated
137179
public void update(VideoStreamingCapability capability){
138180
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate() * 1000; } // NOTE: the unit of maxBitrate in getSystemCapability is kbps.
139181
double scale = DEFAULT_SCALE;

0 commit comments

Comments
 (0)