summaryrefslogtreecommitdiff
path: root/libs/gui/tests/EndToEndNativeInputTest.cpp
AgeCommit message (Collapse)Author
2022-03-12Merge SP2A.220305.013Haamed Gheibi
Bug: 220074017 Change-Id: Ic33b5a6c518f7aa587e6c7cf0bfd6df4c795782b
2021-11-22Let touch region empty if the input bounds is emptyArthur Hung
If the input bounds is empty, we should let the touch region empty so it could prevent receiving touch without valid bounds. Bug: 204747595 Test: atest InputSurfacesTest Change-Id: Iee59c437a084ca9db6936af7a4852190169518d9
2021-09-22SurfaceFlinger: Implement drop input modesVishnu Nair
ALL: If this mode is set on a layer, set the DROP_INPUT feature flag on the layer and its children if it has a valid input channel. This will ensure these layers will not be able to receive any input. OBSCURED: If this mode is set, set the DROP_INPUT feature flag on the layer and its children if they have a valid input channel and they are considered occluded. This can happen if the layer has a alpha set by it's parent OR if its buffer has been cropped by its parent. Otherwise, the input feature flag DROP_INPUT_IF_OBSCURED flag will be set so inputflinger can decide to drop input based on occlusion. Test: atest libgui_test InputDispatcherDropInputFeatureTest Bug: 197364677 Merged-In: Ibce11ee7df5b5c8c226ebfab29574a99cd656f6d Change-Id: Ibce11ee7df5b5c8c226ebfab29574a99cd656f6d
2021-06-29Renamed and moved InputWindow and related fileschaviw
In preparation for the hierarchy listener interface, moved the InputWindow structs into libgui and have libinput dependant on libgui. Also renamed InputWindow to exclude Input since it will be used for more generic purposes. Test: Builds and flashes Bug: 188792659 Change-Id: I24262cbc14d409c00273de0024a672394a959e5f Merged-In: I24262cbc14d409c00273de0024a672394a959e5f
2021-04-22Merge SP1A.210412.001Scott Lobdell
Change-Id: Ib26d1fa9123d1a0f1c232039dd9e6b96224b87c0
2021-04-08Modify bounds and transform for BSL input.chaviw
We don't want to send the BufferStateLayer's transform to input, but rather the parent's transform. This is because the current layer's transform is information about how the buffer is placed on screen. The parent's transform makes more sense to send since this is information about how the layer is placed on screen. This transform is used by input to determine how to go from screen space back to window space. Also update the bounds for BufferStateLayer that's used for input. We need to include the transform here since input assumes the frame already includes the buffer transform. Test: EndToEndNativeInputTest Test: Rotate and scroll content Fixes: 184807094 Change-Id: I59c1f32a57dff4f007202b5998fff55f4e125438
2021-04-07Merge SP1A.210329.001Scott Lobdell
Change-Id: If454d70c5680b9e6719e1b4e2ecb4000168811e2
2021-03-15Rename crop_legacy to just cropchaviw
crop_legacy and crop should do the same thing so there's no need for two separate requests. Test: go/wm-smoke Test: SurfaceFlinger_test Bug: 170765639 Change-Id: I74a740d06d15f7cde9775557e65ad1e3a508bd61
2021-03-02Merge SP1A.210222.001Scott Lobdell
Change-Id: I95369f1cb734105745aca9d1bf233f9a9433834b
2021-02-05Rename DisplayConfig to DisplayModeMarin Shalamanov
This CL continues the raneming of display "configs" to display "modes". The goal of this is to have the same names as in the java code and the public display APIs. Additionally in this CL we move DisplayConfig (from libui) to the namespace android::ui. This is to prevent conflict with the SurfaceFlinger's internal android::DisplayMode. This is consistent with the neighboring classes which are also in the ui namespace. Also the type of the parameter defaultMode of {s,g}etDesiredDisplayModeSpecs is changed to size_t for consistency with the rest of the code. Appropriate error handling is added for this. Bug: 159590486 Bug: 179158858 Test: presubmit Change-Id: I31e5be1f2223a9ec9340789ce3dc5738eceaf40f
2021-02-03Merge SP1A.210122.003Scott Lobdell
Change-Id: I7e92467ad55f47762af8d420cfb509454a9ffd1d
2021-01-15Pass in window name along with focus requestVishnu Nair
Used for generating focus event logs and debug logs. Test: go/wm-smoke, check event logs and logcat Change-Id: I7d96c706ea350ec122c254fb4c327756e8267df5
2021-01-06Merge SP1A.210105.001Scott Lobdell
Change-Id: I7cd48ebbcbab9dc7b9cc62fdd6dd7ec0a2890a85
2020-12-22Avoid blocking untrusted touches for touch_flag_obscuredBernardo Rufino
Prevent the feature from blocking the touch since we want to verify that the proper flag is correctly assigned to the motion event. The test still has value since for some window types (eg. SAW) we might allow touches via go/untrusted-touches but we still want the FLAG_WINDOW_IS_OBSCURED mechanism to work. So, we just configure the surface as TouchOcclusionMode::ALLOW, which makes go/untrusted-touches bypass it. Bug: 158002302 Test: atest InputSurfacesTest#touch_flag_obscured Change-Id: I9fb2846752b8674eec50b777c203a13cdc836144
2020-12-10Use empty frame for input when layer bounds is invalidchaviw
Fixed a few issues: 1. Return INVALID_RECT for size if there's no buffer for BLAST. This was already done in BufferQueueLayer. This ensures we don't assume the layer has a valid size when there's no buffer 2. Don't transform invalid layer bounds in fillInputInfo since it could result in sending a valid frame when the layer actually has no bounds. Instead just set input frame to empty, reset the transform, and return early. Test: Window with no width or height doesn't get untrusted touch Test: InputSurfacesTest Fixes: 173297887 Change-Id: I191d411b0f83ce57b6fdc20a1def8070110d418b
2020-11-16Merge SP1A.201116.001Scott Lobdell
Change-Id: I3edd90a225f8637ff14f147b8e7e4d24ca925444
2020-11-06Crop bounds sent to input by screen bounds.chaviw
We want to the frame sent to input to be the layer bounds, including crop. This is because if the layer is cropped, we don't need to consider the cropped area on screen and therefore will not affect the touch area. Test: Minimized split has correct input frame Test: InputSurfacesTest.* Fixes: 170871385 Fixes: 171756624 Change-Id: I3d00f98044a68de6596265bc3e444d3ed2ea5896
2020-10-27Merge SP1A.201015.001Scott Lobdell
Change-Id: Iccab50539e2c2716c434058bcf44e0c2fba76e9c
2020-10-08Merge SP1A.200921.001Justin DeMartino
Bug: 156774977 Change-Id: I0464227ace6d008e1efe37b87c6fb30a2630d606
2020-10-01Pass surface control instead of handle as reference to layers inPablo Gamito
LayerState Allows us to have access to the layer id stored in surface control so that it can be dumped when tracing the transaction merges Test: Existing tests Change-Id: I3e466c69585937d8ce74a29a49fdbb7b3353a460
2020-09-23Merge "Second reland "Let InputFlinger create the server InputChannel""TreeHugger Robot
2020-09-23Merge "Ensure insets for input are transformed correctly."Chavi Weingarten
2020-09-23Ensure insets for input are transformed correctly.chaviw
This change does the following: 1. Takes the inverse transform and transforms the final layer bounds. This is to find the real bounds, including insets after insets have been added. 2. Use the top and left of the real bounds to get the translation value for the transform. This is done by applying the original transform on the new left and top. 3. Set the translation of the input transform as the calculated values from above. 4. Send the inverse transform to input so the input coordinates can be transformed to window space. Also use the transform to correctly update the touchable regions in the layer space. Test: libgui_tests Test: Rotated layer gets correct input Fixes: 158802274 Change-Id: Ib0bfaa043509032ed702f442d806097bfd48d418
2020-09-22Second reland "Let InputFlinger create the server InputChannel"Garfield Tan
Bug: 167947395 Bug: 169173706 Test: atest NexusLauncherTests:com.android.launcher3.ui.TaplTestsLauncher3 Change-Id: I9cbe8ce92d006abfe9246f88844730951caf940b
2020-09-22Revert "Reland "Let InputFlinger create the server InputChannel""Garfield Tan
Revert submission 12655292-hide-server-input-channel Reason for revert: b/169173706 Reverted Changes: Iefbfd9313:Reland "Let InputFlinger create the server InputCh... I14837d545:Reland "Use new create/removeInputChannel()." Change-Id: I7db057277df06fd865f5e9ffbdb88c940d0f9e8e
2020-09-21Reland "Let InputFlinger create the server InputChannel"Garfield Tan
Bug: 169083114 Bug: 169088136 Bug: 167947395 Test: Gesture navigation works. Test: atest TaplTestsLauncher3 Change-Id: Iefbfd9313516d2beabfd33989b950e9992255789
2020-09-21Revert "Let InputFlinger create the server InputChannel"Roshan Pius
Revert submission 12594832-hide_server_input_channel Reason for revert: <INSERT REASONING HERE> Reverted Changes: I7033caf10:Use new create/removeInputChannel(). I35f768c8a:Let InputFlinger create the server InputChannel Bug: 169083114 Bug: 169088136 Change-Id: Ib6945129936006682cd03cea614fbdfd4f5fa008
2020-09-21Let InputFlinger create the server InputChannelGarfield Tan
We can be sure that server channel won't leave InputFlinger. Bug: 167947395 Test: Touch events are still dispatched. Test: m -j inputflinger Test: atest inputflinger_tests Test: atest inputflinger_benchmarks Test: atest libgui_tests Change-Id: I35f768c8a7b3bfe11e04577c028e52556b60ff14
2020-09-10Merge "Unregister input channel by token"TreeHugger Robot
2020-09-09Unregister input channel by tokenSiarhei Vishniakou
An input channel is uniquely identified by its token. Once the input channel exists, you can unregister it simply using its token. There's no need to pass back the entire input channel, including its id, to input dispatcher. We will look for the server-side input channel using the token anyways. Bug: 167947395 Test: atest libinput_tests Change-Id: I009da372bd6cc897b019a66e9c3bbed78cc91223
2020-09-08Request focus using setFocusedWindowVishnu Nair
Switch from using setInputWindow to setFocusedWindow to set the focused window for a display. setInputWindows will still handle window state changes such as visibility and focusability which can take focus away from the currently focused window. This change explicitly defines how mirrored window or windows sharing a window token handles focus. For a window to be focusable, all the windows sharing its window token must be focusable and at least one of the window must be visible. This different from the previous behaviour where z-order and the state of a single window determined focus via setInputWindows. In addition, if focus is requested on an invisible window, the request is queued up until the window becomes focus or a new request is made. Any key events are queued and delivered to the new window as it becomes focused. This allows the system to deliver any key events to the new window between the time that the system wants to show a new window and the window is ready to receive input. Test: atest inputflinger_tests Test: atest CtsWindowManagerDeviceTestCases Test: atest FlickerTests Change-Id: Id09cce42f55fb7d36a3eb0aa9d28f6a44bd1cf07
2020-09-01Merge SP1A.200727.001Daniel Norman
Change-Id: I35ff31fcafe82e34e27ea395bd6bb6e8b52811d4
2020-08-17Rename InputWindowHandle hasFocus to focusableVishnu Nair
A window with hasFocus set to true, means the window can be focusable. The current name is confusing when mutliple windows set the field to true. Rename this to focusable and also remove canRecieveKeys field which is not used. Test: presubmit Bug: 151179149 Change-Id: I38f63dfd08300b6fc97388ee6d8bcbdddb89c4a1
2020-07-31Add default input dispatching timeout constantSiarhei Vishniakou
To use the same number consistently in java and native, add IInputConstants interface where we will store the constants. Bug: 161009325 Test: atest inputflinger_tests Change-Id: I10f45547b1161e3768a134b38bf40d77a3a82f09
2020-07-28Use AIDL compiler to generate InputApplicationInfo class.Chris Ye
Define parcelable structure in AIDL file to skip manual code of parcel read and write. Bug: 160178917 Test: atest libinput_tests Change-Id: Ic7a5a0b383fdb5784b9b8cdb0ee5acce30b89223
2020-07-20Use unique_ptr when creating InputChannelSiarhei Vishniakou
InputChannel api will return unique_ptr, and it is up to the caller to decide how to use that. In most cases, the caller will proceed with making is a shared_ptr. Bug: 142581626 Test: atest libinput_tests inputflinger_tests Change-Id: Ice473a4c85241c63e3f4d6cdd30f8258ed7485e7
2020-07-20Use std::shared_ptr for InputChannelSiarhei Vishniakou
Modernize the code by moving away from RefBase. We can further improve this by switching to unique_ptr in some places. Current refactor is to get off of RefBase only. Test: interact with cf after device boots Bug: 142581626 Change-Id: Ib90fc721970113310b87411bcc2ba62e30ddfd01
2020-07-17Move things in InputWindowInfo to enum classesMichael Wright
Also introduce a new Flag class to make it possible to deal with flags while treating the individual flags as part of an enum class in a type safe manner. Bug: 160010896 Test: atest inputflinger_tests, atest libinput_tests Change-Id: I915a1c1e3b31f1c0fd99b83ba5fad7e537cd6f84
2020-07-10AIDL-ize InputManager IInputFlinger interface.Chris Ye
Use AIDL interface to define the IInputFlinger interface and replace the manual interface. Bug:155425003 Test: atest libgui_test, atest libinput_test. Change-Id: Ibad036b8ceb3a3f5c6d58f8de4ea8c79379d29b5
2020-07-08Use chrono for dispatching timeoutSiarhei Vishniakou
To prevent confusion about the units of dispatchingTimeout, convert to chrono. Bug: 155931890 Test: atest inputflinger_tests Change-Id: Icfcb3bad7188052a6b047b3cbe836be8d928fad2
2020-06-24Merge RP1A.200624.001Daniel Norman
Change-Id: I177c8610cccca1e4bf085bde792ed7d67b014bb9
2020-06-19Fix "Allow/Deny" popup window no respond when use cursorarthurhung
Currently all buffered layers will send input info to InputFlinger in order to detect if a window is obsecured by another layer. This could cause the cursor sprite are calculated into the input windows and generate the unexpected FLAG_(PARTIALLY)_OCCLUDED. To fix this, we exclude the cursor layer when fill input info to InputFlinger. Bug: 158717144 Test: atest InputSurfacesTest Test: connect mouse, open camera and popup grant permission dialog Change-Id: Ic57dfc7b68f8bf8fda5d7a77e107ca023b55b891
2020-05-11Merge RP1A.200511.001Steven Laver
Change-Id: I402147b1ded4ecf757274805c42158259ff0fe3c
2020-05-06Use <chrono> for input-related timeoutsSiarhei Vishniakou
There is a lot of confusion in input tests about the units used for the timeouts. In a lot of cases, the timeouts are set too short, which causes failures when they start getting enforced. To avoid this, use std::chrono::duration for the timeouts. Ideally, we should convert InputWindowInfo and InputApplicationInfo to use std::chrono::nanoseconds, but that would be a larger change reserved for a future release. Bug: 143459140 Test: atest inputflinger_tests libinput_tests inputflinger_benchmarks Change-Id: Ie7536e8a042a71b372f03314501e0d635a6ac1d4
2020-02-14Merge RP1A.200214.001Steven Laver
Change-Id: I8c5b0d98bfe9826b7792a2b4a97368f69e14c1c8
2020-02-11Rename ColorLayer to EffectLayer to handle both shadows and color fillVishnu Nair
We want the ability for a layer to render shadows without any content. This new layer type will be able to combine effects as needed. Test: presubmit tests (no functional changes) Test: go/wm-smoke Change-Id: I8663d126a23263a3d7dc799d39a9cf44b3b6e4a0
2020-02-04Merge RP1A.200204.001Steven Laver
Change-Id: I9c8cb894e80a8606d10979a7c43602b0c46e36cd
2020-01-29SF: Redesign API to query display informationDominik Laskowski
The DisplayInfo list returned by ISurfaceComposer for display configs contains display information/state redundant across configs. Extract config information to DisplayConfig, and repurpose DisplayInfo for immutable information about a physical display. In a future CL, SF will populate DisplayInfo with additional data (e.g. connection type, EDID fields) on initial connection. DisplayConfigs retain the ability to reload on subsequent connections. Introduce ui::DisplayState for transactional state applicable to both physical and virtual displays. Bug: 144601064 Test: dumpsys display Change-Id: I72003e8ef71483ef483d0de85d28b859a6c9f5fc
2020-01-23Merge RP1A.200123.001Steven Laver
Change-Id: Ic4571c8073994b447105595fe09dbc83d3d11d8b
2020-01-10Move focus dispatch to input (1/2)Siarhei Vishniakou
Input now tells the apps when they have focus. When a focus change has been detected, we enqueue a FocusEntry into the dispatcher queue. It will be sent to the app via the socket. At the same time, we tell the apps the current state of the touch mode. Bug: 70668286 Test: atest libinput_tests inputflinger_tests Change-Id: Icefb9383ba8424162d739c9e981bd1dd01cc7941