As strange as it may seem, Samsung recommends a "gentle tap to the back" or "a small shake" of their Galaxy S8 to those who complain that their phone's main camera is taking blurry photos and has problems focusing.
https://www.notebookcheck.net/Shake-your-Samsung-Galaxy-S8-to-help-its-camera-focus-properly.267446.0.html