Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3213c965 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Reduce unnecessary invocation of setInputWindowInfo

Usually most fields of InputWindowHandle don't change frequently.
Therefore, only the changed instances need to be updated. That
reduces the overhead of JNI invocation (especially
NativeInputWindowHandle::updateInfo which may be called from
setInputWindowInfo).

There should be no behavior change.

- Add a InputWindowHandle.ChangeDetectionWrapper to wrap the original
  handle. So the changes of its fields can be tracked.
- Make InputApplicationHandle java side immutable. Its content should
  be rarely changed. Then it is easier to compare by instance. This
  might also reduces the race condition of accessing its field from
  InputDispatcher because the instance is different.
- Move some fields that won't change of InputWindowHandle to the
  constructor of WindowState to reduce unnecessary updates.
- When a window cannot receive input, reuse the per-window input
  window handle to populate the disabled info, so there won't be a
  shared instance that its fields always need to be updated.
- Reduce unnecessary Region#translate if the offsets are zero.
- For a simple activity launch, the invocation amount of
  setInputWindowInfo is reduced 90% (from 126 to 11).
- The metrics updateInputWindows_mean of WmPerfTests is reduced 50%+
  (from 0.89ms to 0.38ms on an old mid-end device).

Bug: 168008622
Test: WindowStateTests#testUpdateInputWindowHandle
      WindowInputTests InternalWindowOperationPerfTest
Change-Id: Ief84bbe6e6fa4da5309912059904932ccf775b75
parent f2d1d264
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment