diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-05-30 14:32:16 -0700 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2012-05-30 14:32:16 -0700 |
| commit | 7e4ff4b986d626493afb676dd4824d2b3663260a (patch) | |
| tree | cc5bc8dd1a9c7d41231b687ecf934b4f72677fe4 | |
| parent | fb910e8ffa439bc32234cfbf85c36f1f8c3a9c59 (diff) | |
| download | frameworks_base-7e4ff4b986d626493afb676dd4824d2b3663260a.zip frameworks_base-7e4ff4b986d626493afb676dd4824d2b3663260a.tar.gz frameworks_base-7e4ff4b986d626493afb676dd4824d2b3663260a.tar.bz2 | |
Fix comparison of device source bits.
Bug: 6576743
Change-Id: I6952b052e2ab9e62ddd46ab76f4df37ecc656757
| -rwxr-xr-x | core/java/android/view/InputDevice.java | 12 | ||||
| -rw-r--r-- | services/java/com/android/server/input/InputManagerService.java | 8 | ||||
| -rwxr-xr-x | services/java/com/android/server/wm/WindowManagerService.java | 7 |
3 files changed, 17 insertions, 10 deletions
diff --git a/core/java/android/view/InputDevice.java b/core/java/android/view/InputDevice.java index 2ea0360..3bb9c01 100755 --- a/core/java/android/view/InputDevice.java +++ b/core/java/android/view/InputDevice.java @@ -459,6 +459,18 @@ public final class InputDevice implements Parcelable { } /** + * Returns true if the device is a full keyboard. + * + * @return True if the device is a full keyboard. + * + * @hide + */ + public boolean isFullKeyboard() { + return (mSources & SOURCE_KEYBOARD) == SOURCE_KEYBOARD + && mKeyboardType == KEYBOARD_TYPE_ALPHABETIC; + } + + /** * Gets the name of this input device. * @return The input device name. */ diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java index d85facc..bdd0aa4 100644 --- a/services/java/com/android/server/input/InputManagerService.java +++ b/services/java/com/android/server/input/InputManagerService.java @@ -592,7 +592,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. deviceIdAndGeneration[i * 2] = inputDevice.getId(); deviceIdAndGeneration[i * 2 + 1] = inputDevice.getGeneration(); - if (isFullKeyboard(inputDevice)) { + if (!inputDevice.isVirtual() && inputDevice.isFullKeyboard()) { if (!containsInputDeviceWithDescriptor(oldInputDevices, inputDevice.getDescriptor())) { mTempFullKeyboards.add(numFullKeyboardsAdded++, inputDevice); @@ -695,12 +695,6 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog. reloadKeyboardLayouts(); } - private static boolean isFullKeyboard(InputDevice inputDevice) { - return !inputDevice.isVirtual() - && (inputDevice.getSources() & InputDevice.SOURCE_KEYBOARD) != 0 - && inputDevice.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC; - } - private static boolean containsInputDeviceWithDescriptor(InputDevice[] inputDevices, String descriptor) { final int numDevices = inputDevices.length; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 4ce8c97..10919f2 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -6466,17 +6466,18 @@ public class WindowManagerService extends IWindowManager.Stub WindowManagerPolicy.PRESENCE_INTERNAL; if (mIsTouchDevice) { - if ((sources & InputDevice.SOURCE_TOUCHSCREEN) != 0) { + if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == + InputDevice.SOURCE_TOUCHSCREEN) { config.touchscreen = Configuration.TOUCHSCREEN_FINGER; } } else { config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH; } - if ((sources & InputDevice.SOURCE_TRACKBALL) != 0) { + if ((sources & InputDevice.SOURCE_TRACKBALL) == InputDevice.SOURCE_TRACKBALL) { config.navigation = Configuration.NAVIGATION_TRACKBALL; navigationPresence |= presenceFlag; - } else if ((sources & InputDevice.SOURCE_DPAD) != 0 + } else if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD && config.navigation == Configuration.NAVIGATION_NONAV) { config.navigation = Configuration.NAVIGATION_DPAD; navigationPresence |= presenceFlag; |
