Use ServiceConfigAccessor directly
Architectural change: Make ServiceConfigAccessor a direct dependency of TimeZoneDetectorStrategyImpl. Previously, TimeZoneDetectorInternalImpl and TimeZoneDetectorService used ServiceConfigAccessor directly for reading / writing config, and TimeZoneDetectorStrategyImpl read it via it's "Environment" facade and relied on async updates to follow along. Upcoming changes that are likely to add more information to the cached status information that downstream components will be interested in (i.e. will want to listen to). This extra information will be held by TimeZoneDetectorStrategyImpl so it will be easier if it is (only) TimeZoneDetectorStrategyImpl that manages the ServiceConfigAccessor of the three. The dependency on ServiceConfigAccessor is removed from the classes higher in the stack (TimeZoneDetectorService / TimeZoneDetectorInternalImpl), which now call through to the Strategy. The ServiceConfigAccessor functionality has been removed from the Environment, and TimeZoneDetectorStrategyImpl uses ServiceConfigAccessor directly. Now that the TimeZoneDetectorStrategyImpl is in the direct config read / update flow for binder calls, some care has been taken to ensure the cached ConfigurationInternal is kept up to date. Previously, the TimeZoneDetectorStrategyImpl updates happened asynchronously. There's some complexity around caching / eventual consistency here that might be detectable but should not have any impact on behavior. Notes for people following along: We cannot assume that the only thing affecting config / status happens via TimeZoneDetectorStrategyImpl: Android's settings and device config are mutatable via all sorts of routes (e.g. command line, backup&restore, random partner apps). This is not likely to change. Therefore, the TimeZoneDetectorStrategyImpl still listens for ServiceConfigAccessor updates, but will (now) only forward them on if something changes Vs the last one it notified about. This commit changes the time zone strategy code. A follow-up will make an equivalent change for the time code at a later time for consistency. Bug: 253015306 Test: atest services/tests/servicestests/src/com/android/server/timedetector/ services/tests/servicestests/src/com/android/server/timezonedetector/ Test: atest ./tests/tests/time/src/android/app/time/cts/ Change-Id: Ie3fe60a624be8a5bb3e161a3e88f0a257cd96c3d
Loading
Please register or sign in to comment