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

Commit 37751084 authored by Linnan Li's avatar Linnan Li Committed by Prabir Pradhan
Browse files

Add enabled state to InputDevice and remove isInputDeviceEnabled(2/n)



Since we have added a field for the enabled state to InputDeviceInfo, we
have also added the same status field to InputDevice.java. This way, we
won't need to call the isInputDeviceEnabled method in InputManager again
to send a request to InputManagerService to check if the device is
enabled. At this point, we can directly remove the isInputDeviceEnabled
method in InputManager, which is used as a hidden API, since it is no
longer in use.

Bug: 336420877
Test: build & atest InputTests

Change-Id: I7c2a600a55941dcb55c189c1e1f24e6787173d64
Signed-off-by: default avatarLinnan Li <lilinnan@xiaomi.corp-partner.google.com>
parent c1698103
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -310,9 +310,6 @@ public:
    /* 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;

+0 −11
Original line number Diff line number Diff line
@@ -874,17 +874,6 @@ std::optional<std::string> InputReader::getBluetoothAddress(int32_t deviceId) co
    return std::nullopt;
}

bool InputReader::isInputDeviceEnabled(int32_t deviceId) {
    std::scoped_lock _l(mLock);

    InputDevice* device = findInputDeviceLocked(deviceId);
    if (device) {
        return device->isEnabled();
    }
    ALOGW("Ignoring invalid device id %" PRId32 ".", deviceId);
    return false;
}

bool InputReader::canDispatchToDisplay(int32_t deviceId, ui::LogicalDisplayId displayId) {
    std::scoped_lock _l(mLock);

+0 −2
Original line number Diff line number Diff line
@@ -61,8 +61,6 @@ public:

    std::vector<InputDeviceInfo> getInputDevices() const override;

    bool isInputDeviceEnabled(int32_t deviceId) override;

    int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask, int32_t scanCode) override;
    int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask, int32_t keyCode) override;
    int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask, int32_t sw) override;
+0 −3
Original line number Diff line number Diff line
@@ -55,8 +55,6 @@ public:

    void monitor() { reader->monitor(); }

    bool isInputDeviceEnabled(int32_t deviceId) { return reader->isInputDeviceEnabled(deviceId); }

    status_t start() { return reader->start(); }

    status_t stop() { return reader->stop(); }
@@ -206,7 +204,6 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t* data, size_t size) {
                },
                [&]() -> void { reader->monitor(); },
                [&]() -> void { reader->getInputDevices(); },
                [&]() -> void { reader->isInputDeviceEnabled(fdp->ConsumeIntegral<int32_t>()); },
                [&]() -> void {
                    reader->getScanCodeState(fdp->ConsumeIntegral<int32_t>(),
                                             fdp->ConsumeIntegral<uint32_t>(),