Files
Siarhei Vishniakou 7524d2f24e Observe frame info from native input code - try 3
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 on the render thread.

This reverts commit c4102c3963.

Reason for revert: stop calling 'dispose' when bad metrics are received

Test: atest InputEventSenderAndReceiverTest
Bug: 418774803
Bug: 376713684
Bug: 419468066
Change-Id: I77401257ce6e6bdff1977526f8589661217b0908
2025-06-18 16:57:55 -07:00

48 lines
1.2 KiB
Plaintext

// Copyright 2025 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package {
default_team: "trendy_team_input_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_library_shared {
name: "libinputtests_jni",
host_supported: true,
srcs: [
"inputtests_jni.cpp",
],
defaults: [
"inputflinger_defaults",
],
header_libs: [
"libhwui_internal_headers",
],
shared_libs: [
"inputtests_aidl-ndk",
"libbinder_ndk",
"libinput",
"liblog",
"libutils",
],
}
aidl_interface {
name: "inputtests_aidl",
srcs: ["com/android/test/input/IInputTests.aidl"],
unstable: true,
host_supported: true,
}