Remove validation threads tracking in PrivateDnsConfiguration

The validation threads tracking is not necessary since DnsTlsServer
itself can provide sufficient information to PrivateDnsConfiguration
to decide if a validation should start.

This change comprises:

[1] Remove mPrivateDnsValidateThreads and related functions
[2] Extend DnsTlsServer to tell if it is a present server for a
    network.
[3] PrivateDnsConfiguration reserves every DnsTlsServer object until
    being set to OFF mode or the network is destroyed. Make use of
    [2] to determine which servers should be active for the network.
[4] DnsTlsServers with identical IP address but different private
    DNS provider hostname are treated as different servers, and
    thus they have their own validation thread.
[5] Add a new state, Validation::success_but_expired, which is used
    to determine if a server which had passed the validation should
    be revalidated again.
[6] To fit in with [4], some related tests are modified.

Bug: 79727473
Test: cd packages/modules/DnsResolver && atest
Change-Id: I78afce543ea05be39c36d268576824e9ec798b12
6 files changed
tree: 4d15a32e5df71d14587a02a9b55fce3c05b7206d
  1. aidl_api/
  2. apex/
  3. binder/
  4. include/
  5. tests/
  6. .editorconfig
  7. Android.bp
  8. Dns64Configuration.cpp
  9. Dns64Configuration.h
  10. DnsProxyListener.cpp
  11. DnsProxyListener.h
  12. DnsQueryLog.cpp
  13. DnsQueryLog.h
  14. DnsQueryLogTest.cpp
  15. DnsResolver.cpp
  16. DnsResolver.h
  17. DnsResolverService.cpp
  18. DnsResolverService.h
  19. DnsStats.cpp
  20. DnsStats.h
  21. DnsStatsTest.cpp
  22. DnsTlsDispatcher.cpp
  23. DnsTlsDispatcher.h
  24. DnsTlsQueryMap.cpp
  25. DnsTlsQueryMap.h
  26. DnsTlsServer.cpp
  27. DnsTlsServer.h
  28. DnsTlsSessionCache.cpp
  29. DnsTlsSessionCache.h
  30. DnsTlsSocket.cpp
  31. DnsTlsSocket.h
  32. DnsTlsSocketFactory.h
  33. DnsTlsTransport.cpp
  34. DnsTlsTransport.h
  35. Experiments.cpp
  36. Experiments.h
  37. ExperimentsTest.cpp
  38. getaddrinfo.cpp
  39. getaddrinfo.h
  40. gethnamaddr.cpp
  41. gethnamaddr.h
  42. hostent.h
  43. IDnsTlsSocket.h
  44. IDnsTlsSocketFactory.h
  45. IDnsTlsSocketObserver.h
  46. libnetd_resolv.map.txt
  47. LockedQueue.h
  48. NOTICE
  49. OWNERS
  50. params.h
  51. PREUPLOAD.cfg
  52. PrivateDnsConfiguration.cpp
  53. PrivateDnsConfiguration.h
  54. PrivateDnsConfigurationTest.cpp
  55. README-DoT.md
  56. README.md
  57. res_cache.cpp
  58. res_comp.cpp
  59. res_comp.h
  60. res_debug.cpp
  61. res_debug.h
  62. res_init.cpp
  63. res_init.h
  64. res_mkquery.cpp
  65. res_query.cpp
  66. res_send.cpp
  67. res_send.h
  68. res_stats.cpp
  69. resolv_cache.h
  70. resolv_cache_unit_test.cpp
  71. resolv_callback_unit_test.cpp
  72. resolv_private.h
  73. resolv_test_config_template.xml
  74. resolv_tls_unit_test.cpp
  75. resolv_unit_test.cpp
  76. ResolverController.cpp
  77. ResolverController.h
  78. ResolverEventReporter.cpp
  79. ResolverEventReporter.h
  80. ResolverStats.h
  81. sethostent.cpp
  82. stats.h
  83. stats.proto
  84. TEST_MAPPING
  85. util.cpp
  86. util.h
README.md

Logging

This code uses LOG(X) for logging. Log levels are VERBOSE,DEBUG,INFO,WARNING and ERROR. The default setting is WARNING and logs relate to WARNING and ERROR will be shown. If you want to enable the DEBUG level logs, using following command. adb shell service call dnsresolver 10 i32 1 VERBOSE 0 DEBUG 1 INFO 2 WARNING 3 ERROR 4 Verbose resolver logs could contain PII -- do NOT enable in production builds.