Jump to content

I finally figured out how to change the default orientation!


Recommended Posts

Guest jhotmann
Posted (edited)

For a long time I accepted the fact the the streaks default orientation was landscape and was able to get by...but grew tired of that and decided to take things into my own hands to find a solution.

Original post with links and attachment here http://forum.xda-developers.com/showthread.php?t=1084850

What you need

Android SDK (if you're a member of xda/modaco and you dont have this already then it's a must)

Java JDK

7-zip

Smali/Baksmali (download both jar files and rename them to remove the version number. For example rename 'baksmali-1.2.6.jar' to just 'baksmali.jar')

dexopt-wrapper (attached)

busybox (easiest way to install is to install titanium backup and select problems as many of you know from the superuser.zip root method)

your BOOTCLASSPATH (can be found in /init.rc on your phone)

Install the Android SDK, Java JDK, and 7-zip if you havent already. If you are installing the SDK for the first time you should probably familiarize yourself with the SDK first (lots of guides out there) then make sure to run SDK Manager and download the platform tools. Place the smali.jar and baksmali.jar files in the same folder as adb.exe (whether it be in the tools or platform tools folder or wherever you have moved adb). Place dexopt-wrapper on your Streak's sdcard.

Steps

> means a command (dont type the >)

1. Open a command window to the same folder as adb.exe (in Win7 ctrl + shift + right-click in the folder and select "open command window here")

2. Plug in your phone then pull the entire framework folder

> adb pull /system/framework/ framework

3. Decompile the android.policy.odex file

> cd framework

> java -jar ..\baksmali.jar -x android.policy.odex -o ..\androidpolicy

4. Navigate to the androidpolicy\com\android\internal\policy\impl folder and replace the PhoneWindowManager.smali with the one attached to this post.

5. Compile the code

> cd ..\

> java -jar smali.jar -o classes.dex androidpolicy

6. Add the resulting "classes.dex" file to the android.policy.jar file. To do this open the framework folder, right click on android.policy.jar and 7-zip -> open archive, drag the classes.dex into the 7-zip window so that you now see a META-INF folder and the classes.dex file. The resulting android.policy.jar should be around 96 KB in size.

7. Put the resulting android.policy.jar onto your phone sdcard. Fastest way is to put the jar file into the same folder as adb.exe and

> adb push android.policy.jar /sdcard/

8. Open shell

> adb shell

9. Become super user (if you havent done this before, make sure your phone is on so you can grant it superuser permissions)

> su

----------------------------------------------------------------------------

This section only needs to be done once

----------------------------------------------------------------------------

10. Put dexopt-wrapper into the correct folder with the correct permissions

> cd /system/bin/

> busybox cp /sdcard/dexopt-wrapper . (yes after dexopt-wrapper is a space and a period)

> busybox chmod 755 dexopt-wrapper

> cd /sdcard/

----------------------------------------------------------------------------

11. Create a new .odex file from the .jar file

> dexopt-wrapper android.policy.jar new.odex BOOTCLASSPATH

BOOTCLASSPATH should be the value of your bootclasspath from init.rc. For example my command looked like this (all one command):

dexopt-wrapper android.policy.jar new.odex /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/kafdex.jar:/system/framework/OmaDrmClient.jar

12. Copy the "signature" from the original .odex file to the newly created one

> busybox dd if=/system/framework/android.policy.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

13. Replace the original android.policy.odex with the new one (you will need to mount your /system/framework/ with r/w permissions, can be done with root explorer or this app

> cd /system/framework/

> busybox cp /sdcard/new.odex android.policy.odex

> busybox chmod 644 android.policy.odex

14. Done

> sync

> reboot

Your phone will now reboot, be patient as it may take slightly longer to boot up the first time. On initial bootup the lockscreen will still be in landscape with the sliders also in landscape. Just unlock, let the phone boot up some more, turn off the screen and turn it back on...

Troubleshooting

If for some reason you run into problems and your phone hangs at the dell logo...

1. Boot into recovery

2. Put the original android.policy.odex (the one in the framework folder) into the same folder as adb.exe

3. Open a command window to same folder as adb.exe (should still be open from the install steps)

4. Type the following commands

> adb shell mount /dev/block/mtdblock6 /system

> adb push android.policy.odex /system/framework/

5. Select the reboot option in the recovery menu and you should be back to stock.

Edited by jhotmann
Guest Sotiris Lekkas
Posted

Could Steve integrate this to his next release as an option? In the instructions it says that it only works in Stock Dell Streaks.

Guest chrisrotolo
Posted

excellent work and big congratulations! great find!

lockscreeen too??

Guest jhotmann
Posted
excellent work and big congratulations! great find!

lockscreeen too??

Lockscreen too.

After figuring this out, I got rid of widgetlocker because I no longer need it and now have launcherpro locked in portrait!

I have also contacted Steve on twitter to see if he wants to integrate this. The only reason I say this is only for stock dell roms is that I'm not sure is streakdroid uses dell or asop code for this file.

Guest chrisrotolo
Posted (edited)
Lockscreen too.

After figuring this out, I got rid of widgetlocker because I no longer need it and now have launcherpro locked in portrait!

I have also contacted Steve on twitter to see if he wants to integrate this. The only reason I say this is only for stock dell roms is that I'm not sure is streakdroid uses dell or asop code for this file.

you sir, are genius! congrats!

does auto-rotation toggle allow landscape like normal?

how about some screenies... edit: seen the lockscreen on xda. thanks

I have a challenge for you, although its really kind of useless to me at this point. Ever notice how in normal landscape mode, when the device boots up the lockscreen slider is in landscape, then the slider goes to "portrait" while the lockscreen remains in landscape(on our devices without your mod). Just for experimental purposes.. could you get the slider to stay in landscape? I dont even use lockscreens anymore, and I see why they did it this way, much easier just slide right thumb up..and quicker too..

....just a challenge in case anyones interested.

Edited by chrisrotolo
Guest jhotmann
Posted

During a couple of my failed attempts at changing the orientation I was able to get the sliders to stay in landscape. One of the ways was by switching the variables for landscape and portrait, but that has negative side effects...

Guest jhotmann
Posted

Also, Steve has confirmed that the next version of streakdroid will have this tweak as an option (landscape will be default)

Guest krazman
Posted
Also, Steve has confirmed that the next version of streakdroid will have this tweak as an option (landscape will be default)

EXCELLENT NEWS!!! Thank you, jhotmann, for your hard work and for allowing Steve to use it!

Guest jmhalder
Posted

Got it working on SD 1.9.1b4, i stumbled through that walkthrough for a while, and there are no odex files, I'm guessing SD is deodexed... working nonetheless.

Guest Roperband
Posted

Fine work sir! I wish I had the chops to pull off all of those steps, but I guess I'll just have to wait until someone adds it to a rom.

Guest jhotmann
Posted

339, 351, and Streakdroid 1.9.0 flashable zips added to the post on XDA for easier installation. Will add more as people with different builds continue to perform the mod and share their android.policy.odex with me.

Guest Roperband
Posted
339, 351, and Streakdroid 1.9.0 flashable zips added to the post on XDA for easier installation. Will add more as people with different builds continue to perform the mod and share their android.policy.odex with me.

So I can just flash the 351 zip and get the portrait lock? Is it a "stock" rom? Pardon the ignorance, but I recently went back to 354 in hopes of more stability but I'm dying to get this mod.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.