Minor code refactoring.
Fix camera error with screen-off.