Enable providers to report they are "missing"
Previously, providers were only expected to report suggestions, not status / events. This meant that "missing" providers could pretend to be "real" until they were asked for a suggestion at which point they would "fail". However, now the LocationTimeZoneProviderController tracks provider status. It's useful (and clearer) to know if providers are present even if they haven't been asked to do something yet. In order to determine the difference between a provider that hasn't been started yet and a provider that is missing, this commit modifies LocationTimeZoneProvider's initialize() methods to return a boolean that can indicating initalization has failed. It could already throw a RuntimeException for the same result, but returning a boolean is a explicit interface, leaving the RuntimeException path still to handle coding errors and other exceptional failures. There is a new "DisabledLocationTimeZoneProvider" to cover the "there is no provider" case at the LocationTimeZoneProvider level which is hardcoded to return false from initialize. This change means that the NullLocationTimeZoneProviderProxy, which previously handled the "there is no provider" case at a deeper level, can be deleted. Bug: 236624675 Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/ Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/location/ Change-Id: I7841f91e7ced4b59be27592e2e7c0e3d9c3acf7a
Loading
Please register or sign in to comment