Cache flag value to prevent performance regressions
Cache the value of the enable_per_device_input_latency_metrics flag
to prevent performace regressions.
Bug: 369812450
Test: atest inputflinger_tests
Flag: com.android.input.flags.enable_per_device_input_latency_metrics
Change-Id: I7afc2eb5ce25ae4be12bcb836f8645f1168b9e94
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index d90b9de..24e36ae 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -16,6 +16,8 @@
#pragma once
+#include <com_android_input_flags.h>
+
#include "AnrTracker.h"
#include "CancelationOptions.h"
#include "DragState.h"
@@ -741,6 +743,10 @@
sp<android::gui::WindowInfoHandle> findWallpaperWindowBelow(
const sp<android::gui::WindowInfoHandle>& windowHandle) const REQUIRES(mLock);
+
+ /** Stores the value of the input flag for per device input latency metrics. */
+ const bool mPerDeviceInputLatencyMetricsFlag =
+ com::android::input::flags::enable_per_device_input_latency_metrics();
};
} // namespace android::inputdispatcher