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

Commit 1c0f5e6d authored by Michael Wright's avatar Michael Wright Committed by Android (Google) Code Review
Browse files

Merge "Force InputManagerService to communicate via InputManagerInterface"

parents 2ffcba95 63534161
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -134,8 +134,4 @@ void InputManager::unregisterInputChannel(const sp<InputChannel>& channel) {
    mDispatcher->unregisterInputChannel(channel);
    mDispatcher->unregisterInputChannel(channel);
}
}


void InputManager::setMotionClassifierEnabled(bool enabled) {
    mClassifier->setMotionClassifierEnabled(enabled);
}

} // namespace android
} // namespace android
+23 −21
Original line number Original line Diff line number Diff line
@@ -38,22 +38,23 @@


namespace android {
namespace android {
class InputChannel;
class InputChannel;
class InputDispatcherThread;


/*
/*
 * The input manager is the core of the system event processing.
 * The input manager is the core of the system event processing.
 *
 *
 * The input manager has two components.
 * The input manager has three components.
 *
 *
 * 1. The InputReader class starts a thread that reads and preprocesses raw input events, applies
 * 1. The InputReader class starts a thread that reads and preprocesses raw input events, applies
 *    policy, and posts messages to a queue managed by the InputDispatcherThread.
 *    policy, and posts messages to a queue managed by the InputClassifier.
 * 2. The InputDispatcher class starts a thread that waits for new events on the
 * 2. The InputClassifier class starts a thread to communicate with the device-specific
 *    queue and asynchronously dispatches them to applications.
 *    classifiers. It then waits on the queue of events from InputReader, applies a classification
 *    to them, and queues them for the InputDispatcher.
 * 3. The InputDispatcher class starts a thread that waits for new events on the
 *    previous queue and asynchronously dispatches them to applications.
 *
 *
 * By design, the InputReader class and InputDispatcher class do not share any
 * By design, none of these classes share any internal state.  Moreover, all communication is
 * internal state.  Moreover, all communication is done one way from the InputReader
 * done one way from the InputReader to the InputDispatcher and never the reverse.  All
 * into the InputDispatcherThread and never the reverse.  Both classes may interact with the
 * classes may interact with the InputDispatchPolicy, however.
 * InputDispatchPolicy, however.
 *
 *
 * The InputManager class never makes any calls into Java itself.  Instead, the
 * The InputManager class never makes any calls into Java itself.  Instead, the
 * InputDispatchPolicy is responsible for performing all external interactions with the
 * InputDispatchPolicy is responsible for performing all external interactions with the
@@ -74,33 +75,34 @@ public:
    /* Gets the input reader. */
    /* Gets the input reader. */
    virtual sp<InputReaderInterface> getReader() = 0;
    virtual sp<InputReaderInterface> getReader() = 0;


    /* Gets the input classifier */
    virtual sp<InputClassifierInterface> getClassifier() = 0;

    /* Gets the input dispatcher. */
    /* Gets the input dispatcher. */
    virtual sp<InputDispatcherInterface> getDispatcher() = 0;
    virtual sp<InputDispatcherInterface> getDispatcher() = 0;
};
};


class InputManager : public InputManagerInterface, public BnInputFlinger {
class InputManager : public InputManagerInterface, public BnInputFlinger {
protected:
protected:
    virtual ~InputManager();
    ~InputManager() override;


public:
public:
    InputManager(
    InputManager(
            const sp<InputReaderPolicyInterface>& readerPolicy,
            const sp<InputReaderPolicyInterface>& readerPolicy,
            const sp<InputDispatcherPolicyInterface>& dispatcherPolicy);
            const sp<InputDispatcherPolicyInterface>& dispatcherPolicy);


    virtual status_t start();
    status_t start() override;
    virtual status_t stop();
    status_t stop() override;

    virtual sp<InputReaderInterface> getReader();
    virtual sp<InputClassifierInterface> getClassifier();
    virtual sp<InputDispatcherInterface> getDispatcher();


    virtual void setInputWindows(const std::vector<InputWindowInfo>& handles,
    sp<InputReaderInterface> getReader() override;
            const sp<ISetInputWindowsListener>& setInputWindowsListener);
    sp<InputClassifierInterface> getClassifier() override;
    sp<InputDispatcherInterface> getDispatcher() override;


    virtual void registerInputChannel(const sp<InputChannel>& channel);
    void setInputWindows(const std::vector<InputWindowInfo>& handles,
    virtual void unregisterInputChannel(const sp<InputChannel>& channel);
                         const sp<ISetInputWindowsListener>& setInputWindowsListener) override;


    void setMotionClassifierEnabled(bool enabled);
    void registerInputChannel(const sp<InputChannel>& channel) override;
    void unregisterInputChannel(const sp<InputChannel>& channel) override;


private:
private:
    sp<InputReaderInterface> mReader;
    sp<InputReaderInterface> mReader;