Fix unsupported focus metering crash#490
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds error handling for IllegalArgumentException during focus metering operations to prevent potential crashes, returning a failure status when the exception is caught. The review feedback suggests improving the logging by using a warning level and including the full exception stack trace for better diagnostics. Additionally, the reviewer noted that unit tests should be added to verify this new logic, in accordance with the repository's style guide for logic changes.
…/FocusMetering.kt Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enhances the focus and metering logic by adding a check for device support before initiating the action and improving error handling for IllegalArgumentException. To ensure these changes are robust, it is recommended to add a test case to FocusMeteringTest.kt that simulates a device where focus metering is unsupported. Additionally, the nested logic in the focus metering check could be simplified using a guard clause to improve readability.
This PR catches an IllegalArgumentException thrown during tap-to-focus on devices that do not support AF/AE/AWB metering points. Instead of crashing, the tap now gracefully fails and acts as a no-op, instead of crashing the app