Most smartphones feature a 3-axis Gyroscope, a 3-axis magnetometer and a 3-axis accelerometer. Combining these sensors' measurements in a clever way (Kalman filter) should yield a fast, accurate, noise free and absolute device orientation. This could be stored as a quaternion or yaw/pitch/roll values.
What is the simplest way to achieve this in Android? Does the operating system already do those calculations for you? Are there open source implementations that one could use?
Most examples/tutorials I could find only focus on one type of sensor. But for my use case only the fusion of all three sensors via proper filtering would be of interest...