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

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

Refactoring before supporting multiple NTP servers

Refactoring changes to make it easier to support NTP configuration that
contains multiple NTP servers to try. As part of this change, the NTP
server configuration is being changed from a simple hostname to a URI in
the form ntp://<host>[:port]. This is a local scheme introduced for this
commit for this purpose and not (currently) an official, registered IANA
URI scheme.

Settings parsing in NtpTrustedTime retains support for the simple
hostname-only form to avoid introducing incompatibilities when devices
upgrade and have settings values from earlier releases.  All other cases
(config.xml, commandline) are updated here to only support the new URI
form as these don't have backwards compatibility guarantees.

A later commit will add:
+ The settings / config changes to support a list of URIs in the format
  introduced in this commit, i.e. in place of the single one supported
  today.
+ The server request loop / server stickiness need to support multiple
  servers.

Switching to a URI over a simpler encoding scheme means:
1) Not having to deal with parsing awkward host + port cases, like IPv6
   addresses which contain colons, e.g. "[:::1]:1234" (these are used in
   in our tests).
2) Opens up the possibility of future protocols like NTS via a different
   URI scheme, and future parameterization of NTP server config with
   query params, paths, or similar.
3) Easy delimiting of lists later using a whitespace character like
   space, which will be encoded when part of a URI. This can be used for
   extending settings parsing to support multiple, space-delimited
   configs as settings code doesn't support multi-value settings out of
   the box (unlike config / commandline cases, which are comparatively
   easy).

This commit contains a new OWNERS file for NtpTrustedTimeTest. The file
has been populated with ownership information for TypedValueTest using
information from the OWNERS for the code under test.

Ignore-AOSP-First: The OWNERS change relates to a file landing
  internally
Bug: 223365217
Test: atest frameworks/base/core/tests/coretests/src/android/util/NtpTrustedTimeTest.java
Test: atest cts/tests/tests/os/src/android/os/cts/SystemClockSntpTest.java
Change-Id: I3afbd04659b4e4ee336619ea5ac6db7588057d6e
parent 28f3fe36
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