Skip to content

Comments

centralize commonly referenced constants#471

Open
Kimblebee wants to merge 3 commits intomainfrom
kim/cleanup/centralize-fps-constants
Open

centralize commonly referenced constants#471
Kimblebee wants to merge 3 commits intomainfrom
kim/cleanup/centralize-fps-constants

Conversation

@Kimblebee
Copy link
Collaborator

centralize duplicate constant definitions to CameraConstants.kt

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Kimblebee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the codebase by centralizing several commonly used constant definitions into a new CameraConstants.kt file. This change primarily affects frame rate (FPS) and video duration constants, which were previously duplicated or scattered across different modules. By consolidating these values, the PR aims to enhance code consistency, reduce redundancy, and simplify future maintenance and updates of these core camera-related parameters.

Highlights

  • Centralized Constants: A new file, CameraConstants.kt, has been introduced in the core/model module to centralize commonly used constant definitions.
  • FPS Constants Relocation: Constants related to target frame rates (e.g., TARGET_FPS_AUTO, TARGET_FPS_15, TARGET_FPS_30, TARGET_FPS_60) have been moved from various files, such as CameraXCameraSystem.kt and CameraConstraints.kt, to the new CameraConstants.kt file.
  • Video Duration Constant Relocation: The UNLIMITED_VIDEO_DURATION constant has been relocated from JcaSettingsSerializer.kt and CameraAppSettings.kt to CameraConstants.kt.
  • Codebase Update: All affected files across the core/camera, data/settings, and feature/settings modules have been updated to import and utilize these constants from the new centralized CameraConstants.kt file, ensuring a single source of truth.
  • Documentation Refinement: The KDoc for CameraConstraints has been updated to reflect the new constant locations and improve clarity regarding camera capabilities and limitations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraSession.kt
    • Updated imports to use TARGET_FPS_AUTO from the new model module.
  • core/camera/src/main/java/com/google/jetpackcamera/core/camera/CameraXCameraSystem.kt
    • Removed local definitions of FPS and video duration constants.
    • Replaced local constant usages with imports from CameraConstants.kt.
    • Updated unsupportedStabilizationFpsMap to use TARGET_FPS_15 and TARGET_FPS_30.
  • core/camera/src/main/java/com/google/jetpackcamera/core/camera/ConcurrentCameraSession.kt
    • Updated imports to use TARGET_FPS_AUTO from the new model module.
  • core/model/src/main/java/com/google/jetpackcamera/model/CameraConstants.kt
    • Added a new file containing centralized definitions for TARGET_FPS_AUTO, TARGET_FPS_15, TARGET_FPS_30, TARGET_FPS_60, and UNLIMITED_VIDEO_DURATION.
  • data/settings/src/main/java/com/google/jetpackcamera/settings/JcaSettingsSerializer.kt
    • Removed the local definition of UNLIMITED_VIDEO_DURATION and its associated KDoc.
    • Updated its import to refer to CameraConstants.kt.
  • data/settings/src/main/java/com/google/jetpackcamera/settings/model/CameraAppSettings.kt
    • Removed local definitions of TARGET_FPS_AUTO and UNLIMITED_VIDEO_DURATION.
    • Updated their imports to refer to CameraConstants.kt.
  • data/settings/src/main/java/com/google/jetpackcamera/settings/model/Constraints.kt
    • Updated KDoc for CameraConstraints to reflect new constant locations and improve clarity.
    • Removed the Companion object that previously defined FPS constants.
    • Updated supportedFixedFrameRates in TYPICAL_SYSTEM_CONSTRAINTS to use TARGET_FPS_15 and TARGET_FPS_30.
  • data/settings/src/main/java/com/google/jetpackcamera/settings/test/FakeJcaSettingsSerializer.kt
    • Updated imports to reflect the new location of UNLIMITED_VIDEO_DURATION.
  • feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsUiState.kt
    • Removed the local definition of UNLIMITED_VIDEO_DURATION and updated its import.
    • Changed other duration constants to internal visibility.
  • feature/settings/src/main/java/com/google/jetpackcamera/settings/SettingsViewModel.kt
    • Updated imports of FPS constants to refer to the centralized definitions.
    • Removed imports of CameraConstraints.Companion FPS constants.
    • Updated fpsOptions and other usage sites to use TARGET_FPS_ prefixed constants.
  • feature/settings/src/main/java/com/google/jetpackcamera/settings/ui/SettingsComponents.kt
    • Updated imports of FPS and video duration constants to refer to the centralized definitions.
    • Removed imports of CameraConstraints.Companion FPS constants.
    • Updated getTargetFpsTestTag and TargetFpsSetting to use TARGET_FPS_ prefixed constants.
Activity
  • The pull request was created by Kimblebee with the clear intent to centralize constant definitions.
  • The changes involve creating a new file for these constants and updating numerous existing files to use the new centralized source.
  • No specific review comments or further activity are available in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 does a great job of centralizing duplicated constants into a single CameraConstants.kt file, which is a valuable refactoring that improves code maintainability and consistency. The changes are applied cleanly across multiple files. I have identified one critical issue where a logic change seems to have been unintentionally introduced during the refactoring, and one medium-severity suggestion to improve the robustness of a when statement for future maintenance.

Kimblebee and others added 2 commits February 18, 2026 11:07
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

1 participant