This code work correctly with system WebView.
But when you add Crosswalk to the project you can see bug:
The first time after the app launch orientation is detected correctly. You can chage orientation again and again and this code work fine.
Close the app with phone Back button.
Start the app again.
Orientation inversed (for portrait reported landscape and vice versa).
Close the app and remove app from the memory (clear launched apps from Android menu).
Start the app again - orientation is detected correctly.

It seems that going to the background invoke some mess for orientation detection.