Loading core/java/android/view/InputDevice.java +15 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public final class InputDevice implements Parcelable { private final int mKeyboardType; private final KeyCharacterMap mKeyCharacterMap; private final boolean mHasVibrator; private final boolean mHasButtonUnderPad; private final ArrayList<MotionRange> mMotionRanges = new ArrayList<MotionRange>(); private Vibrator mVibrator; // guarded by mMotionRanges during initialization Loading Loading @@ -343,7 +344,8 @@ public final class InputDevice implements Parcelable { // Called by native code. private InputDevice(int id, int generation, String name, String descriptor, boolean isExternal, int sources, int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator) { int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator, boolean hasButtonUnderPad) { mId = id; mGeneration = generation; mName = name; Loading @@ -353,6 +355,7 @@ public final class InputDevice implements Parcelable { mKeyboardType = keyboardType; mKeyCharacterMap = keyCharacterMap; mHasVibrator = hasVibrator; mHasButtonUnderPad = hasButtonUnderPad; } private InputDevice(Parcel in) { Loading @@ -365,6 +368,7 @@ public final class InputDevice implements Parcelable { mKeyboardType = in.readInt(); mKeyCharacterMap = KeyCharacterMap.CREATOR.createFromParcel(in); mHasVibrator = in.readInt() != 0; mHasButtonUnderPad = in.readInt() != 0; for (;;) { int axis = in.readInt(); Loading Loading @@ -611,6 +615,15 @@ public final class InputDevice implements Parcelable { } } /** * Reports whether the device has a button under its touchpad * @return Whether the device has a button under its touchpad * @hide */ public boolean hasButtonUnderPad() { return mHasButtonUnderPad; } /** * Provides information about the range of values for a particular {@link MotionEvent} axis. * Loading Loading @@ -733,6 +746,7 @@ public final class InputDevice implements Parcelable { out.writeInt(mKeyboardType); mKeyCharacterMap.writeToParcel(out, flags); out.writeInt(mHasVibrator ? 1 : 0); out.writeInt(mHasButtonUnderPad ? 1 : 0); final int numRanges = mMotionRanges.size(); for (int i = 0; i < numRanges; i++) { Loading core/jni/android_view_InputDevice.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi gInputDeviceClassInfo.ctor, deviceInfo.getId(), deviceInfo.getGeneration(), nameObj.get(), descriptorObj.get(), deviceInfo.isExternal(), deviceInfo.getSources(), deviceInfo.getKeyboardType(), kcmObj.get(), deviceInfo.hasVibrator())); kcmObj.get(), deviceInfo.hasVibrator(), deviceInfo.hasButtonUnderPad())); const Vector<InputDeviceInfo::MotionRange>& ranges = deviceInfo.getMotionRanges(); for (size_t i = 0; i < ranges.size(); i++) { Loading Loading @@ -86,8 +86,8 @@ int register_android_view_InputDevice(JNIEnv* env) FIND_CLASS(gInputDeviceClassInfo.clazz, "android/view/InputDevice"); gInputDeviceClassInfo.clazz = jclass(env->NewGlobalRef(gInputDeviceClassInfo.clazz)); GET_METHOD_ID(gInputDeviceClassInfo.ctor, gInputDeviceClassInfo.clazz, "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;Z)V"); GET_METHOD_ID(gInputDeviceClassInfo.ctor, gInputDeviceClassInfo.clazz, "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;ZZ)V"); GET_METHOD_ID(gInputDeviceClassInfo.addMotionRange, gInputDeviceClassInfo.clazz, "addMotionRange", "(IIFFFFF)V"); Loading services/input/InputReader.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2631,6 +2631,7 @@ void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) { info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_4, mSource, y.min, y.max, y.flat, y.fuzz, y.resolution); } info->setButtonUnderPad(mParameters.hasButtonUnderPad); } } Loading Loading @@ -2796,6 +2797,9 @@ void TouchInputMapper::configureParameters() { mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER; } mParameters.hasButtonUnderPad= getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_BUTTONPAD); String8 deviceTypeString; if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"), deviceTypeString)) { Loading services/input/InputReader.h +1 −0 Original line number Diff line number Diff line Loading @@ -1205,6 +1205,7 @@ protected: bool hasAssociatedDisplay; bool associatedDisplayIsExternal; bool orientationAware; bool hasButtonUnderPad; enum GestureMode { GESTURE_MODE_POINTER, Loading Loading
core/java/android/view/InputDevice.java +15 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public final class InputDevice implements Parcelable { private final int mKeyboardType; private final KeyCharacterMap mKeyCharacterMap; private final boolean mHasVibrator; private final boolean mHasButtonUnderPad; private final ArrayList<MotionRange> mMotionRanges = new ArrayList<MotionRange>(); private Vibrator mVibrator; // guarded by mMotionRanges during initialization Loading Loading @@ -343,7 +344,8 @@ public final class InputDevice implements Parcelable { // Called by native code. private InputDevice(int id, int generation, String name, String descriptor, boolean isExternal, int sources, int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator) { int keyboardType, KeyCharacterMap keyCharacterMap, boolean hasVibrator, boolean hasButtonUnderPad) { mId = id; mGeneration = generation; mName = name; Loading @@ -353,6 +355,7 @@ public final class InputDevice implements Parcelable { mKeyboardType = keyboardType; mKeyCharacterMap = keyCharacterMap; mHasVibrator = hasVibrator; mHasButtonUnderPad = hasButtonUnderPad; } private InputDevice(Parcel in) { Loading @@ -365,6 +368,7 @@ public final class InputDevice implements Parcelable { mKeyboardType = in.readInt(); mKeyCharacterMap = KeyCharacterMap.CREATOR.createFromParcel(in); mHasVibrator = in.readInt() != 0; mHasButtonUnderPad = in.readInt() != 0; for (;;) { int axis = in.readInt(); Loading Loading @@ -611,6 +615,15 @@ public final class InputDevice implements Parcelable { } } /** * Reports whether the device has a button under its touchpad * @return Whether the device has a button under its touchpad * @hide */ public boolean hasButtonUnderPad() { return mHasButtonUnderPad; } /** * Provides information about the range of values for a particular {@link MotionEvent} axis. * Loading Loading @@ -733,6 +746,7 @@ public final class InputDevice implements Parcelable { out.writeInt(mKeyboardType); mKeyCharacterMap.writeToParcel(out, flags); out.writeInt(mHasVibrator ? 1 : 0); out.writeInt(mHasButtonUnderPad ? 1 : 0); final int numRanges = mMotionRanges.size(); for (int i = 0; i < numRanges; i++) { Loading
core/jni/android_view_InputDevice.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi gInputDeviceClassInfo.ctor, deviceInfo.getId(), deviceInfo.getGeneration(), nameObj.get(), descriptorObj.get(), deviceInfo.isExternal(), deviceInfo.getSources(), deviceInfo.getKeyboardType(), kcmObj.get(), deviceInfo.hasVibrator())); kcmObj.get(), deviceInfo.hasVibrator(), deviceInfo.hasButtonUnderPad())); const Vector<InputDeviceInfo::MotionRange>& ranges = deviceInfo.getMotionRanges(); for (size_t i = 0; i < ranges.size(); i++) { Loading Loading @@ -86,8 +86,8 @@ int register_android_view_InputDevice(JNIEnv* env) FIND_CLASS(gInputDeviceClassInfo.clazz, "android/view/InputDevice"); gInputDeviceClassInfo.clazz = jclass(env->NewGlobalRef(gInputDeviceClassInfo.clazz)); GET_METHOD_ID(gInputDeviceClassInfo.ctor, gInputDeviceClassInfo.clazz, "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;Z)V"); GET_METHOD_ID(gInputDeviceClassInfo.ctor, gInputDeviceClassInfo.clazz, "<init>", "(IILjava/lang/String;Ljava/lang/String;ZIILandroid/view/KeyCharacterMap;ZZ)V"); GET_METHOD_ID(gInputDeviceClassInfo.addMotionRange, gInputDeviceClassInfo.clazz, "addMotionRange", "(IIFFFFF)V"); Loading
services/input/InputReader.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2631,6 +2631,7 @@ void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) { info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_4, mSource, y.min, y.max, y.flat, y.fuzz, y.resolution); } info->setButtonUnderPad(mParameters.hasButtonUnderPad); } } Loading Loading @@ -2796,6 +2797,9 @@ void TouchInputMapper::configureParameters() { mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER; } mParameters.hasButtonUnderPad= getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_BUTTONPAD); String8 deviceTypeString; if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"), deviceTypeString)) { Loading
services/input/InputReader.h +1 −0 Original line number Diff line number Diff line Loading @@ -1205,6 +1205,7 @@ protected: bool hasAssociatedDisplay; bool associatedDisplayIsExternal; bool orientationAware; bool hasButtonUnderPad; enum GestureMode { GESTURE_MODE_POINTER, Loading