Merge "Fix comparison of device source bits." into jb-dev

This commit is contained in:
Jeff Brown
2012-05-30 15:00:39 -07:00
committed by Android (Google) Code Review
3 changed files with 17 additions and 10 deletions

View File

@@ -458,6 +458,18 @@ public final class InputDevice implements Parcelable {
return mIsExternal;
}
/**
* 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.

View File

@@ -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;

View File

@@ -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;