Thursday 15 January 2015

touch - Android logging touches -



touch - Android logging touches -

i seek build ui testing environment , log touch events , coordinates.

at moment have scenarios: 1. utilize transparent overlay logs i'm not able click buttons etc. on view below. 2. can click buttons below overlay doesn't log coordinates...

unfortunately both doesn't work. hence know if there way both works?

thanks!

code snippet of overlay window:

oview = new linearlayout(this); oview.setbackgroundcolor(0x88ff0000); // translucent reddish color windowmanager.layoutparams params = new windowmanager.layoutparams( windowmanager.layoutparams.match_parent, windowmanager.layoutparams.match_parent, windowmanager.layoutparams.type_system_alert, windowmanager.layoutparams.flag_not_touchable | windowmanager.layoutparams.flag_not_focusable | windowmanager.layoutparams.flag_watch_outside_touch, pixelformat.transparent); windowmanager wm = (windowmanager) getsystemservice(window_service); wm.addview(oview, params);

moreover create ontouchlistener oview...

the flag_watch_outside_touch "trick" security exploit , patched out in android 4.2+

here's relevant section in andoird source.

as can see comment, if touch not within overlay special flag set nulls coordinates. done stop keylogging , other touch-hijacking exploits.

the alternative know of have rooted device , read straight underlying linux kernel event interface calling like:

getevent -lt /dev/input/eventx

from root shell. l flag makes output more human-readable , t flag attach timestamps output, in case need them. note x id of touchscreen device. can info on available devices using command getevent -lp, touchscreen 1 has abs_mt_position_x , abs_mt_position_y events.

note info you'll low-level , you'll have parse useful. can check out linux kernel documentation on multi-touch devices info on various event codes mean.

android touch listener overlay monitor

No comments:

Post a Comment