summaryrefslogtreecommitdiff
path: root/libs/input/PointerController.h
diff options
context:
space:
mode:
authorVladislav Kaznacheev <kaznacheev@google.com>2016-09-09 10:03:31 -0700
committerVladislav Kaznacheev <kaznacheev@google.com>2016-09-09 10:03:31 -0700
commit33c5903e7759b0594b1e0a062b066945a2c86989 (patch)
treefb992fafc36f0e3d4c3baeb79e68594ae0b4d9e7 /libs/input/PointerController.h
parentfd97e7bc8cac91d849bf40202870c2220fc04f7a (diff)
Hold a weak reference to PointerController when handling vsync
Currently PointerController starts listening to display events immediately (in its constructor) and never explicitly removes the callback. The reference dangling from the looper prevents the PointerController instance from being deleted when all the clients have released their references. As a result, when USB or BT mouse is disconnected, the mouse stays frozen on screen and only goes away after a 15 sec inactivity timeout. This change introduces an intermediary LooperCallback which holds only a weak reference to PointerController. The pointer now disappears immediately upon mouse disconnect. Bug: 30824220 Change-Id: I5f7208dbfa381b3e21f248cc0da402f307faa184
Diffstat (limited to 'libs/input/PointerController.h')
-rw-r--r--libs/input/PointerController.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/input/PointerController.h b/libs/input/PointerController.h
index 99292d7ca8a6..4794f3da824c 100644
--- a/libs/input/PointerController.h
+++ b/libs/input/PointerController.h
@@ -144,6 +144,7 @@ private:
sp<Looper> mLooper;
sp<SpriteController> mSpriteController;
sp<WeakMessageHandler> mHandler;
+ sp<LooperCallback> mCallback;
DisplayEventReceiver mDisplayEventReceiver;