Bootstrap IInputFlingerRust - the Rust component of inputflinger
When inputflinger boots, we create the Rust component of inputflinger,
which we interact with from C++ through the local AIDL interface
IInputFlingerRust.
After we have access to the IInputFlingerRust binder object in C++, all
communication between C++ and Rust can take place purely through AIDL
interfaces.
To initialize the interface, we must first pass a raw pointer to an AIDL
implementation across the language barrier through some other means. In
this CL, we use cxxbridge to bootstrap the local AIDL interface for
IInputFlingerRust.
Bug: 278783893
Test: manual, boot
Change-Id: Ifbd0168ae4fadaa5b357f6064113f1691e6cf5a7
diff --git a/services/inputflinger/InputManager.h b/services/inputflinger/InputManager.h
index 9dc285f..528d2aa 100644
--- a/services/inputflinger/InputManager.h
+++ b/services/inputflinger/InputManager.h
@@ -30,6 +30,7 @@
#include <input/Input.h>
#include <input/InputTransport.h>
+#include <aidl/com/android/server/inputflinger/IInputFlingerRust.h>
#include <android/os/BnInputFlinger.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
@@ -37,6 +38,8 @@
using android::os::BnInputFlinger;
+using aidl::com::android::server::inputflinger::IInputFlingerRust;
+
namespace android {
class InputChannel;
class InputDispatcherThread;
@@ -132,6 +135,8 @@
std::unique_ptr<InputDeviceMetricsCollectorInterface> mCollector;
std::unique_ptr<InputDispatcherInterface> mDispatcher;
+
+ std::shared_ptr<IInputFlingerRust> mInputFlingerRust;
};
} // namespace android