Extract HID usage accumulation logic from KeyboardInputMapper
Extract the logic into a HidUsageAccumulator class so that when HID
usage is used in more than one place, the usage code accumulation logic
maintains the same behavior.
There should be no behavior change in this CL.
Bug: 246394583
Test: atest inputflinger_tests
Change-Id: Ia5f9bcac145f07c0d0dca643755dcff1b725d568
diff --git a/services/inputflinger/reader/mapper/KeyboardInputMapper.h b/services/inputflinger/reader/mapper/KeyboardInputMapper.h
index 3dd570d..11d5ad2 100644
--- a/services/inputflinger/reader/mapper/KeyboardInputMapper.h
+++ b/services/inputflinger/reader/mapper/KeyboardInputMapper.h
@@ -16,6 +16,7 @@
#pragma once
+#include "HidUsageAccumulator.h"
#include "InputMapper.h"
namespace android {
@@ -61,7 +62,7 @@
std::vector<KeyDown> mKeyDowns{}; // keys that are down
int32_t mMetaState{};
- int32_t mCurrentHidUsage{}; // most recent HID usage seen this packet, or 0 if none
+ HidUsageAccumulator mHidUsageAccumulator;
struct LedState {
bool avail{}; // led is available