Rewire config for time zone detection services
All configuration-related logic (static, server flags, user settings) for time zone detector services has been consolidated in the ServiceConfigAccessor. Previously, some configuration, the parts that were most associated with time_zone_detector and mostly user-facing was located in the TimeZoneDetectorStrategyImpl, which meant that there was quite a lot of plumbing logic to get the user config info / events to the location-based detection code which was added in S. The ServiceConfigAccessor was already a singleton that several of the classes involved were referencing. The baroque listener chaining has been simplified: everything just talks to the ServiceConfigAccessor rather than being wired (sometimes indirectly) to the TimeZoneDetectorStrategy. The interface for ServiceConfigAccessor has been extracted to enable easier unit testing, the implementation is now ServiceConfigAccessorImpl. This refactor simplifies the TimeZoneDetectorStrategyImpl, which no longer deals with user configuration, and is just another client of the ServiceConfigAccessor. ServiceConfigAccessor is now a larger lump of hard-to-unit-test logic, but coverage of the detection algorithm logic itself hasn't dropped significantly, as can be seen from the test changes. Bug: 197624972 Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/ Test: atest cts/hostsidetests/time/host/src/android/time/cts/host/ Change-Id: Ib70e6a37a1ebfc894840a3e02224522e8cefdac3
Loading
Please register or sign in to comment