@Override
    public void onOrientationChanged(int orientation) {
        Context context = mContext.get();
        if (context == null) {
            return;
        }

        Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
        int surfaceRotation = display.getRotation();
        if (surfaceRotation != mSavedRotation) {
            mSavedRotation = surfaceRotation;
            onDisplayRotationChanged(mSavedRotation);
        }
    }
Extension of {@link OrientationEventListener} that invokes a callback whenever the Display
orientation changes. This effectively connects a standard OrientationEventListener, which
listens for sensor data, to the Display's getRotation method.
android/viro_bridge/src/main/java/com/viromedia/bridge/utility/DisplayRotationListener.java