Hacking by Walkingice: 0xlab
Showing posts with label 0xlab. Show all posts
Showing posts with label 0xlab. Show all posts

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.

2010/03/30

Javadoc at Android

* This article also post to 0xlab planet *
I have a tiny, useless brain with slow frequency, 128 bytes L1 cache and 256K Ram. Therefore, I cannot remember everything while I am doing Java programming.

Although you are not a nut like me, you might still need Java API documentation. Well, we could read the [online version], thats cool.

But what if you are a poor guy cannot pay for network. You still have to work on the Bus, at Starbucks coffee, at toilet or on the bed.

Luckily, you could generate offline documentation by command

$make docs

But I do not like droiddoc. I cannot explain why I dislike it.

I like the original javadoc style, it is like although I had PS but I still love FF3 on FC. (bad example I know)

I read article of [androidjavadoc] and prepared this [patch], you could generate your own old style offline java documentation.

From bfe51b44ee6f6c1a989d34c96f9b0ea457731d80 Mon Sep 17 00:00:00 2001
From: Julian Chu

Date: Wed, 26 Aug 2009 12:19:36 +0800
Subject: [PATCH] Create original javadoc

Apply this patch and type in
$make docs
---
core/droiddoc.mk | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 30bd918..af4121e 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -159,17 +159,13 @@ $(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_f
-J-Xmx768m \
-J-Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) \
$(PRIVATE_PROFILING_OPTIONS) \
- -quiet \
- -doclet DroidDoc \
- -docletpath $(PRIVATE_DOCLETPATH) \
- -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
- -templatedir $(PRIVATE_TEMPLATE_DIR) \
- $(PRIVATE_DROIDDOC_HTML_DIR) \
+ -overview $(TOP)/frameworks/base/core/java/overview.html \
+ -splitindex \
+ -use \
+ -package \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
- $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
- $(PRIVATE_DROIDDOC_OPTIONS) \
&& rm -rf $(PRIVATE_OUT_ASSET_DIR) \
&& rm -rf $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
&& mkdir -p $(PRIVATE_OUT_ASSET_DIR) \
--
1.6.3.3
The generating documentation will be put under out/common/host/….Once you finish it, you could revert the previous patch and pretend nothing happened
$ cd /WHERE/TO/ANDROID/build/
$ git reset –-hard HEAD^
ps. I tried it on Eclair, it works.


Update: you can tweak the stylesheet.css to make it looks better
-body { background-color: #FFFFFF; color:#000000 }
+body { background-color: #FFFFFF; color:#000000; margin : auto; max-width: 1024px; margin-top: 30px;}

2008/11/30

Starting at EFL

Well, I want to write something about EFL first.

[EFL], Enlightenment Foundation Libraries, is a GUI libraries which let you draw something on X. The windows manager Enlightenment is written by EFL. The position of EFL in Enlightenment is like GTK for Gnome or Qtopia for KDE.

The maintainer make huge progress in EFL therefore it changes very fast.
Before he make a release of EFL, we can say that EFL changes EVERYDAY.

Rasterman, one maintainer of EFL, provided a script (get_e.sh) that you may build EFL easily.

However, for the reason that getting more stable, Openmoko only use svn revision 36882 of EFL before it release.

You can use this script to checkout out the source code and build it with revision 36882.

#!/bin/bash

sudo echo "Get Root permission" || exit
list="eina eet evas ecore e_dbus efreet embryo edje etk edje_editor edje_viewer"

for l in $list;do
svn co -r 36882 http://svn.enlightenment.org/svn/e/trunk/$l
cd $l
./autogen.sh || exit
make
sudo make install
cd ..
done