Fix Wear ProtoLayout and WatchFace date/time formatting for SDK 37
Targeting SDK 37 introduces updated ICU localization data and changes
Robolectric's Choreographer/Looper scheduling behavior, meaning we need
to update the follwoing:
1. Wear Complications Date/Time Formatting:
- SDK 37 ICU uses Narrow No-Break Space (\u202f)
in day-period markers (e.g. Spanish "a. m."). Sanitizing \u202f
ensures shortened 12-hour strings stay within the strict 7-character complication limit.
- 12-hour short-text time formatting bypassed the locale override table for the "hmm" skeleton, causing locales like Bulgarian ("bg") to
exceed character bounds. Unifying skeleton lookups across both date
and time formatters ensures locale-specific overrides are respected.
2. ProtoLayout Dynamic Date Formatting:
- DynamicDateFormat previously assumed day-period ("a") patterns were
always single-character, ignoring skeleton length. Preserving the
pattern length allows multi-character/narrow day-period formats
(such as "aaaaa") to evaluate correctly across all locales.
3. ProtoLayout Inflation Animation Test Timing:
- In SDK 37, Robolectric shifts Choreographer to a software-based
no-VSYNC model where frame callbacks are posted directly as Looper
messages. Draining all delayed tasks via runToEndOfTasks() prematurely
advanced the clock through the entire animation duration, discharging
animation completion and releasing quota permits early. Advancing
virtual time specifically to the 600ms transition delay allows the
in-flight animation to hold its quota permit during the overlapping
transition test.
TESTED: ./gradlew :wear:protolayout:protolayout-expression:testReleaseUnitTest
TESTED: ./gradlew :wear:protolayout:protolayout-renderer:testReleaseUnitTest
TESTED: ./gradlew :wear:watchface:watchface-complications-data:testReleaseUnitTest
BUG: 511299605
Change-Id: I19b9c81dbce1a3f14257eb7b9fc956dd1e7f0828 O
Omar Ismail committed
2067140bf6cee4ce56679be9c85ad2277477c890
Parent: f30654b