I have a task where I have to cast device (not activity) orientation to 4 values (LANDSCAPE, PORTRAIT, LANDSCAPE_REVERTED and PORTRAIT_REVERTED). I came up with a solution but it uses fixed values, and does not represent the android functionality of how and when it changes the activities orientations.
I was unable to find an api that could easily notify a listener of when the device has changed it's orientation to the specified 4 values.
It would be grate if someone could share the function of how the android computes the orientation and informs WindowManager to change the orientation of the activities.
[SOLVED] To does who might end up in the same situation as me. frameworks/base/core/java/android/view/WindowOrientationListener.java
this listener contains all the magic that informs the activity to change it's orientation.