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

Commit fe72ac15 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11464157 from 68716602 to 24Q2-release

Change-Id: I6d993cf253baec2119710ae4425b3f98f9e52313
parents db8a2ae0 68716602
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ cc_test {
        "netd_aidl_interface-lateststable-ndk",
        "netd_event_listener_interface-lateststable-ndk",
        "libcrypto_static",
        "libconnectivity_native_test_utils",
        "libcutils",
        "libdoh_ffi_for_test",
        "libgmock",
+2 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ class CallbackTest : public NetNativeTestBase {
        initDnsResolverCallbacks();
        // Create cache for test
        android::net::gDnsResolv->resolverCtrl.createNetworkCache(TEST_NETID);
        AllowNetworkInBackground(TEST_UID, true);
    }

    void TearDown() override {
@@ -116,6 +117,7 @@ class CallbackTest : public NetNativeTestBase {
        resetDnsResolverCallbacks();
        // Delete cache for test
        android::net::gDnsResolv->resolverCtrl.destroyNetworkCache(TEST_NETID);
        AllowNetworkInBackground(TEST_UID, false);
    }

    int SetResolvers() {
+7 −1
Original line number Diff line number Diff line
@@ -221,8 +221,14 @@ class ResolverTest : public NetNativeTestBase {
        // Start the binder thread pool for listening DNS metrics events and receiving death
        // recipient.
        ABinderProcess_startThreadPool();
        AllowNetworkInBackground(TEST_UID, true);
        AllowNetworkInBackground(TEST_UID2, true);
    }
    static void TearDownTestSuite() {
        AIBinder_DeathRecipient_delete(sResolvDeathRecipient);
        AllowNetworkInBackground(TEST_UID, false);
        AllowNetworkInBackground(TEST_UID2, false);
    }
    static void TearDownTestSuite() { AIBinder_DeathRecipient_delete(sResolvDeathRecipient); }

  protected:
    void SetUp() {
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <android-base/chrono_utils.h>
#include <android-base/logging.h>
#include <firewall.h>

using android::netdutils::ScopedAddrinfo;

@@ -230,6 +231,18 @@ void RemoveMdnsRoute() {
    EXPECT_EQ(0, ForkAndRun(args_v6));
}

void AllowNetworkInBackground(int uid, bool allow) {
    if (android::modules::sdklevel::IsAtLeastV()) {
        // Background networking is always allowed on earlier versions.
        Firewall* firewall = Firewall::getInstance();
        if (allow) {
            firewall->addRule(uid, BACKGROUND_MATCH);
        } else {
            firewall->removeRule(uid, BACKGROUND_MATCH);
        }
    }
}

bool is64bitAbi() {
    return android::base::GetProperty("ro.product.cpu.abi", "").find("64") != std::string::npos;
}
+1 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ android::netdutils::ScopedAddrinfo safe_getaddrinfo(const char* node, const char

void SetMdnsRoute();
void RemoveMdnsRoute();
void AllowNetworkInBackground(int uid, bool allow);

#define SKIP_IF_BEFORE_T                                                         \
    do {                                                                         \