Galaxy S2 SGH-T989D
Android 4.0.3 build IML74K.TLLE4
All compass apps read incorrectly. Android sensor test (*#0*#) also shows magnetic sensor reads inaccurately.
Third party app, Z-Device Test by Zeusen, shows magnetic sensor working perfectly.
Therefore problem is not hardware but Android related.
Note, compass apps worked correctly before upgrading to current Android version. There is no case with magnets involved.
Any suggestions?

Sent from my SGH-T989D using