From daa3753a04699724d2cfe824ac1f5a266d643a05 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 1 May 2012 15:54:03 -0700 Subject: Improve handling of built-in keyboard. The window manager policy made some incorrect assumptions about the meaning of the Configuration.keyboard field. We need to be more careful about distinguishing between built-in and external keyboards. Most of this change is to move the determination of the parts of the Configuration related to input devices into the WindowManagerService leveraging new features of the InputManagerService to good effect. Then we plumb through the flag that indicates whether a device is internal or external so that we can be more particular about how the lid switch effects changes to the Configuration. Bug: 6424373 Change-Id: I36a1c22ade35e578955465a25940a33f227b9763 --- services/input/InputReader.cpp | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'services/input/InputReader.cpp') diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index c6b701f..cd6a2ec 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -250,7 +250,6 @@ InputReader::InputReader(const sp& eventHub, refreshConfigurationLocked(0); updateGlobalMetaStateLocked(); - updateInputConfigurationLocked(); } // release lock } @@ -502,9 +501,6 @@ void InputReader::handleConfigurationChangedLocked(nsecs_t when) { // Reset global meta state because it depends on the list of all configured devices. updateGlobalMetaStateLocked(); - // Update input configuration. - updateInputConfigurationLocked(); - // Enqueue configuration changed. NotifyConfigurationChangedArgs args(when); mQueuedListener->notifyConfigurationChanged(&args); @@ -542,36 +538,6 @@ int32_t InputReader::getGlobalMetaStateLocked() { return mGlobalMetaState; } -void InputReader::updateInputConfigurationLocked() { - int32_t touchScreenConfig = InputConfiguration::TOUCHSCREEN_NOTOUCH; - int32_t keyboardConfig = InputConfiguration::KEYBOARD_NOKEYS; - int32_t navigationConfig = InputConfiguration::NAVIGATION_NONAV; - InputDeviceInfo deviceInfo; - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - if (!(device->getClasses() & INPUT_DEVICE_CLASS_VIRTUAL)) { - device->getDeviceInfo(& deviceInfo); - uint32_t sources = deviceInfo.getSources(); - - if ((sources & AINPUT_SOURCE_TOUCHSCREEN) == AINPUT_SOURCE_TOUCHSCREEN) { - touchScreenConfig = InputConfiguration::TOUCHSCREEN_FINGER; - } - if ((sources & AINPUT_SOURCE_TRACKBALL) == AINPUT_SOURCE_TRACKBALL) { - navigationConfig = InputConfiguration::NAVIGATION_TRACKBALL; - } else if ((sources & AINPUT_SOURCE_DPAD) == AINPUT_SOURCE_DPAD) { - navigationConfig = InputConfiguration::NAVIGATION_DPAD; - } - if (deviceInfo.getKeyboardType() == AINPUT_KEYBOARD_TYPE_ALPHABETIC) { - keyboardConfig = InputConfiguration::KEYBOARD_QWERTY; - } - } - } - - mInputConfiguration.touchScreen = touchScreenConfig; - mInputConfiguration.keyboard = keyboardConfig; - mInputConfiguration.navigation = navigationConfig; -} - void InputReader::disableVirtualKeysUntilLocked(nsecs_t time) { mDisableVirtualKeysTimeout = time; } @@ -608,12 +574,6 @@ int32_t InputReader::bumpGenerationLocked() { return ++mGeneration; } -void InputReader::getInputConfiguration(InputConfiguration* outConfiguration) { - AutoMutex _l(mLock); - - *outConfiguration = mInputConfiguration; -} - void InputReader::getInputDevices(Vector& outInputDevices) { AutoMutex _l(mLock); getInputDevicesLocked(outInputDevices); @@ -1049,7 +1009,7 @@ void InputDevice::timeoutExpired(nsecs_t when) { } void InputDevice::getDeviceInfo(InputDeviceInfo* outDeviceInfo) { - outDeviceInfo->initialize(mId, mGeneration, mIdentifier, mAlias); + outDeviceInfo->initialize(mId, mGeneration, mIdentifier, mAlias, mIsExternal); size_t numMappers = mMappers.size(); for (size_t i = 0; i < numMappers; i++) { -- cgit v1.1