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

Commit b6d71b6b authored by paulhu's avatar paulhu
Browse files

[DRUEL01] Add DnsResolverUnsolicitedEventListener

Add DnsResolverUnsolicitedEventListener that can register
unsolicited event listener to get some dns resolver info.

Bug: 173485754
Test: atest resolv_integration_test resolv_unit_test\
      resolv_stress_test resolv_stats_test_utils_test
Change-Id: I5c229b3f23d5779f289d72f622b3c894780bc417
parent db91ce97
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ aidl_interface {
        "binder/android/net/ResolverHostsParcel.aidl",
        "binder/android/net/ResolverOptionsParcel.aidl",
        "binder/android/net/ResolverParamsParcel.aidl",
        // New AIDL classes should go into android.net.resolv.aidl so they can be clearly identified
        "binder/android/net/resolv/aidl/**/*.aidl",
    ],
    imports: [
        "netd_event_listener_interface",
@@ -54,6 +56,7 @@ aidl_interface {
        "4",
        "5",
        "6",
        "7",
    ],
}

+8 −0
Original line number Diff line number Diff line
@@ -141,6 +141,14 @@ binder_status_t DnsResolverService::dump(int fd, const char** args, uint32_t num
    return statusFromErrcode(res);
}

::ndk::ScopedAStatus DnsResolverService::registerUnsolicitedEventListener(
        const std::shared_ptr<
                aidl::android::net::resolv::aidl::IDnsResolverUnsolicitedEventListener>&) {
    ENFORCE_NETWORK_STACK_PERMISSIONS();

    return ::ndk::ScopedAStatus(AStatus_newOk());
}

::ndk::ScopedAStatus DnsResolverService::checkAnyPermission(
        const std::vector<const char*>& permissions) {
    // TODO: Remove callback and move this to unnamed namespace after libbiner_ndk supports
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ class DnsResolverService : public aidl::android::net::BnDnsResolver {
    ::ndk::ScopedAStatus registerEventListener(
            const std::shared_ptr<aidl::android::net::metrics::INetdEventListener>& listener)
            override;
    ::ndk::ScopedAStatus registerUnsolicitedEventListener(
            const std::shared_ptr<
                    aidl::android::net::resolv::aidl::IDnsResolverUnsolicitedEventListener>&
                    listener) override;

    // Resolver commands.
    ::ndk::ScopedAStatus setResolverConfiguration(
+1 −0
Original line number Diff line number Diff line
a1dc9394598357ccaa74e96f564e7f248b72bad2
+66 −0
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.net;
/* @hide */
interface IDnsResolver {
  boolean isAlive();
  void registerEventListener(android.net.metrics.INetdEventListener listener);
  void setResolverConfiguration(in android.net.ResolverParamsParcel resolverParams);
  void getResolverInfo(int netId, out @utf8InCpp String[] servers, out @utf8InCpp String[] domains, out @utf8InCpp String[] tlsServers, out int[] params, out int[] stats, out int[] wait_for_pending_req_timeout_count);
  void startPrefix64Discovery(int netId);
  void stopPrefix64Discovery(int netId);
  @utf8InCpp String getPrefix64(int netId);
  void createNetworkCache(int netId);
  void destroyNetworkCache(int netId);
  void setLogSeverity(int logSeverity);
  void flushNetworkCache(int netId);
  void setPrefix64(int netId, @utf8InCpp String prefix);
  void registerUnsolicitedEventListener(android.net.resolv.aidl.IDnsResolverUnsolicitedEventListener listener);
  const int RESOLVER_PARAMS_SAMPLE_VALIDITY = 0;
  const int RESOLVER_PARAMS_SUCCESS_THRESHOLD = 1;
  const int RESOLVER_PARAMS_MIN_SAMPLES = 2;
  const int RESOLVER_PARAMS_MAX_SAMPLES = 3;
  const int RESOLVER_PARAMS_BASE_TIMEOUT_MSEC = 4;
  const int RESOLVER_PARAMS_RETRY_COUNT = 5;
  const int RESOLVER_PARAMS_COUNT = 6;
  const int RESOLVER_STATS_SUCCESSES = 0;
  const int RESOLVER_STATS_ERRORS = 1;
  const int RESOLVER_STATS_TIMEOUTS = 2;
  const int RESOLVER_STATS_INTERNAL_ERRORS = 3;
  const int RESOLVER_STATS_RTT_AVG = 4;
  const int RESOLVER_STATS_LAST_SAMPLE_TIME = 5;
  const int RESOLVER_STATS_USABLE = 6;
  const int RESOLVER_STATS_COUNT = 7;
  const int DNS_RESOLVER_LOG_VERBOSE = 0;
  const int DNS_RESOLVER_LOG_DEBUG = 1;
  const int DNS_RESOLVER_LOG_INFO = 2;
  const int DNS_RESOLVER_LOG_WARNING = 3;
  const int DNS_RESOLVER_LOG_ERROR = 4;
  const int TC_MODE_DEFAULT = 0;
  const int TC_MODE_UDP_TCP = 1;
  const int TRANSPORT_UNKNOWN = -1;
  const int TRANSPORT_CELLULAR = 0;
  const int TRANSPORT_WIFI = 1;
  const int TRANSPORT_BLUETOOTH = 2;
  const int TRANSPORT_ETHERNET = 3;
  const int TRANSPORT_VPN = 4;
  const int TRANSPORT_WIFI_AWARE = 5;
  const int TRANSPORT_LOWPAN = 6;
  const int TRANSPORT_TEST = 7;
}
Loading