Thursday, December 11, 2008

Howto: Enable Autorotate for your G1 Browser!

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

5 comments:

  1. how do i use this? how do i get root access? im not really tech-savvy (at least cellphone pda devices) but would like to perform this feature. also will tampering with a root feature change future apps which try to use it. thanks!

    ReplyDelete
  2. Seems like using the flip orientation button actually causes the autorotate to stop working until a restart? anyone else experience this?

    ReplyDelete
  3. I Say Just Download Steel app in the market. its simple and comes with an on screen keyboard

    ReplyDelete
  4. once you get root access to your phone using the "telnet" app you cant use it again it wont connect and you cant do the prompts

    ReplyDelete
  5. WTF. It won't let me copy the new Browser.apk over.

    failed to copy 'c:/temp/Browser.apk' to '/system/app/Browser.apk': No space left on device

    somehow it deleted the Browser.apk and then filled the space or resized the partition in system so that I can't put back the new Browser.apk....

    e-mail me at odslabs@gmail.com if you can help, thanks.

    ReplyDelete