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

Commit 01cb36fb authored by Mayank Garg's avatar Mayank Garg Committed by Android (Google) Code Review
Browse files

Merge "Rename the newly added maps variable to be more descriptive" into main

parents 96c424ea 60b45628
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -106,15 +106,15 @@ struct InputReaderConfiguration {

    // The associations between input ports and display ports.
    // Used to determine which DisplayViewport should be tied to which InputDevice.
    std::unordered_map<std::string, uint8_t> portAssociations;
    std::unordered_map<std::string, uint8_t> inputPortToDisplayPortAssociations;

    // The associations between input device ports and display unique ids.
    // Used to determine which DisplayViewport should be tied to which InputDevice.
    std::unordered_map<std::string, std::string> uniqueIdAssociationsByPort;
    std::unordered_map<std::string, std::string> inputPortToDisplayUniqueIdAssociations;

    // The associations between input device descriptor and display unique ids.
    // Used to determine which DisplayViewport should be tied to which InputDevice.
    std::unordered_map<std::string, std::string> uniqueIdAssociationsByDescriptor;
    std::unordered_map<std::string, std::string> inputDeviceDescriptorToDisplayUniqueIdAssociations;

    // The associations between input device ports device types.
    // This is used to determine which device type and source should be tied to which InputDevice.
+4 −4
Original line number Diff line number Diff line
@@ -281,14 +281,14 @@ std::list<NotifyArgs> InputDevice::configureInternal(nsecs_t when,
            const std::string& inputDeviceDescriptor = mIdentifier.descriptor;
            if (!inputDeviceDescriptor.empty()) {
                const std::unordered_map<std::string, uint8_t>& ports =
                        readerConfig.portAssociations;
                        readerConfig.inputPortToDisplayPortAssociations;
                const auto& displayPort = ports.find(inputDeviceDescriptor);
                if (displayPort != ports.end()) {
                    mAssociatedDisplayPort = std::make_optional(displayPort->second);
                } else {
                    const std::unordered_map<std::string, std::string>&
                            displayUniqueIdsByDescriptor =
                                    readerConfig.uniqueIdAssociationsByDescriptor;
                                    readerConfig.inputDeviceDescriptorToDisplayUniqueIdAssociations;
                    const auto& displayUniqueIdByDescriptor =
                            displayUniqueIdsByDescriptor.find(inputDeviceDescriptor);
                    if (displayUniqueIdByDescriptor != displayUniqueIdsByDescriptor.end()) {
@@ -301,13 +301,13 @@ std::list<NotifyArgs> InputDevice::configureInternal(nsecs_t when,
            const std::string& inputPort = mIdentifier.location;
            if (!inputPort.empty()) {
                const std::unordered_map<std::string, uint8_t>& ports =
                        readerConfig.portAssociations;
                        readerConfig.inputPortToDisplayPortAssociations;
                const auto& displayPort = ports.find(inputPort);
                if (displayPort != ports.end()) {
                    mAssociatedDisplayPort = std::make_optional(displayPort->second);
                } else {
                    const std::unordered_map<std::string, std::string>& displayUniqueIdsByPort =
                            readerConfig.uniqueIdAssociationsByPort;
                            readerConfig.inputPortToDisplayUniqueIdAssociations;
                    const auto& displayUniqueIdByPort = displayUniqueIdsByPort.find(inputPort);
                    if (displayUniqueIdByPort != displayUniqueIdsByPort.end()) {
                        mAssociatedDisplayUniqueIdByPort = displayUniqueIdByPort->second;
+2 −2
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ void FakeInputReaderPolicy::addExcludedDeviceName(const std::string& deviceName)

void FakeInputReaderPolicy::addInputPortAssociation(const std::string& inputPort,
                                                    uint8_t displayPort) {
    mConfig.portAssociations.insert({inputPort, displayPort});
    mConfig.inputPortToDisplayPortAssociations.insert({inputPort, displayPort});
}

void FakeInputReaderPolicy::addDeviceTypeAssociation(const std::string& inputPort,
@@ -139,7 +139,7 @@ void FakeInputReaderPolicy::addDeviceTypeAssociation(const std::string& inputPor

void FakeInputReaderPolicy::addInputUniqueIdAssociation(const std::string& inputUniqueId,
                                                        const std::string& displayUniqueId) {
    mConfig.uniqueIdAssociationsByPort.insert({inputUniqueId, displayUniqueId});
    mConfig.inputPortToDisplayUniqueIdAssociations.insert({inputUniqueId, displayUniqueId});
}

void FakeInputReaderPolicy::addKeyboardLayoutAssociation(const std::string& inputUniqueId,