Skip to content
Snippets Groups Projects
  1. May 02, 2024
  2. Apr 02, 2024
  3. Mar 21, 2024
    • Linnan Li's avatar
      Add owner for include/android/keycodes.h · 04cb6b2e
      Linnan Li authored
      Because of the existence of extra spaces, the owner of keycodes.h is
      not configured as expected. We should delete this extra spaces.
      
      Bug: none
      Test: After merging, check whether the owner of keycodes.h includes
      all users under INPUT_OWNER
      
      Change-Id: I634c49f53a4633bdee3cdefbf0debae4dff90a47
      04cb6b2e
  4. Feb 23, 2024
  5. Jan 18, 2024
    • Prashanth Swaminathan's avatar
      [Cherry-pick] Add sys/cdefs and __REMOVED_IN define to looper.h · 1aa9f86f
      Prashanth Swaminathan authored
      The looper.h header introduced __REMOVED_IN, which requires the
      sys/cdefs.h header to provide definitions for the macro. Add them here
      and update files that include looper.h to not provide their own
      definitions of __REMOVED_IN. Further, update comments to clarify that
      the additional defines are in place to satisfy builds that use glibc or
      Windows/MacOS libcs.
      
      Bug: 14257980
      Change-Id: Ia524b7e180c5137e84c205a77dc219b9e9e41608
      1aa9f86f
  6. Jan 03, 2024
    • Arpit Singh's avatar
      Add flag to mark key usage code as a fallback mapping · ed0d74d2
      Arpit Singh authored
      We don't yet have a way to determine if a device can actually report a
      usage code. Adding a flag to mark usage code as fallback only mapping.
      
      Bug: 297094448
      Bug: 317838112
      Test: atest inputflinger_tests
      Change-Id: I137113d0dc9a1c8abf523b96942486be176d0240
      Merged-In: I137113d0dc9a1c8abf523b96942486be176d0240
      ed0d74d2
  7. Dec 13, 2023
    • Lloyd Pique's avatar
      FTL: Introduce ftl::Function<F,N> et al. · ace9af9b
      Lloyd Pique authored
      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
      ace9af9b
  8. Dec 11, 2023
    • Siarhei Vishniakou's avatar
      InputDispatcher: dump window in a separate function · 366fb5bf
      Siarhei Vishniakou authored
      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
      366fb5bf
    • Yi Kong's avatar
      Fix -Wformat compiler warning · 9a421037
      Yi Kong authored
      DisplayViewport.h:133:29: warning: format specifies type 'int' but the argument has type 'ui::Rotation' [-Wformat]
      
      Test: presubmit
      Change-Id: Ie656a3da47f2155b106014dff967d5b2d05998d9
      9a421037
  9. Dec 08, 2023
    • Cody Heiner's avatar
      Pass all input events to MetricsManager · 7b26dbea
      Cody Heiner authored
      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
      7b26dbea
  10. Nov 27, 2023
    • Peiyong Lin's avatar
      [Reland] Add API support for GPU work duration report in ADPF. · 81780c4a
      Peiyong Lin authored
      Previously we introduced the reportActualWorkDuration API without
      specifying the work duration for each components, this patch introduces
      a separate API that allows clients to send work duration with each
      component to allow fine grained scheduling strategy.
      
      Bug: b/284324521
      Test: atest PerformanceHintNativeTest
      Test: atest PerformanceHintManagerTest
      Change-Id: Ie68657dece0d7fef5843df798472adb9108f534f
      81780c4a
  11. Nov 20, 2023
  12. Nov 17, 2023
  13. Nov 10, 2023
    • Peiyong Lin's avatar
      Add API support for GPU work duration report in ADPF. · 31fab3e1
      Peiyong Lin authored
      Previously we introduced the reportActualWorkDuration API without
      specifying the work duration for each components, this patch introduces
      a separate API that allows clients to send work duration with each
      component to allow fine grained scheduling strategy.
      
      Bug: b/284324521
      Test: atest PerformanceHintNativeTest
      Test: atest PerformanceHintManagerTest
      Change-Id: Ia2e66ae173255acee3f05fa99177659604976aa1
      31fab3e1
  14. Nov 09, 2023
  15. Nov 08, 2023
    • Siarhei Vishniakou's avatar
      Fuzz InputDispatcher · 2defec03
      Siarhei Vishniakou authored
      Initial version of a fuzzer for InputDispatcher.
      
      The goal is to reproduce crashes that are triggered by the fatal logs,
      mainly around:
      1) mismatching downtime / eventTimes
      2) unexpected hover events
      
      Currently, the fuzzer runs without hitting those targets.
      However, it hits an ODR due to rect so currently it has to run without
      checking for ODRs.
      
      It also currently hits an out of memory issue after a short run, finding
      a problem in
      AStatsManager_setPullAtomCallback packages/modules/StatsD/lib/libstatspull/stats_pull_atom_callback.cpp:397:46
      
      Bug: 281806933
      Test: FUZZER=inputflinger_input_dispatcher_fuzzer; m $FUZZER && ASAN_OPTIONS=detect_odr_violation=0 $ANDROID_HOST_OUT/fuzz/x86_64/$FUZZER/$FUZZER
      Test: atest inputflinger_benchmarks
      Change-Id: I465ea11520fc9cc21886646c0ecf20dc529b2698
      2defec03
  16. Nov 03, 2023
  17. Oct 28, 2023
    • Siarhei Vishniakou's avatar
      Reset velocity for pointers that have been canceled · 318005c1
      Siarhei Vishniakou authored
      To fully support palm rejection, we should not produce any velocity for
      pointers that have been marked as palm.
      
      This can be achieved by erasing the corresponding pointer state in
      VelocityTracker for ACTION_POINTER_UP with FLAG_CANCELED events, or for
      all pointers in ACTION_CANCEL events.
      
      The pointers that have not been canceled will still produce the correct
      velocity.
      
      Bug: 236772648
      Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
      Change-Id: I67ecae6b4bff2eb63f9cff416841031dea3ed680
      318005c1
  18. Oct 24, 2023
    • Siarhei Vishniakou's avatar
      Return unique_ptr from readFromParcel · c62948ec
      Siarhei Vishniakou authored
      When KeyCharacterMap is read from parcel, there's no need to force the
      caller to store the object in a shared pointer. We can return a
      unique_ptr first, and let the caller decide on how exactly that lifetime
      should be managed.
      
      Bug: 274058082
      Test: presubmit
      Change-Id: I8c5ec1e32a9304f6ad186bc0279f4c7bcbab77d8
      c62948ec
  19. Oct 18, 2023
    • Siarhei Vishniakou's avatar
      Change isStylusEvent behaviour · dcc6e6ed
      Siarhei Vishniakou authored
      This function is now getting moved to Input.h.
      
      We are also making its behaviour deterministic: if at least one pointer
      is stylus, then the event is a stylus event (unless the source wasn't
      set to "stylus").
      
      This way, an event with 1 finger and 1 stylus pointers will have the
      same consistent behaviour, regardless of the order that the pointers are
      stored inside the event.
      
      Bug: 211379801
      Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
      Change-Id: Ie164e32b7c0e9cf21b3819b01a03ac2885666191
      dcc6e6ed
  20. Oct 09, 2023
  21. Oct 02, 2023
    • Arpit Singh's avatar
      Add flag to mark key usage code as a fallback mapping · b2aff84f
      Arpit Singh authored
      We don't yet have a way to determine if a device can actually report a
      usage code. Adding a flag to mark usage code as fallback only mapping.
      
      Bug: 297094448
      Test: atest inputflinger_tests
      Change-Id: I137113d0dc9a1c8abf523b96942486be176d0240
      b2aff84f
  22. Sep 27, 2023
    • Siarhei Vishniakou's avatar
      InputVerifier: only check pointer sources · 2d151ac3
      Siarhei Vishniakou authored
      Check for the source inside InputVerifier. Sources like MOUSE_RELATIVE
      could send ACTION_MOVE events without a prior DOWN event. Verifying such
      streams is tricky, so let's simply skip such events for now.
      
      Also in this CL, add some verifications to the number of pointers inside
      the event.
      
      Bug: 211379801
      Test: enable event verification and run native tests
      Test: atest inputflinger_tests libinput_tests
      Change-Id: I3703ba57af7ede77712b91b7429ac46c0624a616
      2d151ac3
  23. Sep 25, 2023
  24. Sep 23, 2023
  25. Sep 15, 2023
  26. Sep 12, 2023
    • Harry Cutts's avatar
      TouchpadInputMapper: add timer provider · 8c7cb593
      Harry Cutts authored
      Adding a timer provider allows the Gestures library to perform some
      asynchronous tasks, including ones which improve tap-to-click detection.
      
      Bug: 297192727
      Test: set the
            persist.device_config.aconfig_flags.input.com.android.input.flags.enable_gestures_library_timer_provider
            sysprop to true, restart, then make fast tap-to-click gestures
            (where the finger is contacting for fewer than 3 frames) on the
            touchpad, and check they're reported immediately
      Change-Id: Ib9b8dacc71c88b6fd47bdd747f90ef6a44b37cc4
      8c7cb593
  27. Sep 06, 2023
    • Prabir Pradhan's avatar
      Eliminate lambdas from tracing helper macro · 2dac8b8c
      Prabir Pradhan authored
      In the change with ID Ibee1e7dc5021296bdb5871dec59d8d4978fcf0c9,
      we introduced lambdas at the tracing sites so that we could
      conditionally execute the code to generate the tracing string only when
      tracing was enabled. However, it seems like the introduction of the
      lambdas, especially ones that capture everything by reference, have
      added a performance burden, causing ~5% increase in latency in the input
      pipeline.
      
      In this CL, we remove the lambdas from the tracing sites, and instead
      rely on the expression evaluation guarantees of the ternary to ensure
      that the expression to generate the trace message will only be evaluated
      when the condition is true.
      
      Bug: 297462790
      Test: Will evaluate perf metric after submitting
      Change-Id: I69b37551c4b23256c64544e0ddf4b5b39a9403fb
      2dac8b8c
  28. Aug 23, 2023
    • Siarhei Vishniakou's avatar
      Override VelocityTracker strategy for non-differential axes only · ab3eded0
      Siarhei Vishniakou authored
      VelocityTracker may use different strategies, depending on the system
      flags. By default, the behaviour is like this:
      AXIS_X -> lsq2
      AXIS_Y -> lsq2
      AXIS_SCROLL -> impulse
      
      However, if we provide a specific strategy to VT, then things would
      change. The new map would look like this:
      AXIS_X -> provided strategy
      AXIS_Y -> provided strategy
      AXIS_SCROLL -> provided strategy
      
      This works fine if the user specifies "impulse" as the desired strategy,
      because impulse supports all of the axes.
      However, lsq2 only works in non-differential mode.
      
      The combination of "AXIS_SCROLL -> lsq2" is not allowed.
      
      To fix this, we only allow the specified strategy to affect
      non-differential axes.
      
      This is fine, because currently, impulse is the only strategy that can
      work in the differential mode.
      
      To reproduce the issue:
      1. Run `atest VelocityTrackerTest`. Test should pass, because the
         default strategy is being used.
      2. Connect the device to internet
      3. Reboot the device
      4. Run `atest VelocityTrackerTest` again. Test should fail because the
         device would pick up an "lsq2" strategy value and then try to run the
         axis_scroll tests with it.
      
      Bug: 295290374
      Test: atest VelocityTrackerTest
      Change-Id: I702a2a3e58db3ce2e0ff0c33122839a527eebab2
      Merged-In: I702a2a3e58db3ce2e0ff0c33122839a527eebab2
      (cherry picked from commit 8a2e589e)
      ab3eded0
  29. Aug 22, 2023
    • Prabir Pradhan's avatar
      Improve existing InputDispatcher traces · a37bad12
      Prabir Pradhan authored
      Previously, we traced using ATRACE_NAME inside an
      if condition after checking if atrace was enabled. This was so that we
      could avoid the addtional overhead of formatting the trace string when
      there's no ongoing trace.
      
      Since ATRACE_NAME is expected to be scoped trace of the call, doing it
      inside an if condition means the scope of the trace ends immediately
      once we leave the inner scope of the conditional. This essentially makes
      all of our scoped traces point traces.
      
      We get around this by adding a new helper macro ATRACE_NAME_IF that
      takes a lambda that formats the message. This way, we can avoid the
      formatting overhead and ensure the entire scope of the method is traced.
      
      Bug: 210460522
      Test: manual: take a trace with Perfetto
      Change-Id: Ibee1e7dc5021296bdb5871dec59d8d4978fcf0c9
      a37bad12
  30. Aug 21, 2023
    • Cody Heiner's avatar
      Implement Stylus Prediction Metrics · 7543d90b
      Cody Heiner authored
      Fills out the implementation and tests for MotionPredictorMetricsManager.
      
      (main cherry pick: ag/24451072)
      
      Test: atest frameworks/native/libs/input/tests/MotionPredictorMetricsManager_test.cpp
      Test: Manual testing on-device, computed metric values seem reasonable.
      
      Bug: 268245099
      
      Merged-In: Iec18415de9c3070f2b285c5c82f5a5e0ceaaf471
      Change-Id: I0def0dae626adbbe33e1ed90c08b2cae867cde01
      7543d90b
    • Cody Heiner's avatar
      Implement Stylus Prediction Metrics · 52db4741
      Cody Heiner authored
      Fills out the implementation and tests for MotionPredictorMetricsManager.
      
      (Cherry pick of ag/23861881 from udc-qpr-dev)
      
      Test: atest frameworks/native/libs/input/tests/MotionPredictorMetricsManager_test.cpp
      Test: Manual testing on-device, computed metric values seem reasonable.
      
      Bug: 268245099
      Change-Id: Iec18415de9c3070f2b285c5c82f5a5e0ceaaf471
      52db4741
  31. Aug 14, 2023
    • Siarhei Vishniakou's avatar
      Move VelocityTracker strategy consts to aidl · f7436a19
      Siarhei Vishniakou authored
      To ensure Java is in sync with native, move these consts to
      IInputConstants.aidl.
      
      Test: none
      Bug: 295290374
      Change-Id: I616f4e969e5b7ec72263db62f225f85786f5e923
      f7436a19
    • Siarhei Vishniakou's avatar
      Override VelocityTracker strategy for non-differential axes only · 8a2e589e
      Siarhei Vishniakou authored
      VelocityTracker may use different strategies, depending on the system
      flags. By default, the behaviour is like this:
      AXIS_X -> lsq2
      AXIS_Y -> lsq2
      AXIS_SCROLL -> impulse
      
      However, if we provide a specific strategy to VT, then things would
      change. The new map would look like this:
      AXIS_X -> provided strategy
      AXIS_Y -> provided strategy
      AXIS_SCROLL -> provided strategy
      
      This works fine if the user specifies "impulse" as the desired strategy,
      because impulse supports all of the axes.
      However, lsq2 only works in non-differential mode.
      
      The combination of "AXIS_SCROLL -> lsq2" is not allowed.
      
      To fix this, we only allow the specified strategy to affect
      non-differential axes.
      
      This is fine, because currently, impulse is the only strategy that can
      work in the differential mode.
      
      To reproduce the issue:
      1. Run `atest VelocityTrackerTest`. Test should pass, because the
         default strategy is being used.
      2. Connect the device to internet
      3. Reboot the device
      4. Run `atest VelocityTrackerTest` again. Test should fail because the
         device would pick up an "lsq2" strategy value and then try to run the
         axis_scroll tests with it.
      
      Bug: 295290374
      Test: atest VelocityTrackerTest
      Change-Id: I702a2a3e58db3ce2e0ff0c33122839a527eebab2
      8a2e589e
  32. Aug 03, 2023
    • Matt Buckley's avatar
      Add plumbing for ADPF Power Efficiency hint · cc14642e
      Matt Buckley authored
      These patches introduce a new power efficiency mode for hint sessions
      to the public API, and internally expose a new setMode API for hint
      sessions that resembles the setMode API for iPower, to control
      different session operating modes.
      
      This set of patches:
       - Updates the PowerHAL AIDL to version 5, and updates relevant bp files
       - Exposes new setPreferPowerEfficiency(bool enabled) method from the
       SDK and NDK
       - Exposes new setMode(int mode, bool enabled) method from PowerHAL AIDL
       and HintManagerService
       - Adds support for new setMode call in PowerHAL
      
      Bug: b/288117936
      Test: atest cts/tests/tests/os/src/android/os/cts/PerformanceHintManagerTest.java
      Change-Id: Ib6669238b7e030c0dad2ac89781217515cef3967
      cc14642e
  33. Jul 28, 2023
Loading