Here you can find the source of getRotationOffset()
public static int getRotationOffset()
//License from project: Apache License import android.content.Context; import android.view.Surface; import android.view.WindowManager; public class Main{ public static int getRotationOffset() { switch (WindowManagerHolder.WINDOW_MANAGER.getDefaultDisplay() .getRotation()) {//from w ww .j a va 2s. c o m case Surface.ROTATION_90: return 90; case Surface.ROTATION_180: return 180; case Surface.ROTATION_270: return 270; default: return 0; } } }