am 9154b877: Merge "Fix comparison of device source bits." into jb-dev
* commit '9154b877807a1222abf46608cdff66428e906328': Fix comparison of device source bits.
This commit is contained in:
@@ -458,6 +458,18 @@ public final class InputDevice implements Parcelable {
|
|||||||
return mIsExternal;
|
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.
|
* Gets the name of this input device.
|
||||||
* @return The input device name.
|
* @return The input device name.
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
|
|||||||
deviceIdAndGeneration[i * 2] = inputDevice.getId();
|
deviceIdAndGeneration[i * 2] = inputDevice.getId();
|
||||||
deviceIdAndGeneration[i * 2 + 1] = inputDevice.getGeneration();
|
deviceIdAndGeneration[i * 2 + 1] = inputDevice.getGeneration();
|
||||||
|
|
||||||
if (isFullKeyboard(inputDevice)) {
|
if (!inputDevice.isVirtual() && inputDevice.isFullKeyboard()) {
|
||||||
if (!containsInputDeviceWithDescriptor(oldInputDevices,
|
if (!containsInputDeviceWithDescriptor(oldInputDevices,
|
||||||
inputDevice.getDescriptor())) {
|
inputDevice.getDescriptor())) {
|
||||||
mTempFullKeyboards.add(numFullKeyboardsAdded++, inputDevice);
|
mTempFullKeyboards.add(numFullKeyboardsAdded++, inputDevice);
|
||||||
@@ -695,12 +695,6 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
|
|||||||
reloadKeyboardLayouts();
|
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,
|
private static boolean containsInputDeviceWithDescriptor(InputDevice[] inputDevices,
|
||||||
String descriptor) {
|
String descriptor) {
|
||||||
final int numDevices = inputDevices.length;
|
final int numDevices = inputDevices.length;
|
||||||
|
|||||||
@@ -6466,17 +6466,18 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
WindowManagerPolicy.PRESENCE_INTERNAL;
|
WindowManagerPolicy.PRESENCE_INTERNAL;
|
||||||
|
|
||||||
if (mIsTouchDevice) {
|
if (mIsTouchDevice) {
|
||||||
if ((sources & InputDevice.SOURCE_TOUCHSCREEN) != 0) {
|
if ((sources & InputDevice.SOURCE_TOUCHSCREEN) ==
|
||||||
|
InputDevice.SOURCE_TOUCHSCREEN) {
|
||||||
config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
|
config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
|
config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sources & InputDevice.SOURCE_TRACKBALL) != 0) {
|
if ((sources & InputDevice.SOURCE_TRACKBALL) == InputDevice.SOURCE_TRACKBALL) {
|
||||||
config.navigation = Configuration.NAVIGATION_TRACKBALL;
|
config.navigation = Configuration.NAVIGATION_TRACKBALL;
|
||||||
navigationPresence |= presenceFlag;
|
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_NONAV) {
|
||||||
config.navigation = Configuration.NAVIGATION_DPAD;
|
config.navigation = Configuration.NAVIGATION_DPAD;
|
||||||
navigationPresence |= presenceFlag;
|
navigationPresence |= presenceFlag;
|
||||||
|
|||||||
Reference in New Issue
Block a user