Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b2837a16 authored by Neil Fuller's avatar Neil Fuller
Browse files

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
parent a4aee0d5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment