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

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

Snap for 7668315 from c977b0eb to tm-release

Change-Id: If0748ec81eb29dabde7e4f790e2233643faa7176
parents f688d445 c977b0eb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@

namespace android {

using android::base::StringPrintf;
using android::net::NetworkDnsEventReported;
using netdutils::DumpWriter;
using netdutils::IPAddress;
@@ -65,7 +64,7 @@ void Dns64Configuration::startPrefixDiscovery(unsigned netId) {

    // Note that capturing |cfg| in this lambda creates a copy.
    std::thread discovery_thread([this, cfg, netId] {
        setThreadName(StringPrintf("Nat64Pfx_%u", netId).c_str());
        setThreadName(fmt::format("Nat64Pfx_{}", netId));

        // Make a mutable copy rather than mark the whole lambda mutable.
        // No particular reason.
+1 −2
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@
#include <algorithm>
#include <vector>

#include <android-base/stringprintf.h>
#include <android/multinetwork.h>  // ResNsendFlags
#include <cutils/misc.h>           // FIRST_APPLICATION_UID
#include <cutils/multiuser.h>
@@ -560,7 +559,7 @@ bool getDns64Prefix(unsigned netId, netdutils::IPPrefix* prefix) {

std::string makeThreadName(unsigned netId, uint32_t uid) {
    // The maximum of netId and app_id are 5-digit numbers.
    return android::base::StringPrintf("Dns_%u_%u", netId, multiuser_get_app_id(uid));
    return fmt::format("Dns_{}_{}", netId, multiuser_get_app_id(uid));
}

}  // namespace
+3 −5
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <vector>

#include <BinderUtil.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
@@ -39,7 +38,6 @@
using aidl::android::net::ResolverOptionsParcel;
using aidl::android::net::ResolverParamsParcel;
using android::base::Join;
using android::base::StringPrintf;
using android::netdutils::DumpWriter;
using android::netdutils::IPPrefix;

@@ -182,8 +180,8 @@ binder_status_t DnsResolverService::dump(int fd, const char** args, uint32_t num
        }
    }

    auto err = StringPrintf("UID %d / PID %d does not have any of the following permissions: %s",
                            uid, pid, Join(permissions, ',').c_str());
    auto err = fmt::format("UID {} / PID {} does not have any of the following permissions: {}",
                           uid, pid, Join(permissions, ','));
    return ::ndk::ScopedAStatus(AStatus_fromExceptionCodeWithMessage(EX_SECURITY, err.c_str()));
}

@@ -197,7 +195,7 @@ binder_status_t DnsResolverService::dump(int fd, const char** args, uint32_t num
    uid_t uid = AIBinder_getCallingUid();
    // CAUTION: caCertificate should NOT be used except for internal testing.
    if (resolverParams.caCertificate.size() != 0 && uid != AID_ROOT) {
        auto err = StringPrintf("UID %d is not authorized to set a non-empty CA certificate", uid);
        auto err = fmt::format("UID {} is not authorized to set a non-empty CA certificate", uid);
        return ::ndk::ScopedAStatus(AStatus_fromExceptionCodeWithMessage(EX_SECURITY, err.c_str()));
    }

+8 −9
Original line number Diff line number Diff line
@@ -19,12 +19,11 @@

#include "DnsStats.h"

#include <android-base/format.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>

namespace android::net {

using base::StringPrintf;
using netdutils::DumpWriter;
using netdutils::IPAddress;
using netdutils::IPSockAddr;
@@ -54,7 +53,7 @@ std::string rcodeToName(int rcode) {
        case NS_R_NOTZONE: return "NOTZONE";
        case NS_R_INTERNAL_ERROR: return "INTERNAL_ERROR";
        case NS_R_TIMEOUT: return "TIMEOUT";
        default: return StringPrintf("UNKNOWN(%d)", rcode);
        default: return fmt::format("UNKNOWN({})", rcode);
    }
    // clang-format on
}
@@ -82,18 +81,18 @@ int StatsData::averageLatencyMs() const {
}

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

    const auto now = std::chrono::steady_clock::now();
    const int lastUpdateSec = duration_cast<seconds>(now - lastUpdate).count();
    std::string buf;
    for (const auto& [rcode, counts] : rcodeCounts) {
        if (counts != 0) {
            buf += StringPrintf("%s:%d ", rcodeToName(rcode).c_str(), counts);
            buf += fmt::format("{}:{} ", rcodeToName(rcode), counts);
        }
    }
    return StringPrintf("%s (%d, %dms, [%s], %ds)", sockAddr.ip().toString().c_str(), total,
                        averageLatencyMs(), buf.c_str(), lastUpdateSec);
    return fmt::format("{} ({}, {}ms, [{}], {}s)", sockAddr.ip().toString(), total,
                       averageLatencyMs(), buf, lastUpdateSec);
}

StatsRecords::StatsRecords(const IPSockAddr& ipSockAddr, size_t size)
@@ -273,8 +272,8 @@ void DnsStats::dump(DumpWriter& dw) {
        }
        for (const auto& [_, statsRecords] : statsMap) {
            const StatsData& data = statsRecords.getStatsData();
            std::string str = data.toString();
            str += StringPrintf(" score{%.1f}", statsRecords.score());
            std::string str =
                    fmt::format("{} score{{{:.1f}}}", data.toString(), statsRecords.score());
            dw.println("%s", str.c_str());
        }
    };
+1 −3
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include "IDnsTlsSocketObserver.h"

#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <netdutils/SocketOption.h>
#include <netdutils/ThreadUtil.h>

@@ -45,7 +44,6 @@
namespace android {

using android::net::Experiments;
using base::StringPrintf;
using netdutils::enableSockopt;
using netdutils::enableTcpKeepAlives;
using netdutils::isOk;
@@ -400,7 +398,7 @@ void DnsTlsSocket::loop() {
    std::deque<std::vector<uint8_t>> q;
    const int timeout_msecs = DnsTlsSocket::kIdleTimeout.count() * 1000;

    setThreadName(StringPrintf("TlsListen_%u", mMark & 0xffff).c_str());
    setThreadName(fmt::format("TlsListen_{}", mMark & 0xffff));

    if (mAsyncHandshake) {
        if (Status status = tcpConnect(); !status.ok()) {
Loading