Observe frame info from native input code
Before this CL, the java-based FrameObserver was created in ViewRootImpl and acted as a proxy between HardwareRenderer and NativeInputEventReceiver. This caused occasional jank due to garbage collection, because java objects would be created as part of that pipeline. More specifically: 1. The observers are notified from native code 2. The observer is implemented in ViewRootImpl. It's a jni call in order to process the observer's notification. 3. The observer processed the frame stats (input event id, gpu completed time, and present time) and passed it to NativeInputEventReceiver, which is also in native code. So the path used to be: native -> jni -> java (viewRootImpl) -> jni -> native. In this CL, the pipeline is rewired such that the native code is talking directly to native code, without java. Java is only used in order to register the observer. Now, InputEventReceiver creates a FrameMetricsObserver directly in the native code. This observer is then registered through java with HardwareRenderer. The notifications about frame stats are now processed directly in native input code. Bug: 376713684 Test: statsd_testdrive 375 (after overriding SLOW_EVENT_MIN_REPORTING_* constants to 0 locally to force it to report all events). Test: atest InputEventSenderAndReceiverTest Flag: EXEMPT refactor Change-Id: I1aa7df730749c78062398632c3a9abb443507bef
Loading
Please register or sign in to comment