@@ -172,6 +172,15 @@ private DisplayCapabilities createDeprecatedDisplayCapabilities(String displayNa
172172 // if there are imageTypes in the response, we must assume graphics are supported
173173 convertedCapabilities .setGraphicSupported (defaultMainWindow .getImageTypeSupported () != null && defaultMainWindow .getImageTypeSupported ().size () > 0 );
174174
175+ if (cachedSystemCapabilities .containsKey (SystemCapabilityType .DISPLAY )) {
176+ // Copied from the RAI response, since this parameter is not present in WindowCapability
177+ DisplayCapabilities displayCapabilitiesOld = (DisplayCapabilities ) cachedSystemCapabilities .get (SystemCapabilityType .DISPLAY );
178+ convertedCapabilities .setScreenParams (displayCapabilitiesOld .getScreenParams ());
179+ if (displayCapabilitiesOld .getMediaClockFormats () != null ) {
180+ convertedCapabilities .setMediaClockFormats (displayCapabilitiesOld .getMediaClockFormats ());
181+ }
182+ }
183+
175184 return convertedCapabilities ;
176185 }
177186
@@ -246,7 +255,11 @@ public WindowCapability getWindowCapability(int windowID) {
246255 for (WindowCapability windowCapability : display .getWindowCapabilities ()) {
247256 int currentWindowID = windowCapability .getWindowID () != null ? windowCapability .getWindowID () : PredefinedWindows .DEFAULT_WINDOW .getValue ();
248257 if (currentWindowID == windowID ) {
249- return windowCapability ;
258+ // Clone WindowCapability to prevent modification of stored WindowCapability in SystemCapabilityManager
259+ WindowCapability windowCapabilityCopy = (WindowCapability ) windowCapability .clone ();
260+ // 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.
261+ windowCapabilityCopy .setWindowID (windowID );
262+ return windowCapabilityCopy ;
250263 }
251264 }
252265 return null ;
0 commit comments