Wednesday, May 22, 2013

SDCard automount in Android

Curious to know how auto mounting the devices in Android system works?? here some know how shared. Manually mounting the device worked with mount command but still android applications are not aware of the device being mounted!!!. After googling found that devices mounted status has to be broad casted. what about the hotplug/unplanned removal of device?

Inside android eclair source forest you will see volume daemon service (system/core/vold). vold takes care of mounting/unmounting and informing mountlistner and mediascanner services.

vol daemon keeps reading a socket for uevent and when there is event from kernel appears then takes necessary action to handle
1. device type,
2. partitions, major/minor number
3. file system type and checking,
4. mounting and informing upper servce layers (mount listner, media scanner) to update mount status and sqlite database.

If automount is not working on your platform then first enable the DEBUG messages in vold. Search for DEBUG in system/core/vold and define those and capture those plenty of logs. Make a note: vold keeps running in the background so system does not allow to overwrite the vold binary. If vold is killed then init will spawn another. One way it is good to make vold to read /etc/vold.conf if you have changed.

From the log it should be clearly visible what uevent parameters system is getting from the kernel and against which vold is trying to match.

DISCLAIMER:There are many mailing discussions and solutions, but I am just consolidating here and putting few of the hacks. These may vary from platform to platform and my assumption may prove wrong for you. do not blame me...........

Monday, August 24, 2009

Webkit instrumentation in android

It is interesting to find webkit engine performance in terms of time taken by different tasks while loading the web page. Depending on the website page complexity it makes one curious to know how the page got loaded and what was the time consumption.

Android port of webkit has got one interesting instrumentation framework inplementation. In android source go to external/webkit directory and grep for ANDROID_INSTRUMENTATION...!! You will find in many places inside javascriptcore, Webcore, HTMLparsing, CSS parsing, layout and many other locations.

Android instrumentation framework is very well designed and impressive. I have been following this framework and this is improving in every release of webkit in android. Basically each component of webcore engine will register a timer with tag. This timer will be started when component start its job and records the time when completes. Refer timecounter.cpp/.h for more tags and counter options.
The output of the instrumentation will look like below which I tried on android emulator,
D/WebCore ( 700): *-* Start browser instrument
D/WebCore ( 700): *-* Total load time: 34832 ms, thread time: 23116 ms for file:///android_asset/ind.html
D/WebCore ( 700): *-* Total css parsing time: 250 ms called 6 times
D/WebCore ( 700): *-* Total javascript time: 13333 ms called 35 times
D/WebCore ( 700): *-* Total calculate style time: 279 ms called 9 times
D/WebCore ( 700): *-* Total Java callback (frame bridge) time: 510 ms called 79 times
D/WebCore ( 700): *-* Total parsing (may include calcStyle or Java callback) time: 2577 ms called 36 times
D/WebCore ( 700): *-* Total layout time: 1252 ms called 9 times
D/WebCore ( 700): *-* Total native 1 (frame bridge) time: 77 ms called 1 times
D/WebCore ( 700): *-* Total native 2 (resource load) time: 10804 ms called 206 times
D/WebCore ( 700): *-* Total native 3 (shared timer) time: 7676 ms called 22 times
D/WebCore ( 700): *-* Total build nav (webview core) time: 1264 ms called 3 times
D/WebCore ( 700): *-* Total record content (webview core) time: 1403 ms called 7 times
D/WebCore ( 700): *-* Total native 4 (webview core) time: 2043 ms called 27 times
D/WebCore ( 700): *-* Total draw content (webview ui) time: 961 ms called 10 times

Sunday, February 22, 2009

Android: Wifi driver integration

I started looking into Wifi driver integration into Android. Android from one and only Google..which has created a big storm in the mobile platform world. Android is basicaly combination of Linux kernel with Java stack. It has got cutstomoized and optmized libc (bionic) and java virtual machine (Dalvik).

Wifi conifiguration in Android starts from Java application and goes till driver/firmware insertion through JNI interface and wifi native component. Before starting modification for these components, I wanted to verify whether Wifi driver for my target will work under Android or not.

wpa_supplicant component was not enabled by default in android 1.0 release. So to enable
Add HAVE_CUSTOM_WIFI_DRIVER_2 := true to build/target/board/generic/ file.

2. make sure external/wpa_supplicant/.config has got below entries



3. Build android with this to get support for WEXT and wpa_supplicant client.

4. After the system boot, insert driver and know the interface (in my case it is eth1)

5. Modify wpa_supplicant.conf file for AP configuration and Run

/system/bin/wpa_supplicant -Dwext -ieth1 -c/sdcard/wpa_supplicant.conf

6. Run dhcp to get the IP/system/bin/dhcpcd -d eth1

7. Ping to AP to check connectivity.

To automate these steps, put above commands for wpa_supplicant and dhcpcd in init.rc.

Monday, December 8, 2008 package building tool

Ever tried Linux package building which has got many dependency ??? I will give one example of multimedia player..which depends on middle ware codecs, middleware (gst), kernel, driver modules, X window System, widget sets libs and so and so..
If one starts compiling media player then all dependency packages must be compiled first and last player hoping all the compiler requirements, library versions, proper headers, APi are in place.

Recently I came across "bitbake" one smart tool which fetches source code from the web, unpacks, applies patches, configure as per the system capabilities, compiles, installs and creates binary/dev/debug packages for simple and makes life easy...I got to work extensively with bitbake when porting openembedded based Poky mobile platform.

bitbake parses .bb file which will have following information...
1. License and package description
2. Package dependency tree
3. Package name and its download location URl with method of download (git, cvs, svn, ftp..)
4. List of patches to apply
5. Package configuration options
6. Compiler options
7. Package installation options...

Just imagine all above steps are performed by bitbake through one single command. Life made easy ??