summaryrefslogtreecommitdiff
path: root/libs/input/PointerController.h
diff options
context:
space:
mode:
author Prabir Pradhan <prabirmsp@google.com> 2021-11-18 16:40:34 +0000
committer Prabir Pradhan <prabirmsp@google.com> 2021-11-22 18:16:16 +0000
commitf97fac36a498f42eb05472869142a2d3200c8aeb (patch)
tree3b2c605e42c9d6059569ab950e737ac9dd02acd2 /libs/input/PointerController.h
parent9dd56cd27cafbbc4f2ba1a5839e298bef7a7fe85 (diff)
Reland "Change PointerController to display space"
02b0545d02001ad152eeaf1ff35465345cbd5d4d Changes since the first time it landed: - Unregister the WindowInfosLisntener in PointerController's destructor. Bug: 188939842 Bug: 144544464 Bug: 206817973 Test: forrest run - CtsHardwareTestsCases Change-Id: I92a3f128545e73c85d2a5079ee914e2f890c4308
Diffstat (limited to 'libs/input/PointerController.h')
-rw-r--r--libs/input/PointerController.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index 97567bab202b..796077f6c38c 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -47,7 +47,7 @@ public:
const sp<PointerControllerPolicyInterface>& policy, const sp<Looper>& looper,
const sp<SpriteController>& spriteController);
- virtual ~PointerController() = default;
+ ~PointerController() override;
virtual bool getBounds(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const;
virtual void move(float deltaX, float deltaY);
@@ -72,6 +72,8 @@ public:
void reloadPointerResources();
void onDisplayViewportsUpdated(std::vector<DisplayViewport>& viewports);
+ void onDisplayInfosChanged(const std::vector<gui::DisplayInfo>& displayInfos);
+
private:
friend PointerControllerContext::LooperCallback;
friend PointerControllerContext::MessageHandler;
@@ -85,9 +87,23 @@ private:
struct Locked {
Presentation presentation;
+ std::vector<gui::DisplayInfo> mDisplayInfos;
std::unordered_map<int32_t /* displayId */, TouchSpotController> spotControllers;
} mLocked GUARDED_BY(mLock);
+ class DisplayInfoListener : public gui::WindowInfosListener {
+ public:
+ explicit DisplayInfoListener(PointerController& pc) : mPointerController(pc){};
+ void onWindowInfosChanged(const std::vector<android::gui::WindowInfo>&,
+ const std::vector<android::gui::DisplayInfo>&) override;
+
+ private:
+ PointerController& mPointerController;
+ };
+ sp<DisplayInfoListener> mDisplayInfoListener;
+
+ const ui::Transform& getTransformForDisplayLocked(int displayId) const REQUIRES(mLock);
+
PointerController(const sp<PointerControllerPolicyInterface>& policy, const sp<Looper>& looper,
const sp<SpriteController>& spriteController);
void clearSpotsLocked();