Freeze screen orientation
There is CheckBox with following code:

        CheckBox cb = (CheckBox)findViewById(R.id.freezer);
        cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				if (isChecked) {
					setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
				} else {
					setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
				}
			}
		});
So, when i check it, screen is rotated to default system orientation (landscape for my tablet).

I need to freeze CURRENT orientation. If you turned device to portrait and toggled CheckBox,   device rotation must be ingored until CheckBox is unchecked.

Display.getRotation() is not a solution, because each device has it's own Surface.ROTATION
Freeze screen orientation
===

There is CheckBox with following code:

        CheckBox cb = (CheckBox)findViewById(R.id.freezer);
        cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				if (isChecked) {
					setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
				} else {
					setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
				}
			}
		});
So, when i check it, screen is rotated to default system orientation (landscape for my tablet).

I need to freeze CURRENT orientation. If you turned device to portrait and toggled CheckBox,   device rotation must be ingored until CheckBox is unchecked.

Display.getRotation() is not a solution, because each device has it's own Surface.ROTATION