Skip to content

Refactor JCA to split debug related components into their own module (:ui:debug)#526

Merged
davidjiagoogle merged 9 commits into
mainfrom
david/debugModuleSplit
Jun 10, 2026
Merged

Refactor JCA to split debug related components into their own module (:ui:debug)#526
davidjiagoogle merged 9 commits into
mainfrom
david/debugModuleSplit

Conversation

@davidjiagoogle

@davidjiagoogle davidjiagoogle commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

This PR decouples and modularizes debug-related components, models, states, and controllers in the Jetpack Camera App (JCA) into a separate :ui:debug module under ui/debug/.

Key Changes:

  1. Created the new :ui:debug module (ui/debug/build.gradle.kts and ui/debug/Android.bp).
  2. Relocated DebugOverlayComponents.kt, DebugUiState.kt, DebugUiStateAdapter.kt, DebugController.kt, DebugControllerImpl.kt, and FakeDebugController.kt to the package com.google.jetpackcamera.ui.debug.
  3. Extracted debug-specific test tags to DebugTags.kt.
  4. Cleaned up visibility drawables and debug strings from :ui:components:capture.
  5. Updated dependencies and imports in :feature:preview and :app modules.
  6. Ran spotless formatting and verified that tests pass.

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:debug module entirely, confirming that the remaining feature modules and instrumentation tests build and pass successfully without any references to the debug library.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ui/debug/build.gradle.kts Outdated
Comment thread ui/debug/src/main/res/values/strings.xml Outdated
@davidjiagoogle davidjiagoogle requested a review from temcguir June 1, 2026 23:28

@temcguir temcguir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@davidjiagoogle

Copy link
Copy Markdown
Collaborator Author

@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

@davidjiagoogle davidjiagoogle enabled auto-merge (squash) June 10, 2026 21:47
@davidjiagoogle davidjiagoogle disabled auto-merge June 10, 2026 21:47
@davidjiagoogle davidjiagoogle merged commit bb5d207 into main Jun 10, 2026
10 of 11 checks passed
@davidjiagoogle davidjiagoogle deleted the david/debugModuleSplit branch June 10, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants