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

Commit 8e42b2cd authored by Luke Huang's avatar Luke Huang Committed by Gerrit Code Review
Browse files

Merge changes Ie2536938,Ia74c8440

* changes:
  Add doh experiment flag
  Add libdoh_ffi_for_test required by unit test
parents 94c836af 3682c073
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -372,3 +372,30 @@ rust_test {
    ],
    min_sdk_version: "29",
}

// It's required by unit tests.
rust_ffi_static {
    name: "libdoh_ffi_for_test",
    crate_name: "doh",
    srcs: ["doh.rs"],
    edition: "2018",

    rlibs: [
        "libandroid_logger",
        "libanyhow",
        "liblazy_static",
        "liblibc",
        "liblog_rust",
        "libquiche_static",
        "libring",
        "libtokio",
        "liburl",
    ],
    prefer_rlib: true,

    apex_available: [
        "//apex_available:platform",  // Needed by doh_ffi_test
        "com.android.resolv"
    ],
    min_sdk_version: "29",
}
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ class Experiments {
            "dot_query_timeout_ms",
            "dot_validation_latency_factor",
            "dot_validation_latency_offset_ms",
            "doh",
    };
    // This value is used in updateInternal as the default value if any flags can't be found.
    static constexpr int kFlagIntDefault = INT_MIN;
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ cc_test {
    srcs: ["doh_ffi_test.cpp"],
    static_libs: [
        "libcrypto_static",
        "libdoh_ffi",
        "libdoh_ffi_for_test",
        "libgmock",
        "liblog",
        "libring-core",
+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@

#include <android-base/properties.h>

#include "Experiments.h"

socklen_t sockaddrSize(const sockaddr* sa);
socklen_t sockaddrSize(const sockaddr_storage& ss);

@@ -56,3 +58,7 @@ inline uint64_t getApiLevel() {
inline bool isUserDebugBuild() {
    return (android::base::GetProperty("ro.build.type", "user") == "userdebug");
}

inline bool isDoHEnabled() {
    return android::net::Experiments::getInstance()->getFlag("doh", 0);
}