Use LinkedHashMap for sNamedColorSpaces.
This previously used a HashMap, which returns an unordered list for the values() function. The ColorSpace.match function will get that list and then try to match on it. Because multiple color spaces can match to the same input arguments, this means it would randomly return one of the matching color spaces. This lead the testMatch function in the cts test to be flaky. By switching to a LinkedHashMap, this returns a sorted values() list so the function will consistently return the same value for the same input. This primarily affects the host JVM, where HashMap iteration behavior seems to be slightly different than on libcore. Test: Tested in Robolectric and the cts test. Change-Id: I6c4882a2649fc639c4c24aded302bef2c58cbf06 Bug: b/416031802 Flag: EXEMPT bugfix
Loading
Please register or sign in to comment