Fix resuming activity's state when rotating the screen