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

Commit 0dd3ca0c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "reader-config-enum" into udc-dev

* changes:
  Use ftl::Flags for InputReaderConfiguration::Change
  ftl_flags: Add default parameter to any()
parents c22a33e1 4bf6d455
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -120,7 +120,7 @@ public:
    }
    }


    /* Tests whether any of the given flags are set */
    /* Tests whether any of the given flags are set */
    bool any(Flags<F> f) const { return (mFlags & f.mFlags) != 0; }
    bool any(Flags<F> f = ~Flags<F>()) const { return (mFlags & f.mFlags) != 0; }


    /* Tests whether all of the given flags are set */
    /* Tests whether all of the given flags are set */
    bool all(Flags<F> f) const { return (mFlags & f.mFlags) == f.mFlags; }
    bool all(Flags<F> f) const { return (mFlags & f.mFlags) == f.mFlags; }
+4 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ TEST(Flags, Test) {


TEST(Flags, Any) {
TEST(Flags, Any) {
    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
    Flags<TestFlags> flags = TestFlags::ONE | TestFlags::TWO;
    ASSERT_TRUE(flags.any());
    ASSERT_TRUE(flags.any(TestFlags::ONE));
    ASSERT_TRUE(flags.any(TestFlags::ONE));
    ASSERT_TRUE(flags.any(TestFlags::TWO));
    ASSERT_TRUE(flags.any(TestFlags::TWO));
    ASSERT_FALSE(flags.any(TestFlags::THREE));
    ASSERT_FALSE(flags.any(TestFlags::THREE));
@@ -42,6 +43,9 @@ TEST(Flags, Any) {
    ASSERT_TRUE(flags.any(TestFlags::TWO | TestFlags::THREE));
    ASSERT_TRUE(flags.any(TestFlags::TWO | TestFlags::THREE));
    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::THREE));
    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::THREE));
    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));
    ASSERT_TRUE(flags.any(TestFlags::ONE | TestFlags::TWO | TestFlags::THREE));

    Flags<TestFlags> emptyFlags;
    ASSERT_FALSE(emptyFlags.any());
}
}


TEST(Flags, All) {
TEST(Flags, All) {
+0 −44
Original line number Original line Diff line number Diff line
@@ -38,50 +38,6 @@ namespace android {


// --- InputReaderConfiguration ---
// --- InputReaderConfiguration ---


std::string InputReaderConfiguration::changesToString(uint32_t changes) {
    if (changes == 0) {
        return "<none>";
    }
    std::string result;
    if (changes & CHANGE_POINTER_SPEED) {
        result += "POINTER_SPEED | ";
    }
    if (changes & CHANGE_POINTER_GESTURE_ENABLEMENT) {
        result += "POINTER_GESTURE_ENABLEMENT | ";
    }
    if (changes & CHANGE_DISPLAY_INFO) {
        result += "DISPLAY_INFO | ";
    }
    if (changes & CHANGE_SHOW_TOUCHES) {
        result += "SHOW_TOUCHES | ";
    }
    if (changes & CHANGE_KEYBOARD_LAYOUTS) {
        result += "KEYBOARD_LAYOUTS | ";
    }
    if (changes & CHANGE_DEVICE_ALIAS) {
        result += "DEVICE_ALIAS | ";
    }
    if (changes & CHANGE_TOUCH_AFFINE_TRANSFORMATION) {
        result += "TOUCH_AFFINE_TRANSFORMATION | ";
    }
    if (changes & CHANGE_EXTERNAL_STYLUS_PRESENCE) {
        result += "EXTERNAL_STYLUS_PRESENCE | ";
    }
    if (changes & CHANGE_POINTER_CAPTURE) {
        result += "POINTER_CAPTURE | ";
    }
    if (changes & CHANGE_ENABLED_STATE) {
        result += "ENABLED_STATE | ";
    }
    if (changes & CHANGE_TOUCHPAD_SETTINGS) {
        result += "TOUCHPAD_SETTINGS | ";
    }
    if (changes & CHANGE_MUST_REOPEN) {
        result += "MUST_REOPEN | ";
    }
    return result;
}

std::optional<DisplayViewport> InputReaderConfiguration::getDisplayViewportByUniqueId(
std::optional<DisplayViewport> InputReaderConfiguration::getDisplayViewportByUniqueId(
        const std::string& uniqueDisplayId) const {
        const std::string& uniqueDisplayId) const {
    if (uniqueDisplayId.empty()) {
    if (uniqueDisplayId.empty()) {
+126 −130
Original line number Original line Diff line number Diff line
@@ -42,118 +42,6 @@


namespace android {
namespace android {


// --- InputReaderInterface ---

/* The interface for the InputReader shared library.
 *
 * Manages one or more threads that process raw input events and sends cooked event data to an
 * input listener.
 *
 * The implementation must guarantee thread safety for this interface. However, since the input
 * listener is NOT thread safe, all calls to the listener must happen from the same thread.
 */
class InputReaderInterface {
public:
    InputReaderInterface() { }
    virtual ~InputReaderInterface() { }

    /* Dumps the state of the input reader.
     *
     * This method may be called on any thread (usually by the input manager). */
    virtual void dump(std::string& dump) = 0;

    /* Called by the heartbeat to ensures that the reader has not deadlocked. */
    virtual void monitor() = 0;

    /* Returns true if the input device is enabled. */
    virtual bool isInputDeviceEnabled(int32_t deviceId) = 0;

    /* Makes the reader start processing events from the kernel. */
    virtual status_t start() = 0;

    /* Makes the reader stop processing any more events. */
    virtual status_t stop() = 0;

    /* Gets information about all input devices.
     *
     * This method may be called on any thread (usually by the input manager).
     */
    virtual std::vector<InputDeviceInfo> getInputDevices() const = 0;

    /* Query current input state. */
    virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask,
            int32_t scanCode) = 0;
    virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask,
            int32_t keyCode) = 0;
    virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask,
            int32_t sw) = 0;

    virtual void addKeyRemapping(int32_t deviceId, int32_t fromKeyCode,
                                 int32_t toKeyCode) const = 0;

    virtual int32_t getKeyCodeForKeyLocation(int32_t deviceId, int32_t locationKeyCode) const = 0;

    /* Toggle Caps Lock */
    virtual void toggleCapsLockState(int32_t deviceId) = 0;

    /* Determine whether physical keys exist for the given framework-domain key codes. */
    virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask,
                         const std::vector<int32_t>& keyCodes, uint8_t* outFlags) = 0;

    /* Requests that a reconfiguration of all input devices.
     * The changes flag is a bitfield that indicates what has changed and whether
     * the input devices must all be reopened. */
    virtual void requestRefreshConfiguration(uint32_t changes) = 0;

    /* Controls the vibrator of a particular input device. */
    virtual void vibrate(int32_t deviceId, const VibrationSequence& sequence, ssize_t repeat,
                         int32_t token) = 0;
    virtual void cancelVibrate(int32_t deviceId, int32_t token) = 0;

    virtual bool isVibrating(int32_t deviceId) = 0;

    virtual std::vector<int32_t> getVibratorIds(int32_t deviceId) = 0;
    /* Get battery level of a particular input device. */
    virtual std::optional<int32_t> getBatteryCapacity(int32_t deviceId) = 0;
    /* Get battery status of a particular input device. */
    virtual std::optional<int32_t> getBatteryStatus(int32_t deviceId) = 0;
    /* Get the device path for the battery of an input device. */
    virtual std::optional<std::string> getBatteryDevicePath(int32_t deviceId) = 0;

    virtual std::vector<InputDeviceLightInfo> getLights(int32_t deviceId) = 0;

    virtual std::vector<InputDeviceSensorInfo> getSensors(int32_t deviceId) = 0;

    /* Return true if the device can send input events to the specified display. */
    virtual bool canDispatchToDisplay(int32_t deviceId, int32_t displayId) = 0;

    /* Enable sensor in input reader mapper. */
    virtual bool enableSensor(int32_t deviceId, InputDeviceSensorType sensorType,
                              std::chrono::microseconds samplingPeriod,
                              std::chrono::microseconds maxBatchReportLatency) = 0;

    /* Disable sensor in input reader mapper. */
    virtual void disableSensor(int32_t deviceId, InputDeviceSensorType sensorType) = 0;

    /* Flush sensor data in input reader mapper. */
    virtual void flushSensor(int32_t deviceId, InputDeviceSensorType sensorType) = 0;

    /* Set color for the light */
    virtual bool setLightColor(int32_t deviceId, int32_t lightId, int32_t color) = 0;
    /* Set player ID for the light */
    virtual bool setLightPlayerId(int32_t deviceId, int32_t lightId, int32_t playerId) = 0;
    /* Get light color */
    virtual std::optional<int32_t> getLightColor(int32_t deviceId, int32_t lightId) = 0;
    /* Get light player ID */
    virtual std::optional<int32_t> getLightPlayerId(int32_t deviceId, int32_t lightId) = 0;

    /* Get the Bluetooth address of an input device, if known. */
    virtual std::optional<std::string> getBluetoothAddress(int32_t deviceId) const = 0;

    /* Sysfs node change reported. Recreate device if required to incorporate the new sysfs nodes */
    virtual void sysfsNodeChanged(const std::string& sysfsNodePath) = 0;
};

// --- InputReaderConfiguration ---
// --- InputReaderConfiguration ---


/*
/*
@@ -163,51 +51,51 @@ public:
 */
 */
struct InputReaderConfiguration {
struct InputReaderConfiguration {
    // Describes changes that have occurred.
    // Describes changes that have occurred.
    enum {
    enum class Change : uint32_t {
        // The mouse pointer speed changed.
        // The mouse pointer speed changed.
        CHANGE_POINTER_SPEED = 1 << 0,
        POINTER_SPEED = 1u << 0,


        // The pointer gesture control changed.
        // The pointer gesture control changed.
        CHANGE_POINTER_GESTURE_ENABLEMENT = 1 << 1,
        POINTER_GESTURE_ENABLEMENT = 1u << 1,


        // The display size or orientation changed.
        // The display size or orientation changed.
        CHANGE_DISPLAY_INFO = 1 << 2,
        DISPLAY_INFO = 1u << 2,


        // The visible touches option changed.
        // The visible touches option changed.
        CHANGE_SHOW_TOUCHES = 1 << 3,
        SHOW_TOUCHES = 1u << 3,


        // The keyboard layouts must be reloaded.
        // The keyboard layouts must be reloaded.
        CHANGE_KEYBOARD_LAYOUTS = 1 << 4,
        KEYBOARD_LAYOUTS = 1u << 4,


        // The device name alias supplied by the may have changed for some devices.
        // The device name alias supplied by the may have changed for some devices.
        CHANGE_DEVICE_ALIAS = 1 << 5,
        DEVICE_ALIAS = 1u << 5,


        // The location calibration matrix changed.
        // The location calibration matrix changed.
        CHANGE_TOUCH_AFFINE_TRANSFORMATION = 1 << 6,
        TOUCH_AFFINE_TRANSFORMATION = 1u << 6,


        // The presence of an external stylus has changed.
        // The presence of an external stylus has changed.
        CHANGE_EXTERNAL_STYLUS_PRESENCE = 1 << 7,
        EXTERNAL_STYLUS_PRESENCE = 1u << 7,


        // The pointer capture mode has changed.
        // The pointer capture mode has changed.
        CHANGE_POINTER_CAPTURE = 1 << 8,
        POINTER_CAPTURE = 1u << 8,


        // The set of disabled input devices (disabledDevices) has changed.
        // The set of disabled input devices (disabledDevices) has changed.
        CHANGE_ENABLED_STATE = 1 << 9,
        ENABLED_STATE = 1u << 9,


        // The device type has been updated.
        // The device type has been updated.
        CHANGE_DEVICE_TYPE = 1 << 10,
        DEVICE_TYPE = 1u << 10,


        // The keyboard layout association has changed.
        // The keyboard layout association has changed.
        CHANGE_KEYBOARD_LAYOUT_ASSOCIATION = 1 << 11,
        KEYBOARD_LAYOUT_ASSOCIATION = 1u << 11,


        // The stylus button reporting configurations has changed.
        // The stylus button reporting configurations has changed.
        CHANGE_STYLUS_BUTTON_REPORTING = 1 << 12,
        STYLUS_BUTTON_REPORTING = 1u << 12,


        // The touchpad settings changed.
        // The touchpad settings changed.
        CHANGE_TOUCHPAD_SETTINGS = 1 << 13,
        TOUCHPAD_SETTINGS = 1u << 13,


        // All devices must be reopened.
        // All devices must be reopened.
        CHANGE_MUST_REOPEN = 1 << 31,
        MUST_REOPEN = 1u << 31,
    };
    };


    // Gets the amount of time to disable virtual keys after the screen is touched
    // Gets the amount of time to disable virtual keys after the screen is touched
@@ -367,8 +255,6 @@ struct InputReaderConfiguration {
            stylusButtonMotionEventsEnabled(true),
            stylusButtonMotionEventsEnabled(true),
            stylusPointerIconEnabled(false) {}
            stylusPointerIconEnabled(false) {}


    static std::string changesToString(uint32_t changes);

    std::optional<DisplayViewport> getDisplayViewportByType(ViewportType type) const;
    std::optional<DisplayViewport> getDisplayViewportByType(ViewportType type) const;
    std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueDisplayId)
    std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueDisplayId)
            const;
            const;
@@ -383,6 +269,116 @@ private:
    std::vector<DisplayViewport> mDisplays;
    std::vector<DisplayViewport> mDisplays;
};
};


using ConfigurationChanges = ftl::Flags<InputReaderConfiguration::Change>;

// --- InputReaderInterface ---

/* The interface for the InputReader shared library.
 *
 * Manages one or more threads that process raw input events and sends cooked event data to an
 * input listener.
 *
 * The implementation must guarantee thread safety for this interface. However, since the input
 * listener is NOT thread safe, all calls to the listener must happen from the same thread.
 */
class InputReaderInterface {
public:
    InputReaderInterface() {}
    virtual ~InputReaderInterface() {}
    /* Dumps the state of the input reader.
     *
     * This method may be called on any thread (usually by the input manager). */
    virtual void dump(std::string& dump) = 0;

    /* Called by the heartbeat to ensures that the reader has not deadlocked. */
    virtual void monitor() = 0;

    /* Returns true if the input device is enabled. */
    virtual bool isInputDeviceEnabled(int32_t deviceId) = 0;

    /* Makes the reader start processing events from the kernel. */
    virtual status_t start() = 0;

    /* Makes the reader stop processing any more events. */
    virtual status_t stop() = 0;

    /* Gets information about all input devices.
     *
     * This method may be called on any thread (usually by the input manager).
     */
    virtual std::vector<InputDeviceInfo> getInputDevices() const = 0;

    /* Query current input state. */
    virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask, int32_t scanCode) = 0;
    virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask, int32_t keyCode) = 0;
    virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask, int32_t sw) = 0;

    virtual void addKeyRemapping(int32_t deviceId, int32_t fromKeyCode,
                                 int32_t toKeyCode) const = 0;

    virtual int32_t getKeyCodeForKeyLocation(int32_t deviceId, int32_t locationKeyCode) const = 0;

    /* Toggle Caps Lock */
    virtual void toggleCapsLockState(int32_t deviceId) = 0;

    /* Determine whether physical keys exist for the given framework-domain key codes. */
    virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask,
                         const std::vector<int32_t>& keyCodes, uint8_t* outFlags) = 0;

    /* Requests that a reconfiguration of all input devices.
     * The changes flag is a bitfield that indicates what has changed and whether
     * the input devices must all be reopened. */
    virtual void requestRefreshConfiguration(ConfigurationChanges changes) = 0;

    /* Controls the vibrator of a particular input device. */
    virtual void vibrate(int32_t deviceId, const VibrationSequence& sequence, ssize_t repeat,
                         int32_t token) = 0;
    virtual void cancelVibrate(int32_t deviceId, int32_t token) = 0;

    virtual bool isVibrating(int32_t deviceId) = 0;

    virtual std::vector<int32_t> getVibratorIds(int32_t deviceId) = 0;
    /* Get battery level of a particular input device. */
    virtual std::optional<int32_t> getBatteryCapacity(int32_t deviceId) = 0;
    /* Get battery status of a particular input device. */
    virtual std::optional<int32_t> getBatteryStatus(int32_t deviceId) = 0;
    /* Get the device path for the battery of an input device. */
    virtual std::optional<std::string> getBatteryDevicePath(int32_t deviceId) = 0;

    virtual std::vector<InputDeviceLightInfo> getLights(int32_t deviceId) = 0;

    virtual std::vector<InputDeviceSensorInfo> getSensors(int32_t deviceId) = 0;

    /* Return true if the device can send input events to the specified display. */
    virtual bool canDispatchToDisplay(int32_t deviceId, int32_t displayId) = 0;

    /* Enable sensor in input reader mapper. */
    virtual bool enableSensor(int32_t deviceId, InputDeviceSensorType sensorType,
                              std::chrono::microseconds samplingPeriod,
                              std::chrono::microseconds maxBatchReportLatency) = 0;

    /* Disable sensor in input reader mapper. */
    virtual void disableSensor(int32_t deviceId, InputDeviceSensorType sensorType) = 0;

    /* Flush sensor data in input reader mapper. */
    virtual void flushSensor(int32_t deviceId, InputDeviceSensorType sensorType) = 0;

    /* Set color for the light */
    virtual bool setLightColor(int32_t deviceId, int32_t lightId, int32_t color) = 0;
    /* Set player ID for the light */
    virtual bool setLightPlayerId(int32_t deviceId, int32_t lightId, int32_t playerId) = 0;
    /* Get light color */
    virtual std::optional<int32_t> getLightColor(int32_t deviceId, int32_t lightId) = 0;
    /* Get light player ID */
    virtual std::optional<int32_t> getLightPlayerId(int32_t deviceId, int32_t lightId) = 0;

    /* Get the Bluetooth address of an input device, if known. */
    virtual std::optional<std::string> getBluetoothAddress(int32_t deviceId) const = 0;

    /* Sysfs node change reported. Recreate device if required to incorporate the new sysfs nodes */
    virtual void sysfsNodeChanged(const std::string& sysfsNodePath) = 0;
};

// --- TouchAffineTransformation ---
// --- TouchAffineTransformation ---


struct TouchAffineTransformation {
struct TouchAffineTransformation {
+10 −8
Original line number Original line Diff line number Diff line
@@ -180,7 +180,7 @@ void InputDevice::removeEventHubDevice(int32_t eventHubId) {


std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
                                             const InputReaderConfiguration& readerConfig,
                                             const InputReaderConfiguration& readerConfig,
                                             uint32_t changes) {
                                             ConfigurationChanges changes) {
    std::list<NotifyArgs> out;
    std::list<NotifyArgs> out;
    mSources = 0;
    mSources = 0;
    mClasses = ftl::Flags<InputDeviceClass>(0);
    mClasses = ftl::Flags<InputDeviceClass>(0);
@@ -201,12 +201,14 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
    mIsExternal = mClasses.test(InputDeviceClass::EXTERNAL);
    mIsExternal = mClasses.test(InputDeviceClass::EXTERNAL);
    mHasMic = mClasses.test(InputDeviceClass::MIC);
    mHasMic = mClasses.test(InputDeviceClass::MIC);


    using Change = InputReaderConfiguration::Change;

    if (!isIgnored()) {
    if (!isIgnored()) {
        // Full configuration should happen the first time configure is called
        // Full configuration should happen the first time configure is called
        // and when the device type is changed. Changing a device type can
        // and when the device type is changed. Changing a device type can
        // affect various other parameters so should result in a
        // affect various other parameters so should result in a
        // reconfiguration.
        // reconfiguration.
        if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_TYPE)) {
        if (!changes.any() || changes.test(Change::DEVICE_TYPE)) {
            mConfiguration.clear();
            mConfiguration.clear();
            for_each_subdevice([this](InputDeviceContext& context) {
            for_each_subdevice([this](InputDeviceContext& context) {
                std::optional<PropertyMap> configuration =
                std::optional<PropertyMap> configuration =
@@ -220,7 +222,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
                    getValueByKey(readerConfig.deviceTypeAssociations, mIdentifier.location);
                    getValueByKey(readerConfig.deviceTypeAssociations, mIdentifier.location);
        }
        }


        if (!changes || (changes & InputReaderConfiguration::CHANGE_KEYBOARD_LAYOUTS)) {
        if (!changes.any() || changes.test(Change::KEYBOARD_LAYOUTS)) {
            if (!mClasses.test(InputDeviceClass::VIRTUAL)) {
            if (!mClasses.test(InputDeviceClass::VIRTUAL)) {
                std::shared_ptr<KeyCharacterMap> keyboardLayout =
                std::shared_ptr<KeyCharacterMap> keyboardLayout =
                        mContext->getPolicy()->getKeyboardLayoutOverlay(mIdentifier);
                        mContext->getPolicy()->getKeyboardLayoutOverlay(mIdentifier);
@@ -237,7 +239,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
            }
            }
        }
        }


        if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_ALIAS)) {
        if (!changes.any() || changes.test(Change::DEVICE_ALIAS)) {
            if (!(mClasses.test(InputDeviceClass::VIRTUAL))) {
            if (!(mClasses.test(InputDeviceClass::VIRTUAL))) {
                std::string alias = mContext->getPolicy()->getDeviceAlias(mIdentifier);
                std::string alias = mContext->getPolicy()->getDeviceAlias(mIdentifier);
                if (mAlias != alias) {
                if (mAlias != alias) {
@@ -247,7 +249,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
            }
            }
        }
        }


        if (changes & InputReaderConfiguration::CHANGE_ENABLED_STATE) {
        if (changes.test(Change::ENABLED_STATE)) {
            // Do not execute this code on the first configure, because 'setEnabled' would call
            // Do not execute this code on the first configure, because 'setEnabled' would call
            // InputMapper::reset, and you can't reset a mapper before it has been configured.
            // InputMapper::reset, and you can't reset a mapper before it has been configured.
            // The mappers are configured for the first time at the bottom of this function.
            // The mappers are configured for the first time at the bottom of this function.
@@ -256,7 +258,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
            out += setEnabled(enabled, when);
            out += setEnabled(enabled, when);
        }
        }


        if (!changes || (changes & InputReaderConfiguration::CHANGE_DISPLAY_INFO)) {
        if (!changes.any() || changes.test(Change::DISPLAY_INFO)) {
            // In most situations, no port or name will be specified.
            // In most situations, no port or name will be specified.
            mAssociatedDisplayPort = std::nullopt;
            mAssociatedDisplayPort = std::nullopt;
            mAssociatedDisplayUniqueId = std::nullopt;
            mAssociatedDisplayUniqueId = std::nullopt;
@@ -305,7 +307,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,
                }
                }
            }
            }


            if (changes) {
            if (changes.any()) {
                // For first-time configuration, only allow device to be disabled after mappers have
                // For first-time configuration, only allow device to be disabled after mappers have
                // finished configuring. This is because we need to read some of the properties from
                // finished configuring. This is because we need to read some of the properties from
                // the device's open fd.
                // the device's open fd.
@@ -320,7 +322,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when,


        // If a device is just plugged but it might be disabled, we need to update some info like
        // If a device is just plugged but it might be disabled, we need to update some info like
        // axis range of touch from each InputMapper first, then disable it.
        // axis range of touch from each InputMapper first, then disable it.
        if (!changes) {
        if (!changes.any()) {
            out += setEnabled(readerConfig.disabledDevices.find(mId) ==
            out += setEnabled(readerConfig.disabledDevices.find(mId) ==
                                      readerConfig.disabledDevices.end(),
                                      readerConfig.disabledDevices.end(),
                              when);
                              when);
Loading