There was a debate about that a long time ago whether it was a kernel , a rom or a hardware issue ....
(N.B: Custom roms with Sense 4 are ONE of the causes leading to this problem !)
However , even if there is still not a real fix available, everyone who is experiencing the issue can make the auto rotation functional again by following this process :
1) Download the DHD RUU that can be found on this thread : http://forum.xda-developers.com/show....php?t=1382235 (Already rooted)
2) Once downloaded, extract the files to recreate the full zip, put it in your SD Card . ( Download here 7-Zip for extraction )
3) Now go to the RECOVERY, do a FULL WIPE and then flash that Stock rom.
5) Make the basic settings
6) Rebot again into RECOVERY, do a FULL WIPE and then flash your JellyBean rom.
For some users, flashing a PRE-ROOTED ROM does not fix the auto rotation problem. If you are one of those, just stick to the original RUU. To proceed, follow these steps :
1) In order to flash the original RUU from a JB rom, you have to go back first to a GB rom due to some Firmwares incompatibiltiy during installation. The fix is tested with latest CM 7 which you can download from here : http://download.cyanogenmod.org/?type=stable&device=ace
2) Then, and after you have flashed the CM 7 rom, download this RUU:http://hotfile.com/dl/145200528/06c6...igned.exe.html
3) Once downloaded, open the executable file and follow the instructions to flash your DHD to the original STOCK ROM.
4) Root your Rom using this easy tool: http://downloadcdn.betterinstaller.c...UnlockRoot.exe
5) When finished:
A- Download ROM MANAGER from the PLAYSTORE to flash the CLOCKWORKMOD RECOVERY,or use 4EXT RECOVERY UPDATER to flash the latest 4EXT RECOVERY downloadable from here: http://forum.xda-developers.com/atta...1&d=1352726394
B- Otherwise If your Bootloader is ENG-OFF & you want a quick method, you can use the Bootloader to flash this file Zip ( 4EXT RECOVERY RC8 ): http://forum.xda-developers.com/atta...6&d=1353050856
6) Reboot into Recovery
7) Full Wipe
8) Flash the JellyBean rom you want to use
9) Now you have a functional auto rotation !!!!
WEIRD as a FIX but the important is that it WORKS
If you get stuck at any level, do not hesitate to ask for help !
Thanks and Credits: