Implement KeyboardClassifier interface in rust
DD: go/project-imposter-android
This CL includes:
- Rust interface setup
Next CL to include:
- Basic categorization into alphabetic and non-alphabetic
- Updating categorization based on key presses
Test: atest --host libinput_rust_test
Test: atest inputflinger_tests
Bug: 263559234
Flag: com.android.input.flags.enable_keyboard_classifier_rust_impl
Change-Id: I52773be992ddd8efaa9546e0af8b0a78515d931c
diff --git a/services/inputflinger/reader/include/InputReader.h b/services/inputflinger/reader/include/InputReader.h
index 7e701c5..6f8c289 100644
--- a/services/inputflinger/reader/include/InputReader.h
+++ b/services/inputflinger/reader/include/InputReader.h
@@ -157,6 +157,7 @@
void setLastKeyDownTimestamp(nsecs_t when) REQUIRES(mReader->mLock)
REQUIRES(mLock) override;
nsecs_t getLastKeyDownTimestamp() REQUIRES(mReader->mLock) REQUIRES(mLock) override;
+ KeyboardClassifier& getKeyboardClassifier() override;
} mContext;
friend class ContextImpl;
@@ -176,6 +177,10 @@
// The next stage that should receive the events generated inside InputReader.
InputListenerInterface& mNextListener;
+
+ // Classifier for keyboard/keyboard-like devices
+ std::unique_ptr<KeyboardClassifier> mKeyboardClassifier;
+
// As various events are generated inside InputReader, they are stored inside this list. The
// list can only be accessed with the lock, so the events inside it are well-ordered.
// Once the reader is done working, these events will be swapped into a temporary storage and