Merge code from CAF in an attempt to fix the blackscreen when rotating the screen while opening the Camera app