Repository navigation
Catch camera error states and display CameraErrorDialog in PreviewLayout - #577
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive camera error handling system, defining a domain-level CameraError sealed interface to represent various CameraX and environmental errors (such as thermal overheat and insufficient storage), mapping them to UI states, and displaying them via a new CameraErrorDialog. The feedback highlights several areas for improvement: addressing a potential UninitializedPropertyAccessException if cameraProvider initialization fails, correcting test tag names to adhere to the repository's style guide (Rule 10), adding mandatory KDoc documentation to the internal toCameraError function (Rule 11), ensuring thread safety by performing the thermal status check inside the atomic update block, and improving the storage check accuracy by verifying the actual destination directory rather than relying solely on Environment.getDataDirectory().
b79176f to
fbac670
Compare
5ae1fbb to
b2944fd
Compare
4ec270d to
91b7fe1
Compare
…, and session reset
bd37a14 to
00c6559
Compare
Summary
CameraErrorin:core:modeland addcameraError: CameraError?toCameraStatein:core:camera.StateErrorcodes (ERROR_CAMERA_IN_USE,ERROR_MAX_CAMERAS_IN_USE,ERROR_OTHER_RECOVERABLE_ERROR,ERROR_STREAM_CONFIG,ERROR_CAMERA_DISABLEDdisambiguated viaDevicePolicyManager.getCameraDisabled,ERROR_CAMERA_FATAL_ERROR,ERROR_DO_NOT_DISTURB_MODE_ENABLED,ERROR_CAMERA_REMOVED), synchronousIllegalArgumentExceptionfrombindToLifecycle, zero available lenses at startup, critical thermal status (PowerManager.THERMAL_STATUS_CRITICAL), and insufficient storage (StatFs,ImageCapture.ERROR_FILE_IO,VideoRecordEvent.Finalize.ERROR_INSUFFICIENT_STORAGE).CameraErrorUiStatein:ui:uistate:captureandCameraErrorUiStateAdapter+ Photo Picker error string resources in:ui:uistateadapter:capture.CameraErrorDialogin:ui:components:captureand wire it intoPreviewLayout(CaptureLayout.kt) andPreviewScreen.kt.Test Plan
./gradlew spotlessCheck --init-script gradle/init.gradle.kts./gradlew :ui:uistateadapter:capture:testStableDebugUnitTest./gradlew :app:assembleStableDebug