Loading services/inputflinger/reader/InputDevice.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -277,7 +277,11 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when, const InputReaderConf mHasMic = mClasses.test(InputDeviceClass::MIC); if (!isIgnored()) { if (!changes) { // first time only // Full configuration should happen the first time configure is called // and when the device type is changed. Changing a device type can // affect various other parameters so should result in a // reconfiguration. if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_TYPE)) { mConfiguration.clear(); for_each_subdevice([this](InputDeviceContext& context) { PropertyMap configuration; Loading services/inputflinger/reader/mapper/TouchInputMapper.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -293,7 +293,10 @@ std::list<NotifyArgs> TouchInputMapper::configure(nsecs_t when, mConfig = *config; if (!changes) { // first time only // Full configuration should happen the first time configure is called and // when the device type is changed. Changing a device type can affect // various other parameters so should result in a reconfiguration. if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_TYPE)) { // Configure basic parameters. configureParameters(); Loading Loading @@ -328,7 +331,8 @@ std::list<NotifyArgs> TouchInputMapper::configure(nsecs_t when, InputReaderConfiguration::CHANGE_POINTER_CAPTURE | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT | InputReaderConfiguration::CHANGE_SHOW_TOUCHES | InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE))) { InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE | InputReaderConfiguration::CHANGE_DEVICE_TYPE))) { // Configure device sources, display dimensions, orientation and // scaling factors. configureInputDevice(when, &resetNeeded); Loading services/inputflinger/tests/InputMapperTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ std::list<NotifyArgs> InputMapperTest::configureDevice(uint32_t changes) { if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO | InputReaderConfiguration::CHANGE_POINTER_CAPTURE))) { InputReaderConfiguration::CHANGE_POINTER_CAPTURE | InputReaderConfiguration::CHANGE_DEVICE_TYPE))) { mReader->requestRefreshConfiguration(changes); mReader->loopOnce(); } Loading services/inputflinger/tests/InputReader_test.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -6724,6 +6724,29 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenConfigDisabled_ShouldNotShowDirec ASSERT_FALSE(fakePointerController->isPointerShown()); } TEST_F(SingleTouchInputMapperTest, WhenDeviceTypeIsChangedToTouchNavigation_updatesDeviceType) { // Initialize the device without setting device source to touch navigation. addConfigurationProperty("touch.deviceType", "touchScreen"); prepareDisplay(ui::ROTATION_0); prepareButtons(); prepareAxes(POSITION); SingleTouchInputMapper& mapper = addMapperAndConfigure<SingleTouchInputMapper>(); // Ensure that the device is created as a touchscreen, not touch navigation. ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, mapper.getSources()); // Add device type association after the device was created. mFakePolicy->addDeviceTypeAssociation(DEVICE_LOCATION, "touchNavigation"); // Send update to the mapper. std::list<NotifyArgs> unused2 = mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), InputReaderConfiguration::CHANGE_DEVICE_TYPE /*changes*/); // Check whether device type update was successful. ASSERT_EQ(AINPUT_SOURCE_TOUCH_NAVIGATION, mDevice->getSources()); } // --- TouchDisplayProjectionTest --- class TouchDisplayProjectionTest : public SingleTouchInputMapperTest { Loading Loading
services/inputflinger/reader/InputDevice.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -277,7 +277,11 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when, const InputReaderConf mHasMic = mClasses.test(InputDeviceClass::MIC); if (!isIgnored()) { if (!changes) { // first time only // Full configuration should happen the first time configure is called // and when the device type is changed. Changing a device type can // affect various other parameters so should result in a // reconfiguration. if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_TYPE)) { mConfiguration.clear(); for_each_subdevice([this](InputDeviceContext& context) { PropertyMap configuration; Loading
services/inputflinger/reader/mapper/TouchInputMapper.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -293,7 +293,10 @@ std::list<NotifyArgs> TouchInputMapper::configure(nsecs_t when, mConfig = *config; if (!changes) { // first time only // Full configuration should happen the first time configure is called and // when the device type is changed. Changing a device type can affect // various other parameters so should result in a reconfiguration. if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_TYPE)) { // Configure basic parameters. configureParameters(); Loading Loading @@ -328,7 +331,8 @@ std::list<NotifyArgs> TouchInputMapper::configure(nsecs_t when, InputReaderConfiguration::CHANGE_POINTER_CAPTURE | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT | InputReaderConfiguration::CHANGE_SHOW_TOUCHES | InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE))) { InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE | InputReaderConfiguration::CHANGE_DEVICE_TYPE))) { // Configure device sources, display dimensions, orientation and // scaling factors. configureInputDevice(when, &resetNeeded); Loading
services/inputflinger/tests/InputMapperTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,8 @@ std::list<NotifyArgs> InputMapperTest::configureDevice(uint32_t changes) { if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO | InputReaderConfiguration::CHANGE_POINTER_CAPTURE))) { InputReaderConfiguration::CHANGE_POINTER_CAPTURE | InputReaderConfiguration::CHANGE_DEVICE_TYPE))) { mReader->requestRefreshConfiguration(changes); mReader->loopOnce(); } Loading
services/inputflinger/tests/InputReader_test.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -6724,6 +6724,29 @@ TEST_F(SingleTouchInputMapperTest, Process_WhenConfigDisabled_ShouldNotShowDirec ASSERT_FALSE(fakePointerController->isPointerShown()); } TEST_F(SingleTouchInputMapperTest, WhenDeviceTypeIsChangedToTouchNavigation_updatesDeviceType) { // Initialize the device without setting device source to touch navigation. addConfigurationProperty("touch.deviceType", "touchScreen"); prepareDisplay(ui::ROTATION_0); prepareButtons(); prepareAxes(POSITION); SingleTouchInputMapper& mapper = addMapperAndConfigure<SingleTouchInputMapper>(); // Ensure that the device is created as a touchscreen, not touch navigation. ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, mapper.getSources()); // Add device type association after the device was created. mFakePolicy->addDeviceTypeAssociation(DEVICE_LOCATION, "touchNavigation"); // Send update to the mapper. std::list<NotifyArgs> unused2 = mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), InputReaderConfiguration::CHANGE_DEVICE_TYPE /*changes*/); // Check whether device type update was successful. ASSERT_EQ(AINPUT_SOURCE_TOUCH_NAVIGATION, mDevice->getSources()); } // --- TouchDisplayProjectionTest --- class TouchDisplayProjectionTest : public SingleTouchInputMapperTest { Loading