frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
public int rotationForOrientationLw(int orientation, int lastRotation) {
synchronized (mLock) {
int sensorRotation = mOrientationListener.getProposedRotation();
if (sensorRotation < 0) {
mPortraitRotation = Surface.ROTATION_270;
mLandscapeRotation = Surface.ROTATION_0;
mUpsideDownRotation = Surface.ROTATION_90;
mSeascapeRotation = Surface.ROTATION_180;
}
...
}