One of the great things about having the source code to your phone’s operating system is that you can change your phone’s behaviour in ways you wouldn’t be able to otherwise.
For example, on my Geeksphone Peak the default search provider in the browser is Bing. I’d like to switch this to Google because I like Google’s search results better. Currently this isn’t a user-configurable option in the phone’s settings (although this might change soon), but it’s possible to change nonetheless.
It turns out to be relatively simple to do this, at least once you’ve got a workflow set up to build Gaia, the Firefox OS user interface. In the source tree for you’ve grabbed from github, find and edit the file gaia/apps/browser/js/browser.js and change:
DEFAULT_SEARCH_PROVIDER_URL: 'm.bing.com', DEFAULT_SEARCH_PROVIDER_TITLE: 'Bing', DEFAULT_SEARCH_PROVIDER_ICON: 'http://bing.com/favicon.ico',
to:
DEFAULT_SEARCH_PROVIDER_URL: 'www.google.com', DEFAULT_SEARCH_PROVIDER_TITLE: 'Google', DEFAULT_SEARCH_PROVIDER_ICON: 'https://www.google.com/favicon.ico',
Then simply build (./build.sh gaia) and flash (./flash.sh gaia) Gaia to the phone. After the flash is complete, you should find the default search is now Google.com:
Comments
Since it’s all HTML/CSS/JS:
Since it’s all HTML/CSS/JS: shouldn’t it suffice to transfer the browser zip file to your desktop computer, unzip it, modify browser.js, re-zip it, and put it back in place? Rebuilding and flashing complete gaia seems like huge overhead to me.
Unfortunately, yes and no.
Unfortunately, yes and no. The file can be found in
/system/b2g/webapps/browser.gaiamobile.org/applica…
you can adb pull it, change, but you can’t push it back, because it’s a read only system. chmod won’t work either.
You have to run |adb remount|
You have to run |adb remount| before pushing to remount the /system partition in read-write mode.
Thanks for posting this. I’m
Thanks for posting this. I’m new to FirefoxOS (and the android-ish adb stuff), but the following worked for me:
adb pull /system/b2g/webapps/browser.gaiamobile.org/applica…
After decompressing the file, the confs are in ./js/browser.js as you mentioned, but it seems to get compiled into ./gaia_build_defer_index.js, so I had to change both.
Then re-zip to push back:
adb remount
adb push application.zip /system/b2g/webapps/browser.gaiamobile.org/applica…
adb reboot
Diclaimer: I am just randomly poking around FirefoxOS, use at your own risk :)
Hey, Mathieu, thank you very
Hey, Mathieu, thank you very much for that helpful hint. Thanks to it I wrote a script to automate those steps and one can fetch it from my blog entry here: http://blog.1407.org/2013/06/0…
Add new comment