summaryrefslogtreecommitdiffstats
path: root/minui/events.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-10-12Do not write past end of inotify event structure.Christopher Ferris1-3/+5
Bug: 202159709 Test: None yet. Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242 (cherry picked from commit ce87c786116557e89f9da95f550d6816aeaca67e)
2021-10-12Do not write past end of inotify event structure.Christopher Ferris1-3/+5
Bug: 202159709 Test: None yet. Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242 (cherry picked from commit ce87c786116557e89f9da95f550d6816aeaca67e)
2021-10-12Do not write past end of inotify event structure.Christopher Ferris1-3/+5
Bug: 202159709 Test: None yet. Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242 (cherry picked from commit ce87c786116557e89f9da95f550d6816aeaca67e)
2021-10-11Do not write past end of inotify event structure.Christopher Ferris1-3/+5
Bug: 202159709 Test: None yet. Change-Id: If80ed957aaa93c03a97b57e818e7783fa6e38242 (cherry picked from commit ce87c786116557e89f9da95f550d6816aeaca67e)
2020-01-14Fix ioctl FIONREAD call parameters to use int instead of size_tStephane Lee1-2/+4
Test: Ensure that calls to inotify_cb succeed; Ensure charger does not crash Change-Id: I9a7ca304057313c74ef02fd97223d0ed570c6206
2019-08-14minui: Support input device hotplug in recovery mode.Xihua Chen1-20/+104
In the old code, the recovery only enumerated the input devices at the startup, and read the input events from these devices. So if a USB input device is probed after the recovery startup, then the recovery can't read the events from this device. This patch use inotify to monitor /dev/input for new added input device, then support input device hotplug in recovery mode. Bug: 111847510 Test: can use USB keyboard hotplugged in recovery mode Change-Id: I7e7dcbd619d3c66a2f40a43418f5dac6a50c859e Signed-off-by: Liu Shuo A <shuo.a.liu@intel.com> Signed-off-by: Ming Tan <ming.tan@intel.com>
2019-03-11minui: Managed FDs with smart pointers.Tao Bao1-102/+105
Also clean up a few variable names. Test: Boot into recovery. Check key inputs. Change-Id: I058475ac22f3db8523bd8aa30ccb61be1ef45559
2019-03-11minui: Fix the wrong move of the callback.Tao Bao1-1/+1
The input_cb in ev_init() should be shared among the detected input devices. Test: Boot into recovery. Check key inputs. Change-Id: I0315f6a23625bacedd333fefacbf4ac6797bc1fd
2019-03-01Use O_CLOEXEC at a few places.Tao Bao1-1/+1
Found these FDs unintentionally propagated into forked processes (e.g. updater) during my local debugging. Use O_CLOEXEC to avoid that. Test: Dump open FDs in updater process. Test: Sideload a package on taimen (which uses framebuffer). Test: Run graphics test on taimen. Change-Id: I1fb65dd4a103c47d28b15973def9e9359c251ca3
2018-12-17use epoll_create1Nick Kralevich1-1/+1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC) instead. Bug: 120983106 Test: compiles and boots Change-Id: I91f213ebb2dd05330dd25ec1ca1fec59b611e7f2
2017-10-11Add missing includes.Dan Albert1-0/+1
Test: mma Bug: None Change-Id: I8b588dfbc00ef67557622d44700b331c7a31bde3
2017-08-03ui: Move the support for touch inputs into RecoveryUI.Tao Bao1-11/+36
- Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with <power> + <swipe-up>. The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Bug: 64307776 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd (cherry picked from commit 5f8dd9951d986b65d98d6a9ea38003427e9e46df)
2017-08-02ui: Move the support for touch inputs into RecoveryUI.Tao Bao1-11/+36
- Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with <power> + <swipe-up>. The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd
2017-03-17Add the missing #include of <functional>.Tao Bao1-0/+2
For the use of std::function and std::bind. They were relying on the transitive inclusion from <minui/minui.h>. Test: mmma bootable/recovery Change-Id: Ia138e1cbdd035b11d6cdca9e16c5591303b6ee13
2017-02-23Add a missing #include for openat(2).Elliott Hughes1-0/+1
Bug: https://code.google.com/p/android/issues/detail?id=64374 Test: builds Change-Id: I7d7650463197710657820a1adce51f71c1b01415
2017-01-23minui: Move callback functions to std::function.Tao Bao1-107/+102
Also make minor clean up to the header includes. Test: mmma bootable/recovery system/core/healthd system/extra/slideshow Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
2017-01-17minui: Export minui/minui.h.Tao Bao1-1/+1
For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
2016-07-27Fix clang-tidy performance warnings.Chih-Hung Hsieh1-1/+1
* Use const reference parameter type to avoid unnecessary copy. * Use more efficient overloaded string methods. Bug: 30407689 Bug: 30411878 Change-Id: Iefab05c077367f272abf545036b853e8a295c8cd Test: build with WITH_TIDY=1
2016-04-18Fix google-runtime-int warnings.Chih-Hung Hsieh1-6/+9
Bug: 28220065 Change-Id: Ida199c66692a1638be6990d583d2ed42583fb592
2015-04-30Check all lseek calls succeed.Elliott Hughes1-1/+2
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek. Bug: http://b/20625546 Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b (cherry picked from commit 7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f)
2015-04-30Check all lseek calls succeed.Elliott Hughes1-1/+2
Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek. Bug: http://b/20625546 Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
2015-04-10Switch minui over to C++.Elliott Hughes1-6/+6
Change-Id: I59e08a304ae514a3fdb6fab58721f11670bc1b01
2015-04-10Fix ScreenRecoveryUI to handle devices without power/up/down.Elliott Hughes1-2/+2
Currently fugu has a custom subclass to handle this. The default code supports devices with trackballs but not all shipping Nexus devices? That's just silly. Change-Id: Id2779c91284899a26b4bb1af41e7033aa889df10
2015-04-10Add ev_iterate_available_keys to minui.Elliott Hughes1-79/+97
This lets us recognize whether we have up/down/power, say, and tailor the UI accordingly. Change-Id: If94e454f14243b59d2f473ac9a436bd60591da01
2015-02-11recovery: Handle EV_SW eventsAjay Dudani1-2/+2
Change-Id: I29c13a941067cd1bbdced3bd67fd93293347d7b6
2015-01-30Add missing includes.Elliott Hughes1-0/+2
Change-Id: I06ea08400efa511e627be37a4fd70fbdfadea2e6
2013-09-17recovery: fix epoll events type to uint32_tTodd Poynor1-1/+1
Change-Id: I5db9987102201c18821acb45d1f824e9865a1451
2013-09-12minui: add ev_get_epollfd() to retrieve epoll file descriptorTodd Poynor1-0/+5
To allow use of ev_* functions with an external main loop. Change-Id: If73717b64d7c455ca726b90a815a31c1edf52544
2013-09-12minui: convert ev_*() event interface to epollTodd Poynor1-25/+56
Help enable external main loop combined with ev_*() key event processing. Specify EPOLLWAKEUP to hold a wakelock on any event, assuming this is needed (may need to make this optional). Convert callback events parameter to unsigned int. Change-Id: Ib5e09abbd7724ffd830e2cf8e25e7eb59d3aa072
2011-10-13minui: add ability to synchronize current key stateDima Zavin1-2/+36
If a key is down prior to the time of initialization, we would not get the down event for the key, and thus think that the key is not pressed. Add an interface that allows one to provide a callback to execute on all keys that are currently down. Change-Id: I2a4096c0cb4c7c7a9a80d207835f168a0b418413 Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02minui: events: only open input devices with EV_KEY and/or EV_RELDima Zavin1-0/+17
Change-Id: I8283d7aaa0f66d488f462cd108350cc49657a745 Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02minui: events: add ability to poll on non-input fdsDima Zavin1-3/+22
Change-Id: Iad52a6f2adcae0068d252d6163586f9d7b93121d Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02minui: events: refactor event acquisitionDima Zavin1-13/+36
Events are now delivered through a callback mechanism during a call to ev_dispatch(). This will allow us to extend the events code to handle other devices/fds, not just input. One such example is the ability to process uevents. During initialization, we provide an input callback to ev_init that gets called when a new event is encountered during dispatch. ev_get has been removed and replaced with ev_get_input() helper function that can be called from inside the callback to attempt to get an input event. The existing client of ev_get in recovery has been split up such that the input thread just calls ev_wait(); ev_dispatch(); and the input_callback handles individual events by using the ev_get_input() helper. Change-Id: I24d8e71bd1533876b4ab1ae751ba200fea43c049 Signed-off-by: Dima Zavin <dima@android.com>
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-0/+82
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-82/+0