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

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

Merge changes from topics "NotifyInputDevicesChangedArgs", "dump-from-inputmanager" into udc-dev

* changes:
  Dump all native input components from InputManager
  Notify InputListener when there an changes to input devices
parents 94384e02 370dbc94
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@

#include <android-base/stringprintf.h>
#include <android/log.h>
#include <math.h>
#include <utils/Trace.h>

using android::base::StringPrintf;
@@ -47,6 +46,7 @@ Visitor(V...) -> Visitor<V...>;

void InputListenerInterface::notify(const NotifyArgs& generalArgs) {
    Visitor v{
            [&](const NotifyInputDevicesChangedArgs& args) { notifyInputDevicesChanged(args); },
            [&](const NotifyConfigurationChangedArgs& args) { notifyConfigurationChanged(&args); },
            [&](const NotifyKeyArgs& args) { notifyKey(&args); },
            [&](const NotifyMotionArgs& args) { notifyMotion(&args); },
@@ -73,6 +73,11 @@ static inline void traceEvent(const char* functionName, int32_t id) {
QueuedInputListener::QueuedInputListener(InputListenerInterface& innerListener)
      : mInnerListener(innerListener) {}

void QueuedInputListener::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) {
    traceEvent(__func__, args.id);
    mArgsQueue.emplace_back(args);
}

void QueuedInputListener::notifyConfigurationChanged(
        const NotifyConfigurationChangedArgs* args) {
    traceEvent(__func__, args->id);
+11 −4
Original line number Diff line number Diff line
@@ -110,10 +110,6 @@ InputReaderInterface& InputManager::getReader() {
    return *mReader;
}

UnwantedInteractionBlockerInterface& InputManager::getBlocker() {
    return *mBlocker;
}

InputProcessorInterface& InputManager::getProcessor() {
    return *mProcessor;
}
@@ -129,6 +125,17 @@ void InputManager::monitor() {
    mDispatcher->monitor();
}

void InputManager::dump(std::string& dump) {
    mReader->dump(dump);
    dump += '\n';
    mBlocker->dump(dump);
    dump += '\n';
    mProcessor->dump(dump);
    dump += '\n';
    mDispatcher->dump(dump);
    dump += '\n';
}

// Used by tests only.
binder::Status InputManager::createInputChannel(const std::string& name, InputChannel* outChannel) {
    IPCThreadState* ipc = IPCThreadState::self();
+4 −4
Original line number Diff line number Diff line
@@ -82,9 +82,6 @@ public:
    /* Gets the input reader. */
    virtual InputReaderInterface& getReader() = 0;

    /* Gets the unwanted interaction blocker. */
    virtual UnwantedInteractionBlockerInterface& getBlocker() = 0;

    /* Gets the input processor */
    virtual InputProcessorInterface& getProcessor() = 0;

@@ -93,6 +90,9 @@ public:

    /* Check that the input stages have not deadlocked. */
    virtual void monitor() = 0;

    /* Dump the state of the components controlled by the input manager. */
    virtual void dump(std::string& dump) = 0;
};

class InputManager : public InputManagerInterface, public BnInputFlinger {
@@ -108,10 +108,10 @@ public:
    status_t stop() override;

    InputReaderInterface& getReader() override;
    UnwantedInteractionBlockerInterface& getBlocker() override;
    InputProcessorInterface& getProcessor() override;
    InputDispatcherInterface& getDispatcher() override;
    void monitor() override;
    void dump(std::string& dump) override;

    status_t dump(int fd, const Vector<String16>& args) override;
    binder::Status createInputChannel(const std::string& name, InputChannel* outChannel) override;
+6 −0
Original line number Diff line number Diff line
@@ -413,6 +413,12 @@ void InputProcessor::setMotionClassifierEnabled(bool enabled) {
    }
}

void InputProcessor::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) {
    // pass through
    mQueuedListener.notify(args);
    mQueuedListener.flush();
}

void InputProcessor::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) {
    // pass through
    mQueuedListener.notifyConfigurationChanged(args);
+1 −0
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ class InputProcessor : public InputProcessorInterface {
public:
    explicit InputProcessor(InputListenerInterface& listener);

    void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override;
    void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) override;
    void notifyKey(const NotifyKeyArgs* args) override;
    void notifyMotion(const NotifyMotionArgs* args) override;
Loading