Rename InputClassifier to InputProcessor
The InputClassifier stage now calls a HAL that was renamed to
IInputProcessor. Let's rename the input stage accordingly.
Bug: 210158587
Test: atest inputflinger_tests
Change-Id: Id1a4f01b07b404064917acd0beb04b839abb2929
diff --git a/services/inputflinger/tests/Android.bp b/services/inputflinger/tests/Android.bp
index 76a7c19..6da2145 100644
--- a/services/inputflinger/tests/Android.bp
+++ b/services/inputflinger/tests/Android.bp
@@ -41,8 +41,8 @@
"EventHub_test.cpp",
"FocusResolver_test.cpp",
"IInputFlingerQuery.aidl",
- "InputClassifier_test.cpp",
- "InputClassifierConverter_test.cpp",
+ "InputProcessor_test.cpp",
+ "InputProcessorConverter_test.cpp",
"InputDispatcher_test.cpp",
"InputReader_test.cpp",
"InputFlingerService_test.cpp",
diff --git a/services/inputflinger/tests/InputClassifierConverter_test.cpp b/services/inputflinger/tests/InputProcessorConverter_test.cpp
similarity index 93%
rename from services/inputflinger/tests/InputClassifierConverter_test.cpp
rename to services/inputflinger/tests/InputProcessorConverter_test.cpp
index 81ef9b9..040c8da 100644
--- a/services/inputflinger/tests/InputClassifierConverter_test.cpp
+++ b/services/inputflinger/tests/InputProcessorConverter_test.cpp
@@ -24,7 +24,7 @@
namespace android {
-// --- InputClassifierConverterTest ---
+// --- InputProcessorConverterTest ---
static NotifyMotionArgs generateBasicMotionArgs() {
// Create a basic motion event for testing
@@ -52,7 +52,7 @@
static float getMotionEventAxis(common::PointerCoords coords, common::Axis axis) {
uint32_t index = BitSet64::getIndexOfBit(static_cast<uint64_t>(coords.bits),
- static_cast<uint64_t>(axis));
+ static_cast<uint64_t>(axis));
return coords.values[index];
}
@@ -60,7 +60,7 @@
* Check that coordinates get converted properly from the framework's PointerCoords
* to the hidl PointerCoords in input::common.
*/
-TEST(InputClassifierConverterTest, PointerCoordsAxes) {
+TEST(InputProcessorConverterTest, PointerCoordsAxes) {
const NotifyMotionArgs motionArgs = generateBasicMotionArgs();
ASSERT_EQ(1, motionArgs.pointerCoords[0].getX());
ASSERT_EQ(2, motionArgs.pointerCoords[0].getY());
@@ -76,7 +76,7 @@
ASSERT_EQ(getMotionEventAxis(motionEvent.pointerCoords[0], common::Axis::SIZE),
motionArgs.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_SIZE));
ASSERT_EQ(BitSet64::count(motionArgs.pointerCoords[0].bits),
- BitSet64::count(motionEvent.pointerCoords[0].bits));
+ BitSet64::count(motionEvent.pointerCoords[0].bits));
}
} // namespace android
diff --git a/services/inputflinger/tests/InputClassifier_test.cpp b/services/inputflinger/tests/InputProcessor_test.cpp
similarity index 75%
rename from services/inputflinger/tests/InputClassifier_test.cpp
rename to services/inputflinger/tests/InputProcessor_test.cpp
index 3a77127..380001c 100644
--- a/services/inputflinger/tests/InputClassifier_test.cpp
+++ b/services/inputflinger/tests/InputProcessor_test.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "../InputClassifier.h"
+#include "../InputProcessor.h"
#include <gtest/gtest.h>
#include <gui/constants.h>
@@ -31,7 +31,7 @@
namespace android {
-// --- InputClassifierTest ---
+// --- InputProcessorTest ---
static NotifyMotionArgs generateBasicMotionArgs() {
// Create a basic motion event for testing
@@ -56,105 +56,104 @@
return motionArgs;
}
-class InputClassifierTest : public testing::Test {
+class InputProcessorTest : public testing::Test {
protected:
TestInputListener mTestListener;
- std::unique_ptr<InputClassifierInterface> mClassifier;
+ std::unique_ptr<InputProcessorInterface> mProcessor;
- void SetUp() override { mClassifier = std::make_unique<InputClassifier>(mTestListener); }
+ void SetUp() override { mProcessor = std::make_unique<InputProcessor>(mTestListener); }
};
/**
- * Create a basic configuration change and send it to input classifier.
+ * Create a basic configuration change and send it to input processor.
* Expect that the event is received by the next input stage, unmodified.
*/
-TEST_F(InputClassifierTest, SendToNextStage_NotifyConfigurationChangedArgs) {
- // Create a basic configuration change and send to classifier
- NotifyConfigurationChangedArgs args(1/*sequenceNum*/, 2/*eventTime*/);
+TEST_F(InputProcessorTest, SendToNextStage_NotifyConfigurationChangedArgs) {
+ // Create a basic configuration change and send to processor
+ NotifyConfigurationChangedArgs args(1 /*sequenceNum*/, 2 /*eventTime*/);
- mClassifier->notifyConfigurationChanged(&args);
+ mProcessor->notifyConfigurationChanged(&args);
NotifyConfigurationChangedArgs outArgs;
ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyConfigurationChangedWasCalled(&outArgs));
ASSERT_EQ(args, outArgs);
}
-TEST_F(InputClassifierTest, SendToNextStage_NotifyKeyArgs) {
- // Create a basic key event and send to classifier
+TEST_F(InputProcessorTest, SendToNextStage_NotifyKeyArgs) {
+ // Create a basic key event and send to processor
NotifyKeyArgs args(1 /*sequenceNum*/, 2 /*eventTime*/, 21 /*readTime*/, 3 /*deviceId*/,
AINPUT_SOURCE_KEYBOARD, ADISPLAY_ID_DEFAULT, 0 /*policyFlags*/,
AKEY_EVENT_ACTION_DOWN, 4 /*flags*/, AKEYCODE_HOME, 5 /*scanCode*/,
AMETA_NONE, 6 /*downTime*/);
- mClassifier->notifyKey(&args);
+ mProcessor->notifyKey(&args);
NotifyKeyArgs outArgs;
ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyKeyWasCalled(&outArgs));
ASSERT_EQ(args, outArgs);
}
-
/**
- * Create a basic motion event and send it to input classifier.
+ * Create a basic motion event and send it to input processor.
* Expect that the event is received by the next input stage, unmodified.
*/
-TEST_F(InputClassifierTest, SendToNextStage_NotifyMotionArgs) {
+TEST_F(InputProcessorTest, SendToNextStage_NotifyMotionArgs) {
NotifyMotionArgs motionArgs = generateBasicMotionArgs();
- mClassifier->notifyMotion(&motionArgs);
+ mProcessor->notifyMotion(&motionArgs);
NotifyMotionArgs args;
ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyMotionWasCalled(&args));
ASSERT_EQ(motionArgs, args);
}
/**
- * Create a basic switch event and send it to input classifier.
+ * Create a basic switch event and send it to input processor.
* Expect that the event is received by the next input stage, unmodified.
*/
-TEST_F(InputClassifierTest, SendToNextStage_NotifySwitchArgs) {
- NotifySwitchArgs args(1/*sequenceNum*/, 2/*eventTime*/, 3/*policyFlags*/, 4/*switchValues*/,
- 5/*switchMask*/);
+TEST_F(InputProcessorTest, SendToNextStage_NotifySwitchArgs) {
+ NotifySwitchArgs args(1 /*sequenceNum*/, 2 /*eventTime*/, 3 /*policyFlags*/, 4 /*switchValues*/,
+ 5 /*switchMask*/);
- mClassifier->notifySwitch(&args);
+ mProcessor->notifySwitch(&args);
NotifySwitchArgs outArgs;
ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifySwitchWasCalled(&outArgs));
ASSERT_EQ(args, outArgs);
}
/**
- * Create a basic device reset event and send it to input classifier.
+ * Create a basic device reset event and send it to input processor.
* Expect that the event is received by the next input stage, unmodified.
*/
-TEST_F(InputClassifierTest, SendToNextStage_NotifyDeviceResetArgs) {
- NotifyDeviceResetArgs args(1/*sequenceNum*/, 2/*eventTime*/, 3/*deviceId*/);
+TEST_F(InputProcessorTest, SendToNextStage_NotifyDeviceResetArgs) {
+ NotifyDeviceResetArgs args(1 /*sequenceNum*/, 2 /*eventTime*/, 3 /*deviceId*/);
- mClassifier->notifyDeviceReset(&args);
+ mProcessor->notifyDeviceReset(&args);
NotifyDeviceResetArgs outArgs;
ASSERT_NO_FATAL_FAILURE(mTestListener.assertNotifyDeviceResetWasCalled(&outArgs));
ASSERT_EQ(args, outArgs);
}
-TEST_F(InputClassifierTest, SetMotionClassifier_Enabled) {
- mClassifier->setMotionClassifierEnabled(true);
+TEST_F(InputProcessorTest, SetMotionClassifier_Enabled) {
+ mProcessor->setMotionClassifierEnabled(true);
}
-TEST_F(InputClassifierTest, SetMotionClassifier_Disabled) {
- mClassifier->setMotionClassifierEnabled(false);
+TEST_F(InputProcessorTest, SetMotionClassifier_Disabled) {
+ mProcessor->setMotionClassifierEnabled(false);
}
/**
* Try to break it by calling setMotionClassifierEnabled multiple times.
*/
-TEST_F(InputClassifierTest, SetMotionClassifier_Multiple) {
- mClassifier->setMotionClassifierEnabled(true);
- mClassifier->setMotionClassifierEnabled(true);
- mClassifier->setMotionClassifierEnabled(true);
- mClassifier->setMotionClassifierEnabled(false);
- mClassifier->setMotionClassifierEnabled(false);
- mClassifier->setMotionClassifierEnabled(true);
- mClassifier->setMotionClassifierEnabled(true);
- mClassifier->setMotionClassifierEnabled(true);
+TEST_F(InputProcessorTest, SetMotionClassifier_Multiple) {
+ mProcessor->setMotionClassifierEnabled(true);
+ mProcessor->setMotionClassifierEnabled(true);
+ mProcessor->setMotionClassifierEnabled(true);
+ mProcessor->setMotionClassifierEnabled(false);
+ mProcessor->setMotionClassifierEnabled(false);
+ mProcessor->setMotionClassifierEnabled(true);
+ mProcessor->setMotionClassifierEnabled(true);
+ mProcessor->setMotionClassifierEnabled(true);
}
/**
- * A minimal implementation of IInputClassifier.
+ * A minimal implementation of IInputProcessor.
*/
class TestHal : public aidl::android::hardware::input::processor::BnInputProcessor {
::ndk::ScopedAStatus classify(
@@ -212,7 +211,7 @@
NotifyMotionArgs motionArgs = generateBasicMotionArgs();
std::vector<int16_t> videoData = {1, 2, 3, 4};
- timeval timestamp = { 1, 1};
+ timeval timestamp = {1, 1};
TouchVideoFrame frame(2, 2, std::move(videoData), timestamp);
motionArgs.videoFrames = {frame};
@@ -228,11 +227,11 @@
NotifyMotionArgs motionArgs = generateBasicMotionArgs();
std::vector<int16_t> videoData1 = {1, 2, 3, 4};
- timeval timestamp1 = { 1, 1};
+ timeval timestamp1 = {1, 1};
TouchVideoFrame frame1(2, 2, std::move(videoData1), timestamp1);
std::vector<int16_t> videoData2 = {6, 6, 6, 6};
- timeval timestamp2 = { 1, 2};
+ timeval timestamp2 = {1, 2};
TouchVideoFrame frame2(2, 2, std::move(videoData2), timestamp2);
motionArgs.videoFrames = {frame1, frame2};
@@ -253,7 +252,7 @@
* Make sure MotionClassifier does not crash when a device is reset.
*/
TEST_F(MotionClassifierTest, DeviceReset_DoesNotCrash) {
- NotifyDeviceResetArgs args(1/*sequenceNum*/, 2/*eventTime*/, 3/*deviceId*/);
+ NotifyDeviceResetArgs args(1 /*sequenceNum*/, 2 /*eventTime*/, 3 /*deviceId*/);
ASSERT_NO_FATAL_FAILURE(mMotionClassifier->reset(args));
}
diff --git a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
index 8af3871..f2a3964 100644
--- a/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
+++ b/services/inputflinger/tests/UnwantedInteractionBlocker_test.cpp
@@ -405,11 +405,11 @@
};
/**
- * Create a basic configuration change and send it to input classifier.
+ * Create a basic configuration change and send it to input processor.
* Expect that the event is received by the next input stage, unmodified.
*/
TEST_F(UnwantedInteractionBlockerTest, ConfigurationChangedIsPassedToNextListener) {
- // Create a basic configuration change and send to classifier
+ // Create a basic configuration change and send to blocker
NotifyConfigurationChangedArgs args(1 /*sequenceNum*/, 2 /*eventTime*/);
mBlocker->notifyConfigurationChanged(&args);
@@ -423,7 +423,7 @@
* to next stage unmodified.
*/
TEST_F(UnwantedInteractionBlockerTest, KeyIsPassedToNextListener) {
- // Create a basic key event and send to classifier
+ // Create a basic key event and send to blocker
NotifyKeyArgs args(1 /*sequenceNum*/, 2 /*eventTime*/, 21 /*readTime*/, 3 /*deviceId*/,
AINPUT_SOURCE_KEYBOARD, ADISPLAY_ID_DEFAULT, 0 /*policyFlags*/,
AKEY_EVENT_ACTION_DOWN, 4 /*flags*/, AKEYCODE_HOME, 5 /*scanCode*/,