summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Update documentation for AInputEvent_toJavaArpit Singh2024-02-281-1/+4
| | | | | | | | | | | As AInputEvent_toJava makes JNI calls, the caller must ensure there are no pending JNI exceptions as it may result in undefined behaviour. This needs to be explicitly documented. Refer: https://developer.android.com/training/articles/perf-jni#exceptions Bug: 324375527 Test: atest MotionEventTest KeyEventTest Change-Id: If9f40ba1ee2cb091514fb3baae28f2ca7520727e
* Merge "Allow using libandroid_headers_private on host builds" into mainJerome Gaillard2024-02-231-0/+10
|\
| * Allow using libandroid_headers_private on host buildsJerome Gaillard2024-02-161-0/+10
| | | | | | | | | | | | | | | | This is needed to create a host implementation of RenderThread. Bug: 322360037 Test: build libandroid_runtime on host Change-Id: I23f78155e0d2c511451e3e249537b83ca06f411a
* | InputDispatcher_test: Verify all traced events match exactlyPrabir Pradhan2024-02-201-1/+9
|/ | | | | | Bug: 210460522 Test: atest inputflinger_tests Change-Id: I2ab660ed0a6888c23bc711fb8494385c22b3c404
* Merge "Add support for restricting HDR headroom for video" into mainAlec Mouri2024-02-161-3/+47
|\
| * Add support for restricting HDR headroom for videoAlec Mouri2024-02-151-3/+47
| | | | | | | | | | | | | | | | | | | | | | | | This is needed for allowing apps to vote for HDR headroom restrictions for SurfaceView and SurfaceControl Bug: 323964760 Test: manually poking at test app Test: SurfaceViewTests Test: SurfaceControlTest Test: ASurfaceControlTest Change-Id: Ie886e67879525462d49fdedc535aea659d69321a
* | Add NDK API to obtain Java InputEvent from Native AInputEventArpit Singh2024-02-141-0/+8
| | | | | | | | | | | | | | | | | | This CL adds an NDK API to obtain a copy of native AInputEvent as Java InputEvent. Test: atest MotionEventTest KeyEventTest Bug: 298948992 Change-Id: If7b14867813f7b07bd628ebd6da7e3be4c3bb89e
* | Merge "Pass unique_ptr of InputChannel to Connection" into mainSiarhei Vishniakou2024-02-051-1/+10
|\ \
| * | Pass unique_ptr of InputChannel to ConnectionSiarhei Vishniakou2024-02-051-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets us closer to the goal of storing unique_ptr of InputChannel inside the InputPublisher. In this CL, we are still allowing the "copy" and "dup" functions to exist. Removing those requires significant refactoring on the Java side, including the jni layer and object ownership models. Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Bug: 161009324 Change-Id: If6f44d78c7fc9f3e12729068de1753847abf0ebb
* | | Merge "Allow ADPF WorkDuration CPU duration to be zero" into mainMatt Buckley2024-02-051-6/+7
|\ \ \
| * | | Allow ADPF WorkDuration CPU duration to be zeroMatt Buckley2024-02-011-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates the checks, tests, and documentation to ensure ADPF CPU == 0 is allowed, and instead checks to make sure that both CPU and GPU cannot be 0 at the same time. Bug: 323226967 Test: atest PerformanceHintManagerTest Change-Id: I6927899793c7d9801541465280af32627e200dc9
* | | | Merge changes I3fc52c3d,I6bdcd983 into mainTreehugger Robot2024-02-053-16/+28
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | * changes: FTL: Silence __VA_ARGS__ warning with empty arg FTL: Fix SmallMap<K, V, 0>::try_emplace
| * | | FTL: Silence __VA_ARGS__ warning with empty argDominik Laskowski2024-01-292-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 185536303 Test: ftl_test Change-Id: I3fc52c3dc3904ace7822200ca6c0f9ac39df8fe2
| * | | FTL: Fix SmallMap<K, V, 0>::try_emplaceDominik Laskowski2024-01-291-4/+18
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | SmallVector<T, N>::emplace_back returns a reference, whereas SmallVector<T, 0>::emplace_back returns an iterator (because its API must be compatible with StaticVector). Bug: 185536303 Test: ftl_test Change-Id: I6bdcd983c0bb2d2a326f79906997f85e89d7df44
* | | Support for InputDevice ViewBehaviorYeabkal Wubshit2024-02-011-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change creates a struct within InputDeviceInfo to hold View related behaviors of an input device. Currently, a single behavior is supported: device.viewBehavior_smoothScroll. This can be specified in an IDC file to hint clients of the InputDevice that they should animate scrolls for motion events generated by the InputDevice. Bug: 246946631 Test: add property in IDC, check API returns expected value Test: atest frameworks/native/services/inputflinger/tests/InputReader_test.cpp Change-Id: Ibe373cadc40d2a08116e787b744dd30812638edb
* | | Store Connection in InputTarget and MonitorSiarhei Vishniakou2024-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will replace the InputChannel. They don't both need to be shared pointers. A lot of times, we are using InputChannel to look up the connection. In this CL, this is simplified by using the connection directly. Bug: 161009324 Test: atest inputflinger_tests Change-Id: I3fc2bbdd8c5076b5dbff5067e4fec6e45f5c3da6
* | | Merge changes I0fcfa426,I2f1510ec,I07d70dc8 into mainDominik Laskowski2024-01-311-0/+65
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * changes: SF: Fix error handling for getDisplayVsyncPeriod SF: Handle BAD_CONFIG for getActiveConfig FTL: Add Expected<T, E>
| * | | FTL: Add Expected<T, E>Dominik Laskowski2024-01-301-0/+65
| |/ / | | | | | | | | | | | | | | | | | | | | | Extend `base::expected` with `has_error()` and `value_opt()`. Bug: 185536303 Test: ftl_test Change-Id: I07d70dc8fe7ebfe2f08626dff51aef0b98430f61
* | | Merge "Use aidl-defined InputChannel for parceling" into mainSiarhei Vishniakou2024-01-301-36/+12
|\ \ \
| * | | Use aidl-defined InputChannel for parcelingSiarhei Vishniakou2024-01-301-36/+12
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, InputChannel is a manually-written parcelable. In this CL, we introduce an aidl-defined InputChannel, which eventually could also be used in Java as well. Now, whenever an InputChannel needs to be written to parcel, we first create the new android.os.InputChannel and then write that object to parcel. Eventually, we can convert the Java side of InputChannel to use this mechanism, as well. Bug: 161009324 Test: adb shell monkey 1000 Test: atest libgui_test Change-Id: Ib44c5ff02b3c77e0425b59a76195ed100e187317
* | | Merge "Add native side keycodes for emoji and screenshot" into mainVaibhav Devmurari2024-01-301-0/+4
|\ \ \ | |/ / |/| |
| * | Add native side keycodes for emoji and screenshotVaibhav Devmurari2024-01-301-0/+4
| |/ | | | | | | | | | | Bug: 315307777 Test: manual Change-Id: I737a7418f43afac4735bb1a5523713890f4df553
* / Correctly pass screenshot fences to transaction callbacksAlec Mouri2024-01-262-0/+20
|/ | | | | | | | | | | | | | | | In some instances, a screenshot may be captured before a layer has a release callback registered. This can happen when a new buffer has not yet been transacted before a screenshot is captured. This causes the screenshot fence to be dropped and the possibility of tearing when capturing a screenshot while continuously rendering. To resolve this, buffer screenshot fences into a list of future fences when there is no callback registered, and merge those fences when dispatching the release callback. Bug: 302703346 Test: SurfaceViewTests#testMovingWhiteSurfaceView 100 times Change-Id: I91aec3cdb0973092d48cd77e59dd3999e9d9e847
* Merge "Add support for new PowerHAL methods to PowerHalWrapper" into mainMatt Buckley2024-01-232-25/+81
|\
| * Add support for new PowerHAL methods to PowerHalWrapperMatt Buckley2024-01-232-25/+81
| | | | | | | | | | | | | | | | | | | | This patch adds FMQ support, createHintSessionWithConfig support, and refactors the class structure slightly to allow wrapper subclasses to share unsupported method logic with EmptyHalWrapper Bug: 317387260 Test: atest libpowermanager_test libsurfaceflinger_unittest libcompositionengine_test Change-Id: I53b67055b3ada4dc8576533a9b961ff5ec3367a5
* | Merge "Provide error handling for nullptr in the ADPF NDK" into mainMatt Buckley2024-01-231-6/+6
|\ \
| * | Provide error handling for nullptr in the ADPF NDKMatt Buckley2024-01-231-6/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Currently there is very little error handling for null pointers in the NDK, so this CL aims to remedy that by changing the WorkDuration API to pass status messages, updating the relevant documentation, and making sure that all existing methods check all pointers that are passed. Bug: 321065424 Test: atest PerformanceHintNativeTestCases Test: atest PerformanceHintManagerTest Test: atest HintManagerServiceTest Change-Id: I4439328cc2f551b8325c1a82019a35478a5dd372
* / Fix aapt2 build break on MacOSMichael Hoisie2024-01-221-0/+4
|/ | | | | | | | | | | | | | | | | | | | | | In ag/25343121 the include statements were sorted for 'androidfw/ResourceTypes.h'. This reordering unfortunately caused a build break for aapt2 on host MacOS. The issue was that 'android/configuration.h' includes 'android/asset_manager.h', which references off64_t, a type that is not available on MacOS. Previously, the 'android/configuration.h' include occurred after 'androidfw/Asset.h', which transitively included 'android-base/off64_t.h', leading to the definition of off64_t. Add a typedef for off64_t for Darwin in asset_manager.h. An alternative approach would be include 'android-base/off64_t.h' in asset_manager.h, but adding a dependency to libbase seems excessive for this change. Test: m libnativehelper aapt2 on Mac Bug: 321309980 Change-Id: Ie67f4256c4ca309bf6eb4a2a2fc28de2155041f5
* Merge "Add InputChannel::waitForMessage and use it in ↵Egor Pasko2024-01-181-0/+11
|\ | | | | | | EndToEndNativeInputTest" into main
| * Add InputChannel::waitForMessage and use it in EndToEndNativeInputTestEgor Pasko2024-01-171-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The EndToEndNativeInputTest::waitForEventAvailable(timeoutMs) is similar in implementation to InputChannel::probablyHasInput(), but can stop after a timeout. Add InputChannel::waitForMessage(std::chrono::milliseconds timeout) for use in tests and use it to replace the waitForEventAvailable(). The difference of the new method from probablyHasInput() is that the latter does not get repeated (because it is not necessary to implement the hint). Repeating happens only on EINTR to allow tests to return before timeout expiration when there are problems with the channel setup. In the end the implementations are rather different. Bug: b/314973388 Test: atest frameworks/native/libs/gui/tests/EndToEndNativeInputTest.cpp Test: atest InputPublisherAndConsumerTest Change-Id: I806aad14e4fba223a5cbbe49cea862f9b8279f24
* | Merge "CursorInputMapper: share acceleration curves with touchpad" into mainHarry Cutts2024-01-172-9/+95
|\ \ | |/ |/|
| * CursorInputMapper: share acceleration curves with touchpadHarry Cutts2024-01-172-9/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new touchpad mapper implemented in Android 14 replaced our simple cursor movement acceleration curves (where the acceleration factor increased linearly with speed between minimum and maximum values) with more sophisticated multi-segment curves. However, cursor movement using mice remained on the old curves. For consistency and to improve pointing accuracy, use the same curves for mice, too. This is also a good opportunity to improve the documentation comments and naming now that I've wrapped my head around the maths a bit better. Bug: 315313622 Test: atest inputflinger_tests Test: check pointer movement with a mouse, including changing the pointer speed setting and checking that the movement speed changes Change-Id: Ifcf43f4de6017f06b66f37d5e03a13cc257d92d5
* | Merge "Implement virtual stylus" into mainBiswarup Pal2024-01-151-4/+25
|\ \
| * | Implement virtual stylusBiswarup Pal2023-12-291-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | Test: atest VirtualStylusTest, VirtualStylusMotionEventTest, VirtualStylusButtonEventTest, VirtualInputDeviceConfigTest Bug: 304829446 Change-Id: I876e538104b674862e8509414790124b2a28d379
* | | Merge "Align parameter name of AWorkDuration_release with documentation" ↵Xiang Wang2024-01-111-2/+4
|\ \ \ | | | | | | | | | | | | into main
| * | | Align parameter name of AWorkDuration_release with documentationXiang Wang2024-01-111-2/+4
| |/ / | | | | | | | | | | | | | | | Bug: 319284963 Test: m Change-Id: I636a07f5cb939a1ac739628a1eff7c882245acd5
* | | Merge "Add nullability type qualifiers for thermal NDK APIs" into mainXiang Wang2024-01-111-13/+17
|\ \ \ | |_|/ |/| |
| * | Add nullability type qualifiers for thermal NDK APIsXiang Wang2024-01-111-13/+17
| |/ | | | | | | | | | | Bug: 319285135 Test: m Change-Id: I5bf5b92b2844e7b9a5702b3ed48111d42e4ecce8
* | Merge "Add private ndk ref for GPU load hints" into mainMatt Buckley2024-01-101-0/+20
|\ \
| * | Add private ndk ref for GPU load hintsXiang Wang2024-01-081-0/+20
| |/ | | | | | | | | | | Bug: 284324521 Test: n/a Change-Id: Ied2a6fd43ecf23482f52cbb60e2e982ef5b833d7
* | Merge "Expose InputConsumer::probablyHasInput" into mainEgor Pasko2024-01-041-0/+14
|\ \ | |/ |/|
| * Expose InputConsumer::probablyHasInputEgor Pasko2024-01-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce InputConsumer::probablyHasInput() to check for availability of input events that have not been consumed yet. It performs a poll on the underlying file descriptor. The return value is precise (modulo rare syscall interruptions), but clients should handle it as a performance hint. This hint would allow to prioritize input-related work, but only when input events are *likely* pending. Usage constraints for a future/possible API in the Android Framework: 0. This is experimental. The usefulness of the hint has not been broadly proven, and the functionality can be removed soon if there is no robust data to support the usefulness. 1. The high-level API visible to apps would be effectively opt-in: does not create any state if not used. 2. An app could use this hint to yield from longer tasks on the UI thread (which it is not supposed to create in the first place). This is a very niche workaround for Chrome's complexity. 3. Using the Input Hint in WebView should probably be disabled: WebView has less control over the embedding app than Chrome, and less knowledge when to prioritize for input handling. 4. There is a good question whether probablyHasInput() should guarantee to return true only when input is queued. While it is good to return precise results, clients should only use this API as an optimization hint without sacrificing correctness. Due to the growing complexity of input handling on Android, it is not too hard to imagine that in some not-too-distant future input would get filtered by the Framework on the application side, potentially skipping the contents from the ready-to-read file descriptor or an accumulated InputConsumer batch. Bug: b/314973388 Test: atest 'InputChannelTest#ProbablyHasInput' Test: atest InputPublisherAndConsumerTest Change-Id: I9681a9ddd0249e3bfd5285c6570dee7a9f5de951
* | TouchedWindow: store tool type in addition to pointer idSiarhei Vishniakou2023-12-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this CL, we only stored the touching pointer id's inside TouchWindow. However, it is also necessary to know which of the touching pointers are touch vs stylus. This would allow us in a later CL to determine whether the stylus is currently down anywhere on screen. In this CL, instead of storing just the pointer ids, store PointerProperties in a vector. This includes the pointer id and the tooltype. There should be no behaviour change in this CL. Bug: 316225294 Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Change-Id: I7fb2bbd46e7da7e085679ee16da3a53773931875
* | Correctly handle empty vector when printingSiarhei Vishniakou2023-12-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | before this CL, an empty vector passed to 'dumpVector' would cause a crash (in the good case) and undefined behaviour otherwise. In this CL, fix this function. Bug: 211379801 Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Change-Id: I93f4defb947f41d68f0ec22bd35b6c069fbc15e4
* | Merge "FTL: Introduce ftl::Function<F,N> et al." into mainTreehugger Robot2023-12-132-0/+432
|\ \
| * | FTL: Introduce ftl::Function<F,N> et al.Lloyd Pique2023-12-132-0/+432
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ftl::Function<F, N> is a container for function object, and can mostly be used in place of std::function<F>. Unlike std::function<F>, a ftl::Function<F, N>: * Uses a static amount of memory (controlled by N), and never any dynamic allocation. * Satisfies the std::is_trivially_copyable<> trait. * Satisfies the std::is_trivially_destructible<> trait. However to satisfy those constraints, the contained function object must also satisfy those constraints, meaning certain types (like std::unique_ptr's) cannot be part of the contained function object type. The size of a ftl::Function<F, N> is guaranteed to be: sizeof(std::intptr_t) * (N + 2) If not specified, N defaults to zero, which is big enough to store a lambda that captures a single pointer (such as "this" for forwarding to a member function. By comparison, sizeof(std::function) == sizeof(std::intptr_t) * 4, at least with on x86-64 with clang 15. Compile time checks are performed that the constraints are all satisfied, and that the value of N is large enough to contain the desired function object type. ftl::make_function is a helper function to construct a ftl::Function, and will deduce the template type arguments. In addition to constructing a ftl::Function for a function object, ftl::make_function has overloads for creating a ftl::Function which will invoke a member function or a free (non-member) function. ftl::no_op is a helper value to construct a ftl::Function<F, N> that does nothing, except default construct a return value, if one is needed. A unit test is also included to demonstrate and verify the implementation, including asserting that function objects which don't meet the requirements cannot be used. The test also asserts some non-obvious corner cases for handling argument and return value conversions to match how std::function behaves. Bug: 279581095 Test: atest ftl_test Change-Id: I268facb106a248d0766e931595291036bc606fb7
* | | Merge "Fix -Wformat compiler warning" into main am: 226de2d1bd am: ↵Treehugger Robot2023-12-111-3/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e79ffe8b7b am: e65945e179 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2868014 Change-Id: I91ca3365edf91b41c907abde0a0d9e468b9e6f52 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * | | Fix -Wformat compiler warningYi Kong2023-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | DisplayViewport.h:133:29: warning: format specifies type 'int' but the argument has type 'ui::Rotation' [-Wformat] Test: presubmit Change-Id: Ie656a3da47f2155b106014dff967d5b2d05998d9
* | | | InputDispatcher: dump window in a separate functionSiarhei Vishniakou2023-12-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it more convenient to dump windows from other places during debugging. For example, this could also be called from setInputWindows to inspect all of the window flags that might be changing. Bug: 312714754 Test: adb shell dumpsys input Change-Id: I2ace23bec1231f3a318e1b6a19f146b588e077b6
* | | | Pass all input events to MetricsManagerCody Heiner2023-12-072-28/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MetricsManager needs to receive UP/CANCEL events to trigger atom reporting. I must have moved these lines around during the refactor and overlooked this mistake. This change also modifies MotionPredictor and MetricsManager to hold a "ReportAtomFunction" to facilitate testing. Test: `statsd_testdrive 718` shows atoms reported with `adb shell setenforce 0`. Test: `atest frameworks/native/libs/input/tests/MotionPredictor_test.cpp -c` passes. Test: `atest frameworks/native/libs/input/tests/MotionPredictorMetricsManager_test.cpp -c` passes. Bug: 311066949 Change-Id: Icbb709bbb7cf548512e0d9aa062783d554b857e3