[Sony Ericsson XPERIA X10 Mini] teapea:
As I'm running a stock ROM I don't know if this affects others, but I would guess it's the same situation for everyone. When you turn your phone into landscape, the volume buttons are the wrong way round. It annoyed the hell out of me, so I decided to sort it. Android does this already for phone with a DPad on, so it's a case of simply fooling the phone into thinking it has a DPad when the Vol buttons are pressed and using the existing rotation routines.

The process is a little complicated, since it affects services.jar, which is edited by theme creations, so there is no simple update or upgrade.zip, as it could wipe out part of your theme. However I will attach mine, which you can try and always revert back to a backup if you want.

First off, you need to grab a copy of the file.

adb pull /system/framework/services.jar

This pulls the file onto your computer. Open it up in WinRAR (or similar) and pull out the classes.dex file.

You then need to disassemble the dex file. I use Easy APK Disassembler as it's a doddle to use.

Put the classes.dex file into the same folder as this and run EasyApkDisassembler.EN.bat, select option 2, and give it a name. It creates a folder called out_<name>.

Find the file named KeyInputQueue.smali in out_<name>/com/android/server and open it up in an editor like notepad++

scroll down to find a section which looks similar to this:

fill-array-data v0, :array_1c

sput-object v0, Lcom/android/server/KeyInputQueue;->KEY_90_MAP:[I

This is creating an array called KEY_90_MAP, and filling it with the data from :array_1c. (It might not be array_1c for you, but whatever value you have it's that array you need to find)

Next, find where it fills the array. These are the values to rotate the DPAD buttons, but since were don't have them we can simple use the array to store the Volume code map.

:array_1c
.array-data 0x4
0x14t 0x0t 0x0t 0x0t
0x16t 0x0t 0x0t 0x0t
0x16t 0x0t 0x0t 0x0t
0x13t 0x0t 0x0t 0x0t
0x13t 0x0t 0x0t 0x0t
0x15t 0x0t 0x0t 0x0t
0x15t 0x0t 0x0t 0x0t
0x14t 0x0t 0x0t 0x0t
.end array-data

Edit the 1st 4 lines, with the codes for VOLUME_UP and VOLUME_DOWN, which are 0x18 and 0x19.

:array_1c
.array-data 0x4
0x18t 0x0t 0x0t 0x0t
0x19t 0x0t 0x0t 0x0t
0x19t 0x0t 0x0t 0x0t
0x18t 0x0t 0x0t 0x0t
0x13t 0x0t 0x0t 0x0t
0x15t 0x0t 0x0t 0x0t
0x15t 0x0t 0x0t 0x0t
0x14t 0x0t 0x0t 0x0t
.end array-data

We next need to fool the phone into thinking it has a DPAD when the buttons are pressed.

Find the section

.method public getInputConfiguration(Landroid/content/res/Configuration;)V

a few lines down from here are the line

.line 322
const/4 v4, 0x1

iput v4, p1, Landroid/content/res/Configuration;->navigation:I

Again you might have a slightly different line number. This routine essentially checks the input configuration and sets various flags if the device has a mouse, or dpad etc. The const/4 v3, 0x1 is setting it to having no dpad by default then later if it finds a dpad, it sets the flag accordingly. We're just defaulting it to say it does have a dpad. So we change it to 0x2.

.line 322
const/4 v4, 0x2

iput v4, p1, Landroid/content/res/Configuration;->navigation:I

Save the file.

We then need to recompile the dex, so run EasyAPK, select option 3, and enter the folder name you used. This compiles a file called out.dex. Open up the services.jar file in WinRAR again, and push this file into the archive. Delete the original classes.dex file in the archive, and rename out.dex to classes.dex.

You have now made the changes.

You then just need to replace your phone's version with this version. I tend to rename it to services_1.jar and push it to the sdcard. Reboot the phone into xRecovery and mount the system and sdcard, and adb shell to rename the existig file, and put this in its place. However you push it back, make sure you set the permissions to 644.

Reboot the phone. It takes a while to reboot, so just wait for a few mins. (Mine reboots twice the first time for some reason but then it's fine.)

You then have the swapped volume buttons when you put the phone in landscape mode!

My version is here:

http://www.megaupload.com/?d=R5L8M44R