A CameraSelector picks the camera (DEFAULT_BACK_CAMERA, DEFAULT_FRONT_CAMERA, or a filter over CameraInfo). Never assume one exists; BookNest checks and falls back:
val facings = provider.availableCameraInfos.map { it.lensFacing } // 5.31.5
val front = provider.hasCamera(CameraSelector.DEFAULT_FRONT_CAMERA)
Log.d(TAG, "cameras: $facings (0 = front, 1 = back), front camera: $front")
val selector = if (provider.hasCamera(CameraSelector.DEFAULT_BACK_CAMERA))
CameraSelector.DEFAULT_BACK_CAMERA else CameraSelector.DEFAULT_FRONT_CAMERAOutput
D/BookNestCam( 6547): cameras: [1] (0 = front, 1 = back), front camera: false
The emulator has no front camera (hw.camera.front=none). Orientation differs too: CameraX 234 reports each frame's rotation (rotation 90 in CameraX Use Cases) and writes EXIF orientation 6 into saved JPEGs instead of rotating pixels. BitmapFactory ignores EXIF, so BookNest's thumbnail in the figure lies on its side; Coil 11,909 (Images with Coil and Glide) applies it. A ResolutionSelector asks for 4:3 or 16:9 and gets the nearest supported size.