diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java index 03854d3ee7..abe187cc89 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java @@ -176,8 +176,9 @@ private DisplayCapabilities createDisplayCapabilities(String displayName, Window convertedCapabilities.setImageFields(defaultMainWindow.getImageFields()); convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable()); convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable()); - convertedCapabilities.setMediaClockFormats(new ArrayList()); // mandatory field but can be empty + convertedCapabilities.setMediaClockFormats(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST); // mandatory field but can be empty convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC)); + convertedCapabilities.setScreenParams(TestValues.GENERAL_SCREENPARAMS); return convertedCapabilities; } 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 1f6c663a85..9272008764 100644 --- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java +++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseSystemCapabilityManager.java @@ -172,6 +172,15 @@ private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayNa // if there are imageTypes in the response, we must assume graphics are supported convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported() != null && defaultMainWindow.getImageTypeSupported().size() > 0); + if (cachedSystemCapabilities.containsKey(SystemCapabilityType.DISPLAY)) { + // Copied from the RAI response, since this parameter is not present in WindowCapability + DisplayCapabilities displayCapabilitiesOld = (DisplayCapabilities) cachedSystemCapabilities.get(SystemCapabilityType.DISPLAY); + convertedCapabilities.setScreenParams(displayCapabilitiesOld.getScreenParams()); + if (displayCapabilitiesOld.getMediaClockFormats() != null) { + convertedCapabilities.setMediaClockFormats(displayCapabilitiesOld.getMediaClockFormats()); + } + } + return convertedCapabilities; } @@ -246,7 +255,11 @@ public WindowCapability getWindowCapability(int windowID) { for (WindowCapability windowCapability : display.getWindowCapabilities()) { int currentWindowID = windowCapability.getWindowID() != null ? windowCapability.getWindowID() : PredefinedWindows.DEFAULT_WINDOW.getValue(); if (currentWindowID == windowID) { - return windowCapability; + // Clone WindowCapability to prevent modification of stored WindowCapability in SystemCapabilityManager + WindowCapability windowCapabilityCopy = (WindowCapability) windowCapability.clone(); + // A null windowID is assumed to be the DefaultWindow according to the spec, but that can be hard for developers to check, so set it explicitly. + windowCapabilityCopy.setWindowID(windowID); + return windowCapabilityCopy; } } return null;