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

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

Snap for 8041703 from e299fe27 to mainline-sdkext-release

Change-Id: I2b76878be3793bdb1121529412ada635097052d9
parents 202ad37c e299fe27
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ aidl_interface {
    backend: {
        java: {
            apex_available: [
                "com.android.bluetooth.updatable",
                "com.android.tethering",
                "com.android.wifi",
            ],
+3 −4
Original line number Diff line number Diff line
@@ -81,8 +81,7 @@ int StatsData::averageLatencyMs() const {
}

std::string StatsData::toString() const {
    if (total == 0)
        return fmt::format("{}:{} <no data>", sockAddr.ip().toString(), sockAddr.port());
    if (total == 0) return fmt::format("{} <no data>", sockAddr.toString());

    const auto now = std::chrono::steady_clock::now();
    const int lastUpdateSec = duration_cast<seconds>(now - lastUpdate).count();
@@ -92,8 +91,8 @@ std::string StatsData::toString() const {
            buf += fmt::format("{}:{} ", rcodeToName(rcode), counts);
        }
    }
    return fmt::format("{}:{} ({}, {}ms, [{}], {}s)", sockAddr.ip().toString(), sockAddr.port(),
                       total, averageLatencyMs(), buf, lastUpdateSec);
    return fmt::format("{} ({}, {}ms, [{}], {}s)", sockAddr.toString(), total, averageLatencyMs(),
                       buf, lastUpdateSec);
}

StatsRecords::StatsRecords(const IPSockAddr& ipSockAddr, size_t size)
+2 −3
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ class DnsStatsTest : public ::testing::Test {
                          const std::vector<StatsData>& dohData) {
        // A pattern to capture three matches:
        //     server address (empty allowed), the statistics, and the score.
        const std::regex pattern(R"(\s{4,}([0-9a-fA-F:\.]*)[ ]?([<(].*[>)])[ ]?(\S*))");
        const std::regex pattern(R"(\s{4,}([0-9a-fA-F:\.\]\[]*)[ ]?([<(].*[>)])[ ]?(\S*))");
        std::string dumpString = captureDumpOutput();

        const auto check = [&](const std::vector<StatsData>& statsData, const std::string& protocol,
@@ -142,8 +142,7 @@ class DnsStatsTest : public ::testing::Test {

            for (const auto& stats : statsData) {
                ASSERT_TRUE(std::regex_search(*dumpString, sm, pattern));
                EXPECT_EQ(sm[1], stats.sockAddr.ip().toString() + ":" +
                                         std::to_string(stats.sockAddr.port()));
                EXPECT_EQ(sm[1], stats.sockAddr.toString());
                EXPECT_FALSE(sm[2].str().empty());
                EXPECT_FALSE(sm[3].str().empty());
                *dumpString = sm.suffix();
+3 −2
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@
#pragma once

#include <climits>
#include <map>
#include <mutex>
#include <string>
#include <string_view>
#include <unordered_map>

#include <android-base/thread_annotations.h>
#include <netdutils/DumpWriter.h>
@@ -45,7 +45,7 @@ class Experiments {
    Experiments() = delete;
    void updateInternal() EXCLUDES(mMutex);
    mutable std::mutex mMutex;
    std::unordered_map<std::string_view, int> mFlagsMapInt GUARDED_BY(mMutex);
    std::map<std::string_view, int> mFlagsMapInt GUARDED_BY(mMutex);
    // TODO: Migrate other experiment flags to here.
    // (retry_count, retransmission_time_interval)
    static constexpr const char* const kExperimentFlagKeyList[] = {
@@ -64,6 +64,7 @@ class Experiments {
            "doh",
            "doh_query_timeout_ms",
            "doh_probe_timeout_ms",
            "doh_idle_timeout_ms",
            "mdns_resolution",
    };
    // This value is used in updateInternal as the default value if any flags can't be found.
+4 −4
Original line number Diff line number Diff line
@@ -14,10 +14,10 @@
 * limitations under the License.
 */

#include <map>
#include <mutex>
#include <string>
#include <string_view>
#include <unordered_map>

#include <android-base/format.h>
#include <android-base/test_utils.h>
@@ -72,7 +72,7 @@ class ExperimentsTest : public ::testing::Test {
    }

    void expectGetDnsExperimentFlagInt() {
        std::unordered_map<std::string_view, int> tempMap;
        std::map<std::string_view, int> tempMap;
        for (const auto& key : Experiments::kExperimentFlagKeyList) {
            tempMap[key] = mExperiments.getFlag(key, 0);
        }
@@ -102,11 +102,11 @@ class ExperimentsTest : public ::testing::Test {
        EXPECT_EQ(dumpString.substr(startPos), "\n");
    }

    static std::unordered_map<std::string_view, int> sFakeFlagsMapInt;
    static std::map<std::string_view, int> sFakeFlagsMapInt;
    Experiments mExperiments;
};

std::unordered_map<std::string_view, int> ExperimentsTest::sFakeFlagsMapInt;
std::map<std::string_view, int> ExperimentsTest::sFakeFlagsMapInt;

TEST_F(ExperimentsTest, update) {
    std::vector<int> testValues = {50, 3, 5, 0};
Loading