blob: a77dfa59fe0598bba23259bd7aa4048b042de005 [file] [log] [blame]
/**
* Copyright (c) 2020, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.os;
/** @hide */
interface IInputConstants
{
// This should be multiplied by the value of the system property ro.hw_timeout_multiplier before
// use. A pre-multiplied constant is available in Java in
// android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS.
const int UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS = 5000; // 5 seconds
// Indicate invalid battery capacity
const int INVALID_BATTERY_CAPACITY = -1;
/**
* Every input event has an id. This constant value is used when a valid input event id is not
* available.
*/
const int INVALID_INPUT_EVENT_ID = 0;
/**
* Every input device has an id. This constant value is used when a valid input device id is not
* available.
* The virtual keyboard uses -1 as the input device id. Therefore, we use -2 as the value for
* an invalid input device.
*/
const int INVALID_INPUT_DEVICE_ID = -2;
/**
* The input event was injected from accessibility. Used in policyFlags for input event
* injection.
*/
const int POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000;
/**
* This flag indicates that the window that received this motion event is partly
* or wholly obscured by another visible window above it and the event directly passed through
* the obscured area.
*
* A security sensitive application can check this flag to identify situations in which
* a malicious application may have covered up part of its content for the purpose
* of misleading the user or hijacking touches. An appropriate response might be
* to drop the suspect touches or to take additional precautions to confirm the user's
* actual intent.
*/
const int MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1;
/**
* This flag indicates that the window that received this motion event is partly
* or wholly obscured by another visible window above it and the event did not directly pass
* through the obscured area.
*
* A security sensitive application can check this flag to identify situations in which
* a malicious application may have covered up part of its content for the purpose
* of misleading the user or hijacking touches. An appropriate response might be
* to drop the suspect touches or to take additional precautions to confirm the user's
* actual intent.
*
* Unlike FLAG_WINDOW_IS_OBSCURED, this is only true if the window that received this event is
* obstructed in areas other than the touched location.
*/
const int MOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2;
/**
* This private flag is only set on {@link #ACTION_HOVER_MOVE} events and indicates that
* this event will be immediately followed by a {@link #ACTION_HOVER_EXIT}. It is used to
* prevent generating redundant {@link #ACTION_HOVER_ENTER} events.
* @hide
*/
const int MOTION_EVENT_FLAG_HOVER_EXIT_PENDING = 0x4;
/**
* This flag indicates that the event has been generated by a gesture generator. It
* provides a hint to the GestureDetector to not apply any touch slop.
*
* @hide
*/
const int MOTION_EVENT_FLAG_IS_GENERATED_GESTURE = 0x8;
/**
* This flag is only set for events with {@link #ACTION_POINTER_UP} and {@link #ACTION_CANCEL}.
* It indicates that the pointer going up was an unintentional user touch. When FLAG_CANCELED
* is set, the typical actions that occur in response for a pointer going up (such as click
* handlers, end of drawing) should be aborted. This flag is typically set when the user was
* accidentally touching the screen, such as by gripping the device, or placing the palm on the
* screen.
*
* @see #ACTION_POINTER_UP
* @see #ACTION_CANCEL
*/
const int INPUT_EVENT_FLAG_CANCELED = 0x20;
/**
* This flag indicates that the event will not cause a focus change if it is directed to an
* unfocused window, even if it an {@link #ACTION_DOWN}. This is typically used with pointer
* gestures to allow the user to direct gestures to an unfocused window without bringing the
* window into focus.
* @hide
*/
const int MOTION_EVENT_FLAG_NO_FOCUS_CHANGE = 0x40;
/**
* This flag indicates that the event has a valid value for AXIS_ORIENTATION.
*
* This is a private flag that is not used in Java.
* @hide
*/
const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_ORIENTATION = 0x80;
/**
* This flag indicates that the pointers' AXIS_ORIENTATION can be used to precisely determine
* the direction in which the tool is pointing. The value of the orientation axis will be in
* the range [-pi, pi], which represents a full circle. This is usually supported by devices
* like styluses.
*
* Conversely, AXIS_ORIENTATION cannot be used to tell which direction the tool is pointing
* when this flag is not set. In this case, the axis value will have a range of [-pi/2, pi/2],
* which represents half a circle. This is usually the case for devices like touchscreens and
* touchpads, for which it is difficult to tell which direction along the major axis of the
* touch ellipse the finger is pointing.
*
* This is a private flag that is not used in Java.
* @hide
*/
const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_DIRECTIONAL_ORIENTATION = 0x100;
/**
* The input event was generated or modified by accessibility service.
* Shared by both KeyEvent and MotionEvent flags, so this value should not overlap with either
* set of flags, including in input/Input.h and in android/input.h.
*/
const int INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800;
/**
* Private flag that indicates when the system has detected that this motion event
* may be inconsistent with respect to the sequence of previously delivered motion events,
* such as when a pointer move event is sent but the pointer is not down.
*
* @hide
* @see #isTainted
* @see #setTainted
*/
const int INPUT_EVENT_FLAG_TAINTED = 0x80000000;
/**
* Private flag indicating that this event was synthesized by the system and should be delivered
* to the accessibility focused view first. When being dispatched such an event is not handled
* by predecessors of the accessibility focused view and after the event reaches that view the
* flag is cleared and normal event dispatch is performed. This ensures that the platform can
* click on any view that has accessibility focus which is semantically equivalent to asking the
* view to perform a click accessibility action but more generic as views not implementing click
* action correctly can still be activated.
*
* @hide
* @see #isTargetAccessibilityFocus()
* @see #setTargetAccessibilityFocus(boolean)
*/
const int MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS = 0x40000000;
/* The default pointer acceleration value. */
const int DEFAULT_POINTER_ACCELERATION = 3;
/**
* Use the default Velocity Tracker Strategy. Different axes may use different default
* strategies.
*/
const int VELOCITY_TRACKER_STRATEGY_DEFAULT = -1;
/**
* Velocity Tracker Strategy: Impulse.
* Physical model of pushing an object. Quality: VERY GOOD.
* Works with duplicate coordinates, unclean finger liftoff.
*/
const int VELOCITY_TRACKER_STRATEGY_IMPULSE = 0;
/**
* Velocity Tracker Strategy: LSQ1.
* 1st order least squares. Quality: POOR.
* Frequently underfits the touch data especially when the finger accelerates
* or changes direction. Often underestimates velocity. The direction
* is overly influenced by historical touch points.
*/
const int VELOCITY_TRACKER_STRATEGY_LSQ1 = 1;
/**
* Velocity Tracker Strategy: LSQ2.
* 2nd order least squares. Quality: VERY GOOD.
* Pretty much ideal, but can be confused by certain kinds of touch data,
* particularly if the panel has a tendency to generate delayed,
* duplicate or jittery touch coordinates when the finger is released.
*/
const int VELOCITY_TRACKER_STRATEGY_LSQ2 = 2;
/**
* Velocity Tracker Strategy: LSQ3.
* 3rd order least squares. Quality: UNUSABLE.
* Frequently overfits the touch data yielding wildly divergent estimates
* of the velocity when the finger is released.
*/
const int VELOCITY_TRACKER_STRATEGY_LSQ3 = 3;
/**
* Velocity Tracker Strategy: WLSQ2_DELTA.
* 2nd order weighted least squares, delta weighting. Quality: EXPERIMENTAL
*/
const int VELOCITY_TRACKER_STRATEGY_WLSQ2_DELTA = 4;
/**
* Velocity Tracker Strategy: WLSQ2_CENTRAL.
* 2nd order weighted least squares, central weighting. Quality: EXPERIMENTALe
*/
const int VELOCITY_TRACKER_STRATEGY_WLSQ2_CENTRAL = 5;
/**
* Velocity Tracker Strategy: WLSQ2_RECENT.
* 2nd order weighted least squares, recent weighting. Quality: EXPERIMENTAL
*/
const int VELOCITY_TRACKER_STRATEGY_WLSQ2_RECENT = 6;
/**
* Velocity Tracker Strategy: INT1.
* 1st order integrating filter. Quality: GOOD.
* Not as good as 'lsq2' because it cannot estimate acceleration but it is
* more tolerant of errors. Like 'lsq1', this strategy tends to underestimate
* the velocity of a fling but this strategy tends to respond to changes in
* direction more quickly and accurately.
*/
const int VELOCITY_TRACKER_STRATEGY_INT1 = 7;
/**
* Velocity Tracker Strategy: INT2.
* 2nd order integrating filter. Quality: EXPERIMENTAL.
* For comparison purposes only. Unlike 'int1' this strategy can compensate
* for acceleration but it typically overestimates the effect.
*/
const int VELOCITY_TRACKER_STRATEGY_INT2 = 8;
/**
* Velocity Tracker Strategy: Legacy.
* Legacy velocity tracker algorithm. Quality: POOR.
* For comparison purposes only. This algorithm is strongly influenced by
* old data points, consistently underestimates velocity and takes a very long
* time to adjust to changes in direction.
*/
const int VELOCITY_TRACKER_STRATEGY_LEGACY = 9;
/*
* Input device class: Keyboard
* The input device is a keyboard or has buttons.
*
* @hide
*/
const int DEVICE_CLASS_KEYBOARD = 0x00000001;
/*
* Input device class: Alphakey
* The input device is an alpha-numeric keyboard (not just a dial pad).
*
* @hide
*/
const int DEVICE_CLASS_ALPHAKEY = 0x00000002;
/*
* Input device class: Touch
* The input device is a touchscreen or a touchpad (either single-touch or multi-touch).
*
* @hide
*/
const int DEVICE_CLASS_TOUCH = 0x00000004;
/*
* Input device class: Cursor
* The input device is a cursor device such as a trackball or mouse.
*
* @hide
*/
const int DEVICE_CLASS_CURSOR = 0x00000008;
/*
* Input device class: Multi-touch
* The input device is a multi-touch touchscreen or touchpad.
*
* @hide
*/
const int DEVICE_CLASS_TOUCH_MT = 0x00000010;
/*
* Input device class: Dpad
* The input device is a directional pad (implies keyboard, has DPAD keys).
*
* @hide
*/
const int DEVICE_CLASS_DPAD = 0x00000020;
/*
* Input device class: Gamepad
* The input device is a gamepad (implies keyboard, has BUTTON keys).
*
* @hide
*/
const int DEVICE_CLASS_GAMEPAD = 0x00000040;
/*
* Input device class: Switch
* The input device has switches.
*
* @hide
*/
const int DEVICE_CLASS_SWITCH = 0x00000080;
/*
* Input device class: Joystick
* The input device is a joystick (implies gamepad, has joystick absolute axes).
*
* @hide
*/
const int DEVICE_CLASS_JOYSTICK = 0x00000100;
/*
* Input device class: Vibrator
* The input device has a vibrator (supports FF_RUMBLE).
*
* @hide
*/
const int DEVICE_CLASS_VIBRATOR = 0x00000200;
/*
* Input device class: Mic
* The input device has a microphone.
*
* @hide
*/
const int DEVICE_CLASS_MIC = 0x00000400;
/*
* Input device class: External Stylus
* The input device is an external stylus (has data we want to fuse with touch data).
*
* @hide
*/
const int DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800;
/*
* Input device class: Rotary Encoder
* The input device has a rotary encoder.
*
* @hide
*/
const int DEVICE_CLASS_ROTARY_ENCODER = 0x00001000;
/*
* Input device class: Sensor
* The input device has a sensor like accelerometer, gyro, etc.
*
* @hide
*/
const int DEVICE_CLASS_SENSOR = 0x00002000;
/*
* Input device class: Battery
* The input device has a battery.
*
* @hide
*/
const int DEVICE_CLASS_BATTERY = 0x00004000;
/*
* Input device class: Light
* The input device has sysfs controllable lights.
*
* @hide
*/
const int DEVICE_CLASS_LIGHT = 0x00008000;
/*
* Input device class: Touchpad
* The input device is a touchpad, requiring an on-screen cursor.
*
* @hide
*/
const int DEVICE_CLASS_TOUCHPAD = 0x00010000;
/*
* Input device class: Virtual
* The input device is virtual (not a real device, not part of UI configuration).
*
* @hide
*/
const int DEVICE_CLASS_VIRTUAL = 0x20000000;
/*
* Input device class: External
* The input device is external (not built-in).
*
* @hide
*/
const int DEVICE_CLASS_EXTERNAL = 0x40000000;
}