I have a camera preview activity in my Android app. To avoid the messiness of dealing with screen rotations in a camera preview, I've simply told the activity to pick the default orientation for the device (portrait on phones, landscape on tablets):
<activity android:name="CameraActivity"
android:screenOrientation="nosensor"
android:configChanges="keyboardHidden|orientation|screenSize"/>
However, if I hold the device in a non-default orientation, there's an undesired rotation animation when entering and exiting this activity. It's as if Android thinks the phone is being physically rotated to the default orientation, even though it's not!
Is there any way to avoid this quirk? I've tried creating a style with <item name="android:windowAnimationStyle">@null</item>
or using intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION)
as suggested here, to no avail.