Hacking by Walkingice: MotionEvent on HTC Hero

2010/06/10

MotionEvent on HTC Hero

I have both of HTC Hero and Nexus One. Thanks God and HTC, finally Hero users got the Android Eclair update via OTA.

Recently I found a weird behavior on HTC Hero and differs from my Nexus One.

Here is the testing code

public boolean onTouchEvent(MotionEvent event) {
long now = android.os.SystemClock.uptimeMillis();
android.util.Log.i("Ouch", "keep pressing:" + (now - event.getDownTime()));
return false;
}

I just keep pressing the screen and see the log output which tells the pressing time in millisecond.

Nexus One (Eclair)
(just press and do not drag)
I/Ouch (11979): keep pressing:2
I/Ouch (11979): keep pressing:14
I/Ouch (11979): keep pressing:43
I/Ouch (11979): keep pressing:71
I/Ouch (11979): keep pressing:98
I/Ouch (11979): keep pressing:127
I/Ouch (11979): keep pressing:154
I/Ouch (11979): keep pressing:189
I/Ouch (11979): keep pressing:214
I/Ouch (11979): keep pressing:238
I/Ouch (11979): keep pressing:265
I/Ouch (11979): keep pressing:294
I/Ouch (11979): keep pressing:324
I/Ouch (11979): keep pressing:351
I/Ouch (11979): keep pressing:380
I/Ouch (11979): keep pressing:405
I got 16 events in 0.4 seconds, that is well known event "Touch Event Flood".

HTC Hero (Eclair)
(just press, I do not drag)
W/Rosie ( 152): mAddHtcWidgetByOtherActivity = false, mIsOpenSlideWhenLeaveLaunch = true
I/Ouch ( 2149): keep pressing:4
I/Ouch ( 2149): keep pressing:17
I/Ouch ( 2149): keep pressing:26
I/Ouch ( 2149): keep pressing:62
I/Ouch ( 2149): keep pressing:245
I/Ouch ( 2149): keep pressing:421
I/Ouch ( 2149): keep pressing:817
I/Ouch ( 2149): keep pressing:1671
D/dalvikvm( 528): GC freed 1174 objects / 73000 bytes in 139ms
(8 seconds left, I start moving my finger)
I/Ouch ( 2149): keep pressing:8372
I/Ouch ( 2149): keep pressing:8697
I/Ouch ( 2149): keep pressing:8743
I/Ouch ( 2149): keep pressing:8752
D/dalvikvm( 135): GC freed 211 objects / 10464 bytes in 241ms

In the first 1.6 seconds, I got 8 events. I still kept pressing the screen untle 8 seconds left. I started dragging and then got touch event as I expects.

I guess Sense-UI of HTC Hero did some change to deal with touch event flood. It should be good thing but I guess that kicks someone's ass.

No comments:

Post a Comment