honoring rotation lock in android
<p>I am trying to honor the android rotation lock setting - I want my app to display in whatever orientation the home screen is locked in. I found the following knobs:</p>

<ol>
<li>Settings.System.ACCELEROMETER_ROTATION - determine if the screen orientation is locked.</li>
<li>Display.getRotation() - determine if the device is rotated from it's "natural" orientation, which may be portrait or landscape.</li>
<li>Display.getWidth()/getHeight() - determine the current orientation of the device.</li>
</ol>

<p>I thought this would be simple to do, but I can't seem to find the right combination of the above to get this to work. The reported values seem inconsistent, especially during app startup (is onResume the right place to check these values?). </p>

<p>Note I don't want to simply always fix the orientation of my activity to portrait or landscape, I want to set it to the orientation the user has locked the screen in. For tablets this could be landscape or portrait. If the user sets the Auto-Rotate setting, I want my activity to operate in sensor mode.</p>
