Merge "Default to TOOL_TYPE_STYLUS for external stylus events."

This commit is contained in:
Michael Wright 2015-04-21 21:46:31 +00:00 committed by Android (Google) Code Review
commit e893dddb3f
1 changed files with 5 additions and 1 deletions

View File

@ -6511,6 +6511,11 @@ void ExternalStylusInputMapper::sync(nsecs_t when) {
mStylusState.when = when;
mStylusState.toolType = mTouchButtonAccumulator.getToolType();
if (mStylusState.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) {
mStylusState.toolType = AMOTION_EVENT_TOOL_TYPE_STYLUS;
}
int32_t pressure = mSingleTouchMotionAccumulator.getAbsolutePressure();
if (mRawPressureAxis.valid) {
mStylusState.pressure = float(pressure) / mRawPressureAxis.maxValue;
@ -6521,7 +6526,6 @@ void ExternalStylusInputMapper::sync(nsecs_t when) {
}
mStylusState.buttons = mTouchButtonAccumulator.getButtonState();
mStylusState.toolType = mTouchButtonAccumulator.getToolType();
mContext->dispatchExternalStylusState(mStylusState);
}