Refactor JCA to split debug related components into their own module (:ui:debug)#526
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase by extracting debug-related components, controllers, and state adapters into a newly created :ui:debug module, updating dependencies and imports across the application accordingly. Feedback on these changes includes restoring KDocs for the DebugController interface methods, updating test tag string values to follow the required lower_snake_case naming convention, and correcting the dependency configuration of libs.androidx.junit to a test configuration. Additionally, it is recommended to place FakeDebugController in a shareable location for reusability across modules and to rename the duplicate zoom_ratio_text string resource to prevent potential resource merging conflicts.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…nit, move FakeDebugController to dedicated :ui:debug:testing module
temcguir
left a comment
There was a problem hiding this comment.
In the PR description you mentioned being able to completely remove the :ui:debug module. I noticed that feature:preview still has hardcoded imports to DebugOverlay and DebugControllerImpl, so if we actually dropped the gradle dependency right now, feature:preview wouldn't compile.
For a future follow-up, it might be worth putting DebugController behind an interface in a core module and using Hilt to inject a No-Op version for release builds. That way we can truly strip the debug module out of production APKs without having to touch any feature code.
Definitely not a blocker for this PR though! Looks good to me overall.
|
@temcguir Regarding the imports in feature:preview. Yeah those will have to be removed and this PR made it so that they can be removed in the feature/app layer. Check out https://github.com/google/jetpack-camera-app/tree/david/debugModuleRemovelTryout |
This PR decouples and modularizes debug-related components, models, states, and controllers in the Jetpack Camera App (JCA) into a separate
:ui:debugmodule underui/debug/.Key Changes:
:ui:debugmodule (ui/debug/build.gradle.ktsandui/debug/Android.bp).DebugOverlayComponents.kt,DebugUiState.kt,DebugUiStateAdapter.kt,DebugController.kt,DebugControllerImpl.kt, andFakeDebugController.ktto the packagecom.google.jetpackcamera.ui.debug.DebugTags.kt.:ui:components:capture.:feature:previewand:appmodules.Demonstration of Debug Module Removal:
To demonstrate how the debug module and its dependencies can be completely removed from the project if needed, please see the tryout branch david/debugModuleRemovelTryout. That branch removes the
:ui:debugmodule entirely, confirming that the remaining feature modules and instrumentation tests build and pass successfully without any references to the debug library.