最終更新:2013-10-03 (木) 08:54:03 (3830d)
InputReaderConfiguration
Top / InputReaderConfiguration
Input reader configuration.
Specifies various options that modify the behavior of the input reader.
定義
- AOSP/frameworks/base/services/input/InputReader.h
/* * Input reader configuration. * * Specifies various options that modify the behavior of the input reader. */ struct InputReaderConfiguration { // Describes changes that have occurred. enum { // The pointer speed changed. CHANGE_POINTER_SPEED = 1 << 0, // The pointer gesture control changed. CHANGE_POINTER_GESTURE_ENABLEMENT = 1 << 1, // The display size or orientation changed. CHANGE_DISPLAY_INFO = 1 << 2, // The visible touches option changed. CHANGE_SHOW_TOUCHES = 1 << 3, // All devices must be reopened. CHANGE_MUST_REOPEN = 1 << 31, }; // Gets the amount of time to disable virtual keys after the screen is touched // in order to filter out accidental virtual key presses due to swiping gestures // or taps near the edge of the display. May be 0 to disable the feature. nsecs_t virtualKeyQuietTime; // The excluded device names for the platform. // Devices with these names will be ignored. Vector<String8> excludedDeviceNames; // Velocity control parameters for mouse pointer movements. VelocityControlParameters pointerVelocityControlParameters; // Velocity control parameters for mouse wheel movements. VelocityControlParameters wheelVelocityControlParameters; // True if pointer gestures are enabled. bool pointerGesturesEnabled; // Quiet time between certain pointer gesture transitions. // Time to allow for all fingers or buttons to settle into a stable state before // starting a new gesture. nsecs_t pointerGestureQuietInterval; // The minimum speed that a pointer must travel for us to consider switching the active // touch pointer to it during a drag. This threshold is set to avoid switching due // to noise from a finger resting on the touch pad (perhaps just pressing it down). float pointerGestureDragMinSwitchSpeed; // in pixels per second // Tap gesture delay time. // The time between down and up must be less than this to be considered a tap. nsecs_t pointerGestureTapInterval; // Tap drag gesture delay time. // The time between the previous tap's up and the next down must be less than // this to be considered a drag. Otherwise, the previous tap is finished and a // new tap begins. // // Note that the previous tap will be held down for this entire duration so this // interval must be shorter than the long press timeout. nsecs_t pointerGestureTapDragInterval; // The distance in pixels that the pointer is allowed to move from initial down // to up and still be called a tap. float pointerGestureTapSlop; // in pixels // Time after the first touch points go down to settle on an initial centroid. // This is intended to be enough time to handle cases where the user puts down two // fingers at almost but not quite exactly the same time. nsecs_t pointerGestureMultitouchSettleInterval; // The transition from PRESS to SWIPE or FREEFORM gesture mode is made when // at least two pointers have moved at least this far from their starting place. float pointerGestureMultitouchMinDistance; // in pixels // The transition from PRESS to SWIPE gesture mode can only occur when the // cosine of the angle between the two vectors is greater than or equal to than this value // which indicates that the vectors are oriented in the same direction. // When the vectors are oriented in the exactly same direction, the cosine is 1.0. // (In exactly opposite directions, the cosine is -1.0.) float pointerGestureSwipeTransitionAngleCosine; // The transition from PRESS to SWIPE gesture mode can only occur when the // fingers are no more than this far apart relative to the diagonal size of // the touch pad. For example, a ratio of 0.5 means that the fingers must be // no more than half the diagonal size of the touch pad apart. float pointerGestureSwipeMaxWidthRatio; // The gesture movement speed factor relative to the size of the display. // Movement speed applies when the fingers are moving in the same direction. // Without acceleration, a full swipe of the touch pad diagonal in movement mode // will cover this portion of the display diagonal. float pointerGestureMovementSpeedRatio; // The gesture zoom speed factor relative to the size of the display. // Zoom speed applies when the fingers are mostly moving relative to each other // to execute a scale gesture or similar. // Without acceleration, a full swipe of the touch pad diagonal in zoom mode // will cover this portion of the display diagonal. float pointerGestureZoomSpeedRatio; // True to show the location of touches on the touch screen as spots. bool showTouches; InputReaderConfiguration() : virtualKeyQuietTime(0), pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f), wheelVelocityControlParameters(1.0f, 15.0f, 50.0f, 4.0f), pointerGesturesEnabled(true), pointerGestureQuietInterval(100 * 1000000LL), // 100 ms pointerGestureDragMinSwitchSpeed(50), // 50 pixels per second pointerGestureTapInterval(150 * 1000000LL), // 150 ms pointerGestureTapDragInterval(150 * 1000000LL), // 150 ms pointerGestureTapSlop(10.0f), // 10 pixels pointerGestureMultitouchSettleInterval(100 * 1000000LL), // 100 ms pointerGestureMultitouchMinDistance(15), // 15 pixels pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees pointerGestureSwipeMaxWidthRatio(0.25f), pointerGestureMovementSpeedRatio(0.8f), pointerGestureZoomSpeedRatio(0.3f), showTouches(false) { } bool getDisplayInfo(int32_t displayId, bool external, int32_t* width, int32_t* height, int32_t* orientation) const; void setDisplayInfo(int32_t displayId, bool external, int32_t width, int32_t height, int32_t orientation); private: struct DisplayInfo { int32_t width; int32_t height; int32_t orientation; DisplayInfo() : width(-1), height(-1), orientation(DISPLAY_ORIENTATION_0) { } }; DisplayInfo mInternalDisplay; DisplayInfo mExternalDisplay; };
使い所
- public virtual void InputReaderPolicyInterface::getReaderConfiguration(InputReaderConfiguration* outConfig) = 0;
- private InputReaderConfiguration InputReader::mConfig
- public void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes);
読み込む場所
- NativeInputReader?::getReaderConfiguration()
InputReaderConfigurationの各パラメータ取得元
型 フィールド 初期化値 取得元 最終的な値 nsecs_t? virtualKeyQuietTime? 0 com.android.server.wm.InputManager.getVirtualKeyQuietTimeMillis? return mContext.getResources().getInteger(com.android.internal.R.integer.config_virtualKeyQuietTimeMillis?) Vector<String8?> excludedDeviceNames? com.android.server.wm.InputManager.getExcludedDeviceNames? Android/system/etc/excluded-input-devices.xml? VelocityControlParameters? pointerVelocityControlParameters? (1.0f, 500.0f, 3000.0f, 3.0f) scale = mLocked.pointerSpeed VelocityControlParameters? wheelVelocityControlParameters? (1.0f, 15.0f, 50.0f, 4.0f) bool pointerGesturesEnabled? mLocked.pointerGesturesEnabled? true nsecs_t? pointerGestureQuietInterval? (100 * 1000000LL (100ms) float pointerGestureDragMinSwitchSpeed? 50(pps) nsecs_t? pointerGestureTapInterval? 150 * 1000000LL (150ms) com.android.server.wm.InputManager.getHoverTapTimeout? return ViewConfiguration.getHoverTapTimeout?() nsecs_t? pointerGestureTapDragInterval? 150 * 1000000LL (150ms) com.android.server.wm.InputManager.getLongPressTimeout?
com.android.server.wm.InputManager.getDoubleTapTimeout?return ViewConfiguration.getLongPressTimeout?();
return ViewConfiguration.getDoubleTapTimeout?();
max(min(longPressTimeout? - 100, doubleTapTimeout?), hoverTapTimeout?)float pointerGestureTapSlop 10.0f(px) com.android.server.wm.InputManager.getHoverTapSlop return ViewConfiguration.getHoverTapSlop() nsecs_t? pointerGestureMultitouchSettleInterval? 100 * 1000000LL (100ms) float pointerGestureMultitouchMinDistance? 15 (px) float pointerGestureSwipeTransitionAngleCosine? 0.2588f//cosine of 75 degrees float pointerGestureSwipeMaxWidthRatio? 0.25f float pointerGestureMovementSpeedRatio? 0.8f float pointerGestureZoomSpeedRatio? 0.3f bool showTouches? false mLocked.showTouches