diff options
author | 2024-03-11 17:47:19 -0700 | |
---|---|---|
committer | 2024-03-18 22:07:29 +0000 | |
commit | f49bc7438d79a10e5a1800b1e147ecffb22935e1 (patch) | |
tree | 943116ef4c20f8a31770e8e38c42cf6c3e427724 | |
parent | a080e37010de88182839a4d9a66a15aa46bb38f0 (diff) |
Stylus Metrics: Switch to non-bootstrap statslog library
Now that libinput is no longer run in a bootstrap process,
we can switch the stats logging library to the standard
version. This version is host supported, so we now also
remove the `#ifdef __ANDROID__` include guards.
Test: m checkinput
Test: flash to device, run `statsd_testdrive 718`, then
trigger stylus prediction → reported metrics are present
and reasonable
Bug: 311066949
Change-Id: I04e6f6906e556f4f5a71b711c6ef29d8aa6f3501
-rw-r--r-- | libs/input/Android.bp | 49 | ||||
-rw-r--r-- | libs/input/MotionPredictorMetricsManager.cpp | 33 | ||||
-rw-r--r-- | libs/input/tests/Android.bp | 9 |
3 files changed, 15 insertions, 76 deletions
diff --git a/libs/input/Android.bp b/libs/input/Android.bp index 3278c23b6f..5e38bdc493 100644 --- a/libs/input/Android.bp +++ b/libs/input/Android.bp @@ -248,6 +248,7 @@ cc_library { "libcutils", "liblog", "libPlatformProperties", + "libstatslog", "libtinyxml2", "libutils", "libz", // needed by libkernelconfigs @@ -288,17 +289,6 @@ cc_library { target: { android: { - export_shared_lib_headers: ["libbinder"], - - shared_libs: [ - "libutils", - "libbinder", - // Stats logging library and its dependencies. - "libstatslog_libinput", - "libstatsbootstrap", - "android.os.statsbootstrap_aidl-cpp", - ], - required: [ "motion_predictor_model_prebuilt", "motion_predictor_model_config", @@ -313,43 +303,6 @@ cc_library { }, } -// Use bootstrap version of stats logging library. -// libinput is a bootstrap process (starts early in the boot process), and thus can't use the normal -// `libstatslog` because that requires `libstatssocket`, which is only available later in the boot. -cc_library { - name: "libstatslog_libinput", - generated_sources: ["statslog_libinput.cpp"], - generated_headers: ["statslog_libinput.h"], - export_generated_headers: ["statslog_libinput.h"], - shared_libs: [ - "libbinder", - "libstatsbootstrap", - "libutils", - "android.os.statsbootstrap_aidl-cpp", - ], -} - -genrule { - name: "statslog_libinput.h", - tools: ["stats-log-api-gen"], - cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_libinput.h --module libinput" + - " --namespace android,stats,libinput --bootstrap", - out: [ - "statslog_libinput.h", - ], -} - -genrule { - name: "statslog_libinput.cpp", - tools: ["stats-log-api-gen"], - cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_libinput.cpp --module libinput" + - " --namespace android,stats,libinput --importHeader statslog_libinput.h" + - " --bootstrap", - out: [ - "statslog_libinput.cpp", - ], -} - cc_defaults { name: "libinput_fuzz_defaults", cpp_std: "c++20", diff --git a/libs/input/MotionPredictorMetricsManager.cpp b/libs/input/MotionPredictorMetricsManager.cpp index 6872af2aa5..149a36ee31 100644 --- a/libs/input/MotionPredictorMetricsManager.cpp +++ b/libs/input/MotionPredictorMetricsManager.cpp @@ -21,14 +21,11 @@ #include <algorithm> #include <android-base/logging.h> +#include <statslog.h> #include "Eigen/Core" #include "Eigen/Geometry" -#ifdef __ANDROID__ -#include <statslog_libinput.h> -#endif - namespace android { namespace { @@ -48,22 +45,18 @@ inline constexpr float PATH_LENGTH_EPSILON = 0.001; void MotionPredictorMetricsManager::defaultReportAtomFunction( const MotionPredictorMetricsManager::AtomFields& atomFields) { - // Call stats_write logging function only on Android targets (not supported on host). -#ifdef __ANDROID__ - android::stats::libinput:: - stats_write(android::stats::libinput::STYLUS_PREDICTION_METRICS_REPORTED, - /*stylus_vendor_id=*/0, - /*stylus_product_id=*/0, - atomFields.deltaTimeBucketMilliseconds, - atomFields.alongTrajectoryErrorMeanMillipixels, - atomFields.alongTrajectoryErrorStdMillipixels, - atomFields.offTrajectoryRmseMillipixels, - atomFields.pressureRmseMilliunits, - atomFields.highVelocityAlongTrajectoryRmse, - atomFields.highVelocityOffTrajectoryRmse, - atomFields.scaleInvariantAlongTrajectoryRmse, - atomFields.scaleInvariantOffTrajectoryRmse); -#endif + android::util::stats_write(android::util::STYLUS_PREDICTION_METRICS_REPORTED, + /*stylus_vendor_id=*/0, + /*stylus_product_id=*/0, + atomFields.deltaTimeBucketMilliseconds, + atomFields.alongTrajectoryErrorMeanMillipixels, + atomFields.alongTrajectoryErrorStdMillipixels, + atomFields.offTrajectoryRmseMillipixels, + atomFields.pressureRmseMilliunits, + atomFields.highVelocityAlongTrajectoryRmse, + atomFields.highVelocityOffTrajectoryRmse, + atomFields.scaleInvariantAlongTrajectoryRmse, + atomFields.scaleInvariantOffTrajectoryRmse); } MotionPredictorMetricsManager::MotionPredictorMetricsManager( diff --git a/libs/input/tests/Android.bp b/libs/input/tests/Android.bp index e67a65a114..1144f4d861 100644 --- a/libs/input/tests/Android.bp +++ b/libs/input/tests/Android.bp @@ -64,6 +64,7 @@ cc_test { "libcutils", "liblog", "libPlatformProperties", + "libstatslog", "libtinyxml2", "libutils", "server_configurable_flags", @@ -82,14 +83,6 @@ cc_test { address: true, }, }, - android: { - static_libs: [ - // Stats logging library and its dependencies. - "libstatslog_libinput", - "libstatsbootstrap", - "android.os.statsbootstrap_aidl-cpp", - ], - }, }, } |