Skip to content

How to get cache in Android Browser on Emulator

09/29/2009

How to get cache in Android Browser on Emulator

Sep 26 2009

On target, the behavior might be different.
For example, some target has no support of sqlite3.

1.Run emulator
Suppose that current directory is android source root directory.
Suppose that build is already done.

$. build/envsetup.sh
$lunch 1
$emulator&

2.Run WebKit cache db
$adb shell

Now adb shell is executed.
#cd /data/data/com.android.browser/databases/

Check db name.
#ls
webviewCache.db-journal
webviewCache.db
webview.db
browser.db

#sqlite3 webviewCache.db
SQLite version 3.5.9

3.Fetch cache data

sqlite>.table
android_metadata cache
sqlite>select * from cache;
1|http://www.google.com/m?client=ms-android-google|0ded30f8|||1255230307108|text/html|UTF-8|200||46635
2|http://www.gstatic.com/m/images/gp1.gif|4ab55f19|Mon, 06 Apr 2009 12:37:23 GMT||1285556709831|image/gif||200||4367

Suppose that we’re looking for html fine in 1st URL

schema of the cache table is as following.
sqlite> .schema cache
CREATE TABLE cache (_id INTEGER PRIMARY KEY, url TEXT, filepath TEXT, lastmodify TEXT, etag TEXT, expires INTEGER, mimetype TEXT, encoding TEXT,httpstatus INTEGER, location TEXT, contentlength INTEGER, UNIQUE (url) ON CONFLICT REPLACE);
CREATE INDEX cacheUrlIndex ON cache (url);

4.Find the cached file
Terminate query mode.
sqlite> .quit

Since 2nd column is filepath, check that file exists.
#cd ../cache/webviewCache/
#ls

0ded30f8

Termiate adb shell
#exit

5.Copy the file from Emulator to Host

$adb pull /data/data/com.android.browser/cache/webviewCache/0ded30f8 .
94 KB/s (46635 bytes in 0.484s)

$mv 0ded30f8 test.html

Now you have the HTML file.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: