Read pointer choreographer flag at boot
In native code, we are sometimes reading the
enable_pointer_choreographer flag value at boot, and sometimes later
during runtime. Since DeviceConfig flag values can change at runtime,
the flag values loaded later can sometimes change, resulting in an
unexpected state where some code relies on the boot-time value and
others on the "current" value.
While we should have been using read-only flags in the first place, we
cannot convert existing flags to be read-only. So to increase
consistency within native code, change all reads of the
enable_pointer_choreographer flag to happen at boot.
This CL also updates the test to match the change in flagging approach.
Bug: 324534774
Test: Presubmit
Change-Id: I32cd6e52e2df260afd3d7681760a987ed060321a
diff --git a/services/inputflinger/tests/TouchpadInputMapper_test.cpp b/services/inputflinger/tests/TouchpadInputMapper_test.cpp
index fbafbad..a92dce5 100644
--- a/services/inputflinger/tests/TouchpadInputMapper_test.cpp
+++ b/services/inputflinger/tests/TouchpadInputMapper_test.cpp
@@ -117,8 +117,11 @@
return base::ResultError("Axis not supported", NAME_NOT_FOUND);
});
createDevice();
- mMapper = createInputMapper<TouchpadInputMapper>(*mDeviceContext, mReaderConfiguration);
+ mMapper = createInputMapper<TouchpadInputMapper>(*mDeviceContext, mReaderConfiguration,
+ isPointerChoreographerEnabled());
}
+
+ virtual bool isPointerChoreographerEnabled() { return false; }
};
class TouchpadInputMapperTest : public TouchpadInputMapperTestBase {
@@ -182,10 +185,9 @@
class TouchpadInputMapperTestWithChoreographer : public TouchpadInputMapperTestBase {
protected:
- void SetUp() override {
- input_flags::enable_pointer_choreographer(true);
- TouchpadInputMapperTestBase::SetUp();
- }
+ void SetUp() override { TouchpadInputMapperTestBase::SetUp(); }
+
+ bool isPointerChoreographerEnabled() override { return true; }
};
// TODO(b/311416205): De-duplicate the test cases after the refactoring is complete and the flagging