Firstly let me point out a couple of important topics of discussion:
- You may just have a phone that has a hardware error. If you run through this post and options and you don't have any success, give some serious thought to getting it repaired because no matter how many new rom releases come out it isn't going to fix it.
- Full SELinux Support - If you use TWRP2 they have recently updated to 126.96.36.199 - It's worth reading through the 'Note' listed in the changelog. They talk about how Full SELinux Support is needed for installing Kit Kat roms and some of their older versions didn't support it. (http://teamw.in/project/twrp2)
- Rom and App settings - The Rom has several places to tick/untick screen rotation. Some apps also have screen rotation toggles. The important one is the Rom settings, make sure you have actually turned rotation on. It can be found in the notifications menu at the top of your screen (if you haven't removed it through customisation), also in Settings>Display> which is not to be confused with 'Smart rotation'.
- Smart Rotation - You do not need this turned on for screen rotation to work. In fact I would recommend leaving it turned off as it slows screen rotation down. I'll leave it up to you.
- Samsung Bloatware - There has been some talk on the forum about how removing Samsung apps has caused screen rotation to break. This is possible as several library files are shared. Since you are running a "custom" Rom it's hard to know whether any scripts have been included in the installation that haven't been specifically listed in a changelog.
- Model Vs Region Vs Solution - There are quite a few S4 models available at present. Most of these have hardware differences and the solution that worked for someone else may not work for you. It's good for you to start by learning what the differences are and what components were included in the version you purchased (this will save headaches later).
BACKUP YOUR DATA - I will not be held responsible for any actions you take with your device!
Ok, let's get started with the options/work arounds that you may wish to use and how they work (You will need to have root access):
1. ReInstall the Rom - This is the first place to start. You can usually install over the top of the initial installation without any issues. This would replace any data that may be corrupt from the installation. If you have installed a custom kernel it will install the one that comes with the Rom.
2. Clean install of the Rom - Sometimes we have to strip it all the way back to like-new. This means you would need to Factory Reset the phone (this will remove all apps and sign in data). If you wish to go all the way in cleaning off your device there is a Format option available in TWRP2 and PhilzTouch. Don't format unless you know what you're doing otherwise you could format the EFS data and then you're screwed. Don't say you haven't been warned.
3. a) Install a Library file (through recovery) - This is a script that has been built to replace a library file that is removed when you uninstall Samsung Hub. There is a discussion taking place in the Note3 forum where you can get the file. Be sure to follow their instructions exactly. http://forum.xda-developers.com/show...php?p=50099965
b) Install a Library file (through Android) - Using the same ScreenRotation.zip file you can download from the link above, open the zip and save 'libgnustl_shared.so'. You will need to put this file on your phone somewhere you can find it so you can copy it to the correct location and set some permissions. You need root access to even attempt this one, if you are unsure about what you're doing I would proceed with caution. It's not rocket science however you want to make sure that you don't alter any of the other files. You need to place libgnustl_shared.so into the \System\Lib folder. If the file is already there I would rename the old file rather than copying over the top. This just saves you in case anything else goes wrong and you need to go back a step. You need to change the permissions of the file before going anywhere. I used ES File Explorer to move the file and it allows simple change of the file permissions (through properties). It needs to be -rw-r--r-- or if you are using ES File Explorer then it should read Owner: Read & Write, Group: Read, Other: Read. You will then need to boot into recovery and wipe cache and davlik cache (don't confuse this with Wipe: Factory Reset).
4. Install a Stock Rom from YOUR phone provider - Telco's spend time and money ensuring their releases work with all the features of the phone, this is sometimes the reason why they take so long to update their software. Some of these features are Telco specific and others are region specific (hence my comment about being aware of what you have purchased). If you have installed a stock rom and you still have screen rotation issues it is likely (not guaranteed) that there is a hardware issue. In my experience installing a stock unmodified rom often addresses the issues that crop up on custom roms. It's worth testing it for a day or two on stock to ensure it's not intermittent. If you are willing to go to all the trouble you could try installing a custom rom again. I have has success in the past doing it this way. I can only assume that the installation of the stock rom addresses issues with internal components/firmware.
5. Kit Kat Roms - If you have loaded a bootloader that excludes you from installing your carriers stock rom (due to it being Jelly Bean or earlier), there are stock Kit Kat roms you can download in the forum. You won't have the added support of carrier addons and tweaks, however you will still get stock Samsung which is the next best thing.
What to do if none of the above work?
There are two options 1. Send it off for repair 2. Continue to work on it yourself with the help of others on the forum.
If you wish to continue working on it yourself or you have voided your warranty here are some tools to help. You need to take a look at whether your accelerometer is working - This is indicative only (an indicator) and will help you narrow the problem down.
1. In your dialer (phone) put in the following *#0*#
This will allow you to go in and see how the components are responding - You want to take a look at Sensors.
2. Accelerometer Monitor/Test Applications
There are quite a few for free on the market place - They will show you how the X, Y & Z axis are responding to the movement of the phone. Sometimes it is quite obvious when certain axis are not responding at all. Some of these applications will allow you to calibrate the sensors. I am not 100% sure whether these calibration options will work on Kit Kat. If you are speaking with a developer of a custom rom they will often query you for log data, this is code that will help them work out what is going wrong. This doesn't guarantee they will be able to fix it. Not all of the accelerometer apps provide a log but is necessary information you'll need if you decide to go down that path.
(AndroSensor is relatively good - https://play.google.com/store/apps/d...im.androsensor)
Let me know how you go.