Age | Commit message (Collapse) | Author |
|
After the input channel is closed, the messages that were previously
written to the fd should still be readable. However, in some cases, if
the fd is closed with data in the fd's buffer, the data may be
discarded. This is confirmed by the attached unit test.
Add an explanation of this to the InputChannel implementation, so that
this behaviour is documented.
Bug: 376713684
Test: TEST=libinput_tests; m $TEST && adb sync data && adb shell -t /data/nativetest64/$TEST/$TEST --gtest_filter="*ReceiveAfterClose*" --gtest_repeat=100000 --gtest_break_on_failure
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="*ReceiveAfterClose*" --gtest_repeat=100000 --gtest_break_on_failure
Flag: TEST_ONLY
Change-Id: I67a6a6432c4756283c8f2cca3c01210a3bcdb42e
|
|
This test is broken because it relies on an incorrect ACTION_CANCEL
event being generated. Move this test over to the new
InputMapperUnitTest infra before fixing it in subsequent CLs.
Bug: 378308551
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Flag: TEST_ONLY
Change-Id: I016fb66f7fcbe957cd5b6e8ca86513cb8c372cd3
|
|
If the publisher has been destroyed (or, equivalently, if the server
channel was closed), the consumer should not crash. Instead, we should
allow consumer to exit gracefully.
In this CL, we specifically check for DEAD_OBJECT and drain the queue,
printing all of the events that will never be delivered to the publisher
for useful debugging purposes.
Bug: 305165753
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Flag: EXEMPT bugfix
Change-Id: I00973ebb87e0f59bfd3c0f58edf7355b28988c15
|
|
|
|
LegacyResampler still resamples MotionEvents even when requestedFrameTime is
std::nullopt. The problem is that if the parameter requestedFrameTime
is std::nullopt, it is reassigned inside consumeBatchedInputEvents to
std::numeric_limits<nsecs_t>::max(). In spite of using max() as a
placeholder to indicate that everything should be consumed, it is still a valid time, and resampler uses it to resample MotionEvent. To fix this issue, having a valid requestedFrameTime should also be a condition to resample MotionEvents.
Bug: 374375203
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I6e53bdd0a35d359da8b50f10dd4aad9bddc8aa3f
|
|
It turns out that 'finishInputEvent' was adding the fd back to the
looper. This caused an NPE because we were calling 'finishInputEvent' at
the end of the consumer destructor, thus leaving the callback in the
looper. The looper would hit an NPE whenever the fd signaled after that.
To fix this, we move the call to setFdEvents(0) to the very end of the
destructor. This way, we can be sure that the last thing that executes
is the removal of the fd from the Looper.
There is also a possibility that fd is signaled during the destructor
execution. Theoretically, this should be okay because the fd callbacks
are processed on the same thread as the one where destructor runs.
Therefore, the signals would only be processed after the destructor has
completed, which means the callback would be removed before it gets the
chance to execute.
Bug: 332613662
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="*InputConsumerTest*"
Test: TEST=libutils_test; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Flag: EXEMPT bugfix
Change-Id: If5ac7a8eaf96e842d5d8e44008b9c1bff74e674e
|
|
Before this CL, the InputConsumer would try to finish all of the pending
events that haven't been received by the app by forcefully consuming
everything in the destructor.
Unfortunately, this leads to the following crash: the callbacks (app) is
storing the consumer inside unique_ptr. When the destructor of consumer
runs, the unique_ptr will first assign the raw pointer to nullptr and
then run the destructor. Next, inside the destructor, the callbacks are
invoked, and the app may try to finish an input event that it receives.
However, to finish, app needs to call back into the consumer, which is
being destroyed. Since the only way the app can talk to the consumer is
via unique_ptr, that pointer has already been set to nullptr, and this
causes an NPE.
To fix this, we will no longer be invoking the callbacks when the
consumer destructor is invoked (this is done in this CL).
The logic is as follows:
- All events that have already been delivered to the app should still be
finished by the app (this piece is debatable. we can fix this later if
this becomes a problem).
- Events that are batched, and not yet delivered to the app, will be
automatically finished by the consumer, without sending them to the
app. Since the app is destroying the consumer, it's unlikely that it
cares about handling these events, anyways.
If we want to finish _all_ pending messages (the messages that app
hasn't yet called "finish" on), then we should probably iterate through
mConsumeTimes, which is the only struct that keeps track of _all_ events
that have been sent to the app, and not yet finished. However, to do
this, we would need to rename this data structure, since it will no
longer be solely used for keeping track of consume times, but also for
"unprocessed events" that were read from the channel.
Bug: 332613662
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I9b0128291f6197f099cb9e3c305f9717c0198c90
|
|
Added multiple device resampling support to InputConsumerNoResampling
with unit tests to ensure correctness
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*"
Change-Id: I45528a89e0b60f46b0095078356382ed701b191b
|
|
Updated InputConsumer_test.cpp to use getFdStateDebug, and reverted the
changes introduced by LooperInterface in InputConsumerNoResampling
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*"
Change-Id: I7621fdf0923e16794142316a126d81e5faf3d708
|
|
Added current device consumption to InputConsumerNoResampling in
consumeBatchedInputEvents' body
Bug: 329776327
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*"
Change-Id: Ibfcb28f019543a88b3ffada137199b1c3933d542
|
|
Fixed batching logic in InputConsumerNoResampling.cpp because it was
violating resampling frameTime preconditions.
Bug: 297226446
Flag: EXEMPT bugfix
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*"
Change-Id: I1b658d5b9ac7a56a8a3917a49c2b97b60641c0d5
|
|
Created TestInputChannel and TestLooper to control how InputMessages are
batched in InputConsumerNoResampling_test
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="InputConsumerTest*"
Change-Id: I036593b311a93ec301e8b9776b461505e853119f
|
|
Moved resampling into its own class and provided test coverage for it.
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="*ResamplingTest*"
Change-Id: Ic6227b05120395c96643ab05e1cda373dba59e19
|
|
Until now the MotionEvent's id was set during the "initialize" call, and it was equal to the first sample's eventId. We want to use the latest sample's eventId.
Bug: b/350907221
Test: atest libinput_tests inputflinger_tests
Flag: EXEMPT bugfix
Change-Id: I0d967e7fe644fc2b2c09d044c3ee8ed13276d787
|
|
Moved MotionEvent creation and batching into createBatchedMotionEvent
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I7e768f28bfae641b0ab38c4addc6b14c6dd23723
|
|
Changed receivedMessaged return type from status_t to
android::base::Result<>. Enforces checking valid state
before using the object.
Flag: EXEMPT refactor
Bug: 297226446
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: Ic2285d38a2d0d2227c1fae92379270a5f52586c7
|
|
Currently, we use int32_t for displayId, which is not a safe type, and
it may also lead to misdefinition of types. Here, we introduce
LogicalDisplayId as a strong type for displayId and move all contents
of constants.h into LogicalDisplayId.h.
Bug: 339106983
Test: atest inputflinger_tests
Test: atest InputTests
Test: m checkinput
Test: m libsurfaceflinger_unittest
Test: presubmit
Change-Id: If44e56f69553d095af5adb59b595e4a852ab32ce
Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
|
|
When the InputReceiver gets bad data from the other end of the channel, we currently don't print the channel information. As a result, when this crash happens, we only learn about the process name. Add the channel info to this crash so that it's more useful going forward.
Bug: 329059530
Change-Id: Iad4c892dee37a9bf35e790781a2c39431d5a146a
Test: presubmit
|
|
This will allow the upper layers to release the ownership and hand the
object over to the ndk client. The client will then assume the
ownership. This is not possible with the current implementation of
rvalue, because the ndk interface is only using pointers.
Unfortunately, this makes things more clunky for tests (unless we modify
BlockingQueue).
Bug: 324271765
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_repeat=100 --gtest_break_on_failure
Change-Id: I0cf326a22f840be6f8aa00d1e69f818815788487
|
|
In this CL, an InputConsumer with built-in looper handling is being
added. This will be useful for native code that needs batching, and that
provides choreographer callbacks directly into native code.
Before this CL (and with this CL, temporarily) the InputConsumer logic
was split between native and jni layers. In general, we shouldn't have
logic inside jni. But in this case, the situation was also making the
code difficult to reason and debug.
In this new InputConsumerNoResampling class, all of the features of
InputConsumer and NativeInputReceiver are combined, except for
resampling. That will be done separately, at a later time.
As a result, we will not be switching to the new
InputConsumerNoResampling class right away.
Once resampling is added, we can switch to the new
InputConsumerNoResampling (and rename it to InputConsumer), and delete
the old InputConsumer.
In the meantime, the new InputConsumerNoResampling will be useful in the
new NDK APIs. There, having resampling is not critical.
Bug: 311142655
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_repeat=100 --gtest_break_on_failure
Change-Id: I468ddbd8406c4bf9f5e022f79fd1a582ba680633
|