Skip to content
Commit 1007158e authored by Zixuan Qu's avatar Zixuan Qu
Browse files

Move device specific logic to VirtualInputDevice and its subclasses.

Only keep virtual input device setup code and move device specific logic
to VirtualInputDevice and its subclasses. The benefits are threefold:

1) Better encapsulation: we used to have all input event injection logic
   in inputController JNI code, it's hard to tell the capability of each
   device type. For example, writeKeyEvent() doesn't have any indication
   of which device it's writing into. If a fd representing a mouse is
   passed in then the key event might be written to a mouse device.

2) No need to manually close the file descripters. We can now depend on
   the destructor of unique_fd.

3) We can get rid of the errorprone static map introduced in ag/21078609
   which keeps record of active pointers on touchscreen.

Test: atest VirtualInputTest VirtualMouseTest VirtualKeyboardTest
VirtualTouchscreenTest VirtualDpadTest InputControllerTest

Bug: 267515782

Change-Id: Ic5f246544172a431090f427457265bbf8d63bd70
Merged-In: Ic5f246544172a431090f427457265bbf8d63bd70
parent 79d1135c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment