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

Commit e230104e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6240311 from 73ad2f92 to sc-release

Change-Id: I2c2a8f17ed284a5282af00e8752c7e39c7d116fa
parents 74544f21 73ad2f92
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@ DnsResolverService::DnsResolverService() {
binder_status_t DnsResolverService::start() {
    // TODO: Add disableBackgroundScheduling(true) after libbinder_ndk support it. b/126506010
    // NetdNativeService does call disableBackgroundScheduling currently, so it is fine now.
    DnsResolverService* resolverService = new DnsResolverService();
    std::shared_ptr<DnsResolverService> resolverService =
            ::ndk::SharedRefBase::make<DnsResolverService>();
    binder_status_t status =
            AServiceManager_addService(resolverService->asBinder().get(), getServiceName());
    if (status != STATUS_OK) {
+2 −1
Original line number Diff line number Diff line
@@ -61,8 +61,9 @@ class DnsResolverService : public aidl::android::net::BnDnsResolver {
    // Debug log command
    ::ndk::ScopedAStatus setLogSeverity(int32_t logSeverity) override;

  private:
    DnsResolverService();

  private:
    // TODO: Remove below items after libbiner_ndk supports check_permission.
    ::ndk::ScopedAStatus checkAnyPermission(const std::vector<const char*>& permissions);
};
+7 −5
Original line number Diff line number Diff line
@@ -37,10 +37,12 @@ std::unique_ptr<DnsTlsQueryMap::QueryFuture> DnsTlsQueryMap::recordQuery(
        LOG(WARNING) << "All query IDs are in use";
        return nullptr;
    }
    Query q = { .newId = static_cast<uint16_t>(newId), .query = query };
    std::map<uint16_t, QueryPromise>::iterator it;
    bool inserted;
    std::tie(it, inserted) = mQueries.emplace(newId, q);

    // Make a copy of the query.
    std::vector<uint8_t> tmp(query.base(), query.base() + query.size());
    Query q = {.newId = static_cast<uint16_t>(newId), .query = std::move(tmp)};

    const auto [it, inserted] = mQueries.try_emplace(newId, q);
    if (!inserted) {
        LOG(ERROR) << "Failed to store pending query";
        return nullptr;
@@ -137,7 +139,7 @@ void DnsTlsQueryMap::onResponse(std::vector<uint8_t> response) {
    }
    Result r = { .code = Response::success, .response = std::move(response) };
    // Rewrite ID to match the query
    const uint8_t* data = it->second.query.query.base();
    const uint8_t* data = it->second.query.query.data();
    r.response[0] = data[0];
    r.response[1] = data[1];
    LOG(DEBUG) << "Sending result to dispatcher";
+7 −3
Original line number Diff line number Diff line
@@ -34,15 +34,19 @@ namespace net {
// All methods are thread-safe and non-blocking.
class DnsTlsQueryMap {
  public:
    enum class Response : uint8_t { success, network_error, limit_error, internal_error };

    struct Query {
        // The new ID number assigned to this query.
        uint16_t newId;
        // A query that has been passed to recordQuery(), with its original ID number.
        const netdutils::Slice query;
        const std::vector<uint8_t> query;
    };

    typedef DnsTlsServer::Response Response;
    typedef DnsTlsServer::Result Result;
    struct Result {
        Response code;
        std::vector<uint8_t> response;
    };

    struct QueryFuture {
        QueryFuture(Query query, std::future<Result> result)
+0 −7
Original line number Diff line number Diff line
@@ -37,13 +37,6 @@ struct DnsTlsServer {
    // Allow sockaddr_storage to be promoted to DnsTlsServer automatically.
    DnsTlsServer(const sockaddr_storage& ss) : ss(ss) {}

    enum class Response : uint8_t { success, network_error, limit_error, internal_error };

    struct Result {
        Response code;
        std::vector<uint8_t> response;
    };

    // The server location, including IP and port.
    sockaddr_storage ss = {};

Loading