Improve heuristics for orientation detection.
1. Except as otherwise indicated, orientation change happens once the predicted rotation has been stable for 40ms. Noise is suppressed by a low-pass filter with a 200ms time constant which seems to be about as small as is practical given the quality of the sensor data. 2. If the magnitude exceeds a threshold (excessive noise or freefall), resets the predicted orientation. Doesn't happen very often even when shaking the device. This heuristic mainly protects the detector from spurious tilt due to inaccurate determination of the gravity vector. 3. If the device was previously in a flat posture (on a table for at least 1000ms), then it must move out of that posture for at least 500ms before the next orientation change will happen. This heuristic suppresses most spurious rotations that happen while picking up the device. 4. If the device is tilted away from the user by 20 degrees within a span of 300ms, the device is said to be swinging and at least 300ms must elapse after the device stops swinging before the next orientation change will happen. This heuristic suppresses some but not all spurious rotations that happen while putting down a device. Unfortunately, this heuristic sometimes triggers a false positive when turning the device very rapidly due to accelerometer noise. The 300ms pause is a compromise so that occasional mispredicted swings don't significantly delay the rotation. Bug: 5796249 Change-Id: Id7b36c4c563e35b70d6a7ac36d04f3c3d6ea5811
Loading
Please register or sign in to comment