summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/input/PointerController.cpp13
-rw-r--r--libs/input/PointerController.h18
-rw-r--r--services/core/jni/com_android_server_input_InputManagerService.cpp5
3 files changed, 36 insertions, 0 deletions
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index 246db6c64c7f..972e16841f49 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -78,6 +78,10 @@ std::shared_ptr<PointerController> PointerController::create(
controller = std::shared_ptr<PointerController>(
new TouchPointerController(policy, looper, spriteController, enabled));
break;
+ case ControllerType::STYLUS:
+ controller = std::shared_ptr<PointerController>(
+ new StylusPointerController(policy, looper, spriteController, enabled));
+ break;
case ControllerType::LEGACY:
default:
controller = std::shared_ptr<PointerController>(
@@ -410,4 +414,13 @@ TouchPointerController::TouchPointerController(const sp<PointerControllerPolicyI
PointerController::setPresentation(Presentation::SPOT);
}
+// --- StylusPointerController ---
+
+StylusPointerController::StylusPointerController(const sp<PointerControllerPolicyInterface>& policy,
+ const sp<Looper>& looper,
+ SpriteController& spriteController, bool enabled)
+ : PointerController(policy, looper, spriteController, enabled) {
+ PointerController::setPresentation(Presentation::STYLUS_HOVER);
+}
+
} // namespace android
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index 1a8e109af328..6461abf754e3 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -198,6 +198,24 @@ public:
void setInactivityTimeout(InactivityTimeout) override {}
};
+class StylusPointerController : public PointerController {
+public:
+ /** A version of PointerController that controls one stylus pointer. */
+ StylusPointerController(const sp<PointerControllerPolicyInterface>& policy,
+ const sp<Looper>& looper, SpriteController& spriteController,
+ bool enabled);
+
+ void setPresentation(Presentation) override {
+ LOG_ALWAYS_FATAL("Should not be called");
+ }
+ void setSpots(const PointerCoords*, const uint32_t*, BitSet32, int32_t) override {
+ LOG_ALWAYS_FATAL("Should not be called");
+ }
+ void clearSpots() override {
+ LOG_ALWAYS_FATAL("Should not be called");
+ }
+};
+
} // namespace android
#endif // _UI_POINTER_CONTROLLER_H
diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp
index c05406a66e57..21820939ba03 100644
--- a/services/core/jni/com_android_server_input_InputManagerService.cpp
+++ b/services/core/jni/com_android_server_input_InputManagerService.cpp
@@ -1749,6 +1749,11 @@ FloatPoint NativeInputManager::getMouseCursorPosition() {
}
void NativeInputManager::setStylusPointerIconEnabled(bool enabled) {
+ if (ENABLE_POINTER_CHOREOGRAPHER) {
+ mInputManager->getChoreographer().setStylusPointerIconEnabled(enabled);
+ return;
+ }
+
{ // acquire lock
std::scoped_lock _l(mLock);