Thursday, December 11, 2008
I'm not sure why the Android Browser doesn't auto rotate by default. Instead they have a "Flip Orientation" menu item that lets you toggle your default orientation. Pretty useless overall. Anyhow, a quick hack in the Browser source code let me enable auto rotation via the G-Sensor.
The change is really trivial. In the BrowserActivity.onCreate, I hard coded the orientation to ActivityInfo.SCREEN_ORIENTATION_SENSOR instead of pulling it from a preferences setting.
The downside is that the flip orientation menu item no longer works. Not that I care: I (and probably most people) never used it. So it is a hack, but oh well. If I'm motivated I'll put in a proper fix.
Installation Instructions (you must have root access):
- Download the updated Browser.apk
- Run the following from the command prompt to back up your current Browser file to your sdcard and install the new one:
- adb remount
- adb pull /system/app/Browser.apk BrowserBackup.apk
- adb push BrowserBackup.apk /sdcard
- adb shell rm /system/app/Browser.odex
- adb push Browser.apk /system/app