android4.4 Touch Point properties (down, move, up)

Source: Internet
Author: User

Typically, the application uses motionevent.getaction () when dealing with touch events to determine that the escalated touch point is Action_down, Action_move, or action_up, and then makes the processing logic of moving, zooming, and so on. Where are the properties of each touch point defined? is the touch attribute marked for each point by the driver escalation?

Directly to the conclusion: for touch point Properties, the Dispatchtouches () function in Inputreader is defined, not driven.

void Touchinputmapper::d ispatchtouches (nsecs_t when, uint32_t policyflags) {BitSet32 currentidbits = Mcurrentcookedpoi    Nterdata.touchingidbits;    BitSet32 lastidbits = mlastcookedpointerdata.touchingidbits;    int32_t metaState = GetContext ()->getglobalmetastate ();    int32_t buttonstate = mcurrentbuttonstate;  if (currentidbits = = lastidbits) {if (!currentidbits.isempty ()) {//No pointer ID changes so this is a            Move event.            The listener takes care of batching moves so we had to deal with the.                    Dispatchmotion (when, Policyflags, Msource, Amotion_event_action_move, 0, MetaState, ButtonState,                    Amotion_event_edge_flag_none, Mcurrentcookedpointerdata.pointerproperties, Mcurrentcookedpointerdata.pointercoords, Mcurrentcookedpointerdata.idtoindex, CU Rrentidbits,-1, Morientedxprecision, MORIENTEDYPREcision, Mdowntime); }} else {//There may pointers going up and pointers going down and pointers moving//all at the SA        Me time.        BitSet32 upidbits (Lastidbits.value & ~currentidbits.value);        BitSet32 downidbits (Currentidbits.value & ~lastidbits.value);        BitSet32 moveidbits (Lastidbits.value & Currentidbits.value);        BitSet32 dispatchedidbits (Lastidbits.value); Update last coordinates of pointers, which has moved so, we observe the new//pointer positions at the same        Time as other pointers that has just gone up. BOOL moveneeded = Updatemovedpointers (mcurrentcookedpointerdata.pointerproperties, mcurrent Cookedpointerdata.pointercoords, Mcurrentcookedpointerdata.idtoindex, Mlastcookedpointerdata                . pointerproperties, Mlastcookedpointerdata.pointercoords, Mlastcookedpointerdata.idtoindex, Moveidbits);        if (buttonstate! = mlastbuttonstate) {moveneeded = true;        }//Dispatch pointer up events.            while (!upidbits.isempty ()) {uint32_t upid = Upidbits.clearfirstmarkedbit (); Dispatchmotion (when, Policyflags, Msource, amotion_event_action_pointer_up, 0, MetaState, ButtonState,                    0, Mlastcookedpointerdata.pointerproperties, Mlastcookedpointerdata.pointercoords, Mlastcookedpointerdata.idtoindex, Dispatchedidbits, Upid, Moriente            Dxprecision, Morientedyprecision, mdowntime);        Dispatchedidbits.clearbit (UPID);        }//Dispatch move events If any of the remaining pointers moved from their old locations. Although applications receive new locations as part of individual pointer up/events, they does not generally ha        Ndle them except when presented in a move event.   if (moveneeded) {         Alog_assert (Moveidbits.value = = Dispatchedidbits.value);                    Dispatchmotion (when, Policyflags, Msource, Amotion_event_action_move, 0, MetaState, buttonstate, 0,                    Mcurrentcookedpointerdata.pointerproperties, Mcurrentcookedpointerdata.pointercoords, Mcurrentcookedpointerdata.idtoindex, Dispatchedidbits,-1, morient        Edxprecision, Morientedyprecision, mdowntime);        }//Dispatch pointer down events using the new pointer locations.            while (!downidbits.isempty ()) {uint32_t Downid = Downidbits.clearfirstmarkedbit ();            Dispatchedidbits.markbit (Downid);  if (dispatchedidbits.count () = = 1) {//First pointer is going down.                Set down time.            Mdowntime = when; } dispatchmotion (When, Policyflags, Msource, Amotion_event_action_pointer_down, 0, MetaState , butTonstate, 0, Mcurrentcookedpointerdata.pointerproperties, Mcurrentcookedpointerdata.                    Pointercoords, Mcurrentcookedpointerdata.idtoindex, Dispatchedidbits, Downid,        Morientedxprecision, Morientedyprecision, mdowntime); }    }}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.