[Epic 4G Android Development] rocket321:
[MOD][How-To] Adjust Text Size in Stock Froyo Browser

Background

I have seen this question asked several times here, in the I9000 forums and elsewhere. I very much missed the ability to adjust text size in the stock browser while keeping the zoom level default (medium) which was available in Eclair but removed in all Froyo builds. I have not tried any of the 2.3 leaks and cannot comment on if they are still lacking the text size adjustment.

One thing that gave me hope was that if I upgraded from DI18 using an update.zip (official OTA) my browser would keep its text size setting from Eclair, even though it could no longer be toggled in the browser settings.

Much later I realized that when doing an advanced Nandroid restore of "Data Only" it would also restore the text size setting to the browser. This made me realize there must be a config file inside of /data which could possibly be edited. I started a thread in Q&A to see if anyone had looked into it and as I got no response/interest decided to dive in myself.

Discovery

I was able to extract the /data partition of an old nandroid backup using the unyaffs utility with the cygwin1 DLL file.

From there I compared the file:

/data/data/com.android.browser/shared_prefs/WebViewSettings.xml

from the backup to the WebViewSettings.xml file in place after a fresh odin to stock. What I discovered was this line was in my nandroid backup XML, but not in the fresh install XML:

<string name="text_size">LARGER</string>

This appeared to me to be exactly the option I've been looking for. So I fired up notepad, edited my stock XML file and added the line of XML. Then I saved it back to the path mentioned above. Sure enough, the stock browser was now using a larger default font size while keeping the zoom level default (medium). I took a handful of screenshots comparing:

-Before Hack

--Medium Zoom setting

----Zoomed out

----Zoomed in

--Close Zoom setting

----Zoomed out

----Zoomed in

-After Hack (edited XML file)

--Medium Zoom setting

----Zoomed out

----Zoomed in

You will notice on the "before hack, close zoom setting" that the picture is also being zoomed in which is undesirable to me. I prefer to have pictures remain at their default (100%) size while only increasing the text.

Method

Requires ROOT Access and a way to access the /data partition. I use "SuperManager" although Root Explorer should work just as well.

Make a BACKUP! I am not responsible for broken devices, broken dreams, broken legs, etc

Move this file to your SDCard:

/data/data/com.android.browser/shared_prefs/WebViewSettings.xml

Edit the file (with notepad or whatever you want) to add

<string name="text_size">LARGER</string>

Note: You can replace LARGER with any of the following: smallest, smaller, small, medium, large, larger.

I will also provide my edited XML file so you may compare it or simply use it (NOTE: Using my XML file may change other browser settings you don't want changed!!)

Use task manager to verify "Internet" is not running. If it is, click End.

Copy the file back to its original location, overwriting the original

Shutdown the phone and boot into CWM

Clear cache & Dalvik cache (I don't know if this is required, but its the method I followed)

Reboot and enjoy your tweaked browser text size.

Next Steps

I'd like to see this implemented in either an easy to use app for root users, or perhaps just a script which can be run. If anyone is up for working on this or interested in implementing this into a ROM please PM me.

Screenshots and attachment will be added once I get them uploaded so you can compare and decide if you would like to do this hack.

If I helped you, please hit thanks. :cool:

Update:

Link to Pictures - Proof the hack works:

https://picasaweb.google.com/116895465022074216065/TextSizeHack?authkey=Gv1sRgCL_D8vOyy4eI5AE&feat=directlink