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

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

Snap for 13880410 from d380e4fb to 25Q4-release

Change-Id: I84a57a377888eea52b5716c1b56979108bda4b4d
parents f549ba0b d380e4fb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
#pragma once

#include <android-base/result.h>
#include <android/configuration.h>
#include <ftl/enum.h>
#include <ui/FloatRect.h>
#include <ui/LogicalDisplayId.h>
#include <ui/Transform.h>

#include <cinttypes>
#include <unordered_map>
@@ -65,6 +67,9 @@ struct DisplayTopologyGraph {
    ui::LogicalDisplayId primaryDisplayId = ui::LogicalDisplayId::INVALID;
    std::unordered_map<ui::LogicalDisplayId, Properties> graph;

    ui::Transform localPxToGlobalDpTransform(ui::LogicalDisplayId displayId) const;
    ui::Transform globalDpToLocalPxTransform(ui::LogicalDisplayId displayId) const;

    DisplayTopologyGraph() = default;
    std::string dump() const;

+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public:
class UnixSocketAddress : public RpcSocketAddress {
public:
    explicit UnixSocketAddress(const char* path) : mAddr({.sun_family = AF_UNIX}) {
        LOG_ALWAYS_FATAL_IF(path == nullptr, "path must not be nullptr");
        unsigned int pathLen = strlen(path) + 1;
        LOG_ALWAYS_FATAL_IF(pathLen > sizeof(mAddr.sun_path), "Socket path is too long: %u %s",
                            pathLen, path);
+2 −5
Original line number Diff line number Diff line
@@ -62,12 +62,9 @@ public:
    setupUnixDomainSocketBootstrapServer(binder::unique_fd serverFd);

    /**
     * This represents a session for responses, e.g.:
     * Creates an RPC server that binds to a Unix socket address |path|.
     *
     *     process A serves binder a
     *     process B opens a session to process A
     *     process B makes binder b and sends it to A
     *     A uses this 'back session' to send things back to B
     * |path| must not be null.
     */
    [[nodiscard]] LIBBINDER_EXPORTED status_t setupUnixDomainServer(const char* path);

+9 −0
Original line number Diff line number Diff line
@@ -82,6 +82,15 @@ extern "C" {
ARpcServer* ARpcServer_newVsock(AIBinder* service, unsigned int cid, unsigned int port,
                                unsigned int* assignedPort) {
    auto server = RpcServer::make();
    if (const AIBinder_Class* serviceClass = AIBinder_getClass(service); serviceClass) {
        // needed before NDK APIs are finalized in API level 37 for the new
        // AIBinder_setMinRpcThreads to be available.
        if (0 ==
            strcmp(AIBinder_Class_getDescriptor(serviceClass),
                   "com.android.isolated_storage_service.IIcingSearchEngine")) {
            server->setMaxThreads(2);
        }
    }

    unsigned int bindCid = VMADDR_CID_ANY; // bind to the remote interface
    if (cid == VMADDR_CID_LOCAL) {
+42 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <ftl/enum.h>
#include <input/DisplayTopologyGraph.h>
#include <input/PrintTools.h>
#include <log/log_main.h>
#include <ui/LogicalDisplayId.h>

#include <algorithm>
@@ -171,6 +172,47 @@ std::string dumpTopologyGraphComponents(

} // namespace

ui::Transform DisplayTopologyGraph::localPxToGlobalDpTransform(
        ui::LogicalDisplayId displayId) const {
    const auto displayPropertiesIt = graph.find(displayId);
    LOG_ALWAYS_FATAL_IF(displayPropertiesIt == graph.end(), "Invalid display %d in %s",
                        displayId.val(), __func__);
    const auto& displayProperties = displayPropertiesIt->second;

    // Scale to convert from px to DP.
    const float pxToDpScaleFactor = static_cast<float>(ACONFIGURATION_DENSITY_MEDIUM) /
            static_cast<float>(displayProperties.density);
    ui::Transform pxToDpScaleTransform;
    pxToDpScaleTransform.set(pxToDpScaleFactor, 0.0f, 0.0f, pxToDpScaleFactor);

    // Translate origin from local to the topology origin to convert to the global coordinates.
    const auto& displayBounds = displayProperties.boundsInGlobalDp;
    ui::Transform localDpToGlobalDpTransform;
    localDpToGlobalDpTransform.set(displayBounds.left, displayBounds.top);
    return localDpToGlobalDpTransform * pxToDpScaleTransform;
}

ui::Transform DisplayTopologyGraph::globalDpToLocalPxTransform(
        ui::LogicalDisplayId displayId) const {
    const auto displayPropertiesIt = graph.find(displayId);
    LOG_ALWAYS_FATAL_IF(displayPropertiesIt == graph.end(), "Invalid display %d in %s",
                        displayId.val(), __func__);
    const auto& displayProperties = displayPropertiesIt->second;

    // Translate from the topology origin to the destination-display's origin.
    const auto& displayBounds = displayProperties.boundsInGlobalDp;
    ui::Transform globalDpToLocalDpTransform;
    globalDpToLocalDpTransform.set(-displayBounds.left, -displayBounds.top);

    // Scale to convert from dp to px.
    const float dpToPxScaleFactor = static_cast<float>(displayProperties.density) /
            static_cast<float>(ACONFIGURATION_DENSITY_MEDIUM);
    ui::Transform dpToPxScaleTransform;
    dpToPxScaleTransform.set(dpToPxScaleFactor, 0.0f, 0.0f, dpToPxScaleFactor);

    return dpToPxScaleTransform * globalDpToLocalDpTransform;
}

std::string DisplayTopologyAdjacentDisplay::dump() const {
    std::string dump;
    dump += base::StringPrintf("DisplayTopologyAdjacentDisplay: {displayId: %d, position: %s, "
Loading