Merge "Revert "Refactor of screenshot code on main thread."" into main