Skip to content

Add on-device AI image enhancement feature to enhance images#194

Merged
MayuriKhinvasara merged 8 commits into
mainfrom
mediaenhancement
Jul 1, 2026
Merged

Add on-device AI image enhancement feature to enhance images#194
MayuriKhinvasara merged 8 commits into
mainfrom
mediaenhancement

Conversation

@MayuriKhinvasara

Copy link
Copy Markdown
Contributor

Add on-device AI image enhancement feature to enhance images on the Chat screen.

Major changes:

  • Integrate the Google Play Services Media Effect Enhancement library to support on-device AI processing.
  • Implement ImageEnhancementScreen and EnhancementViewModel to handle image enhancement features, including tonemapping, deblurring, and upscaling.
  • Add EnhancementUtils.kt providing coroutine-based wrappers for enhancement session management, bitmap processing, and module installation.

Minor changes:

  • Add an "AI Enhance" action button to image bubbles within the chat UI.
  • Update the ChatMessage model to include a unique ID and add support for updating media URIs in the ChatRepository and MessageDao.
  • Define navigation logic for the new enhancement pane in Main.kt and SocialiteNavigation.kt.
  • Update the README to include documentation for the Media Effect Enhancement integration.

…hat screen

Major changes:
- Integrate the Google Play Services Media Effect Enhancement library to support on-device AI processing.
- Implement `ImageEnhancementScreen` and `EnhancementViewModel` to handle image enhancement features, including tonemapping, deblurring, and upscaling.
- Add `EnhancementUtils.kt` providing coroutine-based wrappers for enhancement session management, bitmap processing, and module installation.

Minor changes:
- Add an "AI Enhance" action button to image bubbles within the chat UI.
- Update the `ChatMessage` model to include a unique ID and add support for updating media URIs in the `ChatRepository` and `MessageDao`.
- Define navigation logic for the new enhancement pane in `Main.kt` and `SocialiteNavigation.kt`.
- Update the README to include documentation for the Media Effect Enhancement integration.

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

Copy link
Copy Markdown

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 adds on-device AI image enhancement features (tonemapping, deblurring, and upscaling) using Google Play Services, introducing a new enhancement screen, ViewModel, and database updates to persist enhanced image URIs. The review feedback identifies several critical issues: a data loss bug where saving an enhanced image deletes all other enhanced images in the chat history, thread safety issues with concurrent access to enhancementSession, and incorrect coroutine continuation handling during module installation. Additionally, the reviewer recommends removing silent background module downloads to conserve data, avoiding passing short-lived Context objects to the ViewModel to prevent memory leaks, and catching Throwable to safely handle OutOfMemoryError during bitmap decoding.

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.

…hat screen

Major changes:
- Integrate the Google Play Services Media Effect Enhancement library to support on-device AI processing.
- Implement `ImageEnhancementScreen` and `EnhancementViewModel` to handle image enhancement features, including tonemapping, deblurring, and upscaling.
- Add `EnhancementUtils.kt` providing coroutine-based wrappers for enhancement session management, bitmap processing, and module installation.

Minor changes:
- Add an "AI Enhance" action button to image bubbles within the chat UI.
- Update the `ChatMessage` model to include a unique ID and add support for updating media URIs in the `ChatRepository` and `MessageDao`.
- Define navigation logic for the new enhancement pane in `Main.kt` and `SocialiteNavigation.kt`.
- Update the README to include documentation for the Media Effect Enhancement integration.
…ncement

# Conflicts:
#	app/build.gradle.kts
#	app/src/main/java/com/google/android/samples/socialite/repository/ChatRepository.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/Main.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/chat/component/MessageBubble.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementUtils.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementViewModel.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/ImageEnhancementScreen.kt
…ncement

# Conflicts:
#	app/build.gradle.kts
#	app/src/main/java/com/google/android/samples/socialite/repository/ChatRepository.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/Main.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/chat/component/MessageBubble.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementUtils.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementViewModel.kt
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/ImageEnhancementScreen.kt
…ncement

# Conflicts:
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementUtils.kt
…ncement

# Conflicts:
#	app/src/main/java/com/google/android/samples/socialite/ui/mediaenhancement/EnhancementUtils.kt
Major changes:
- Integrate Glide Compose to render enhanced images in `ImageEnhancementScreen`.

Minor changes:
- Add Glide and Glide Compose dependencies to `build.gradle.kts` and `libs.versions.toml`.
- Configure `GlideImage` to skip memory and disk caching when loading in-memory bitmaps to avoid unnecessary overhead.
@MayuriKhinvasara
MayuriKhinvasara merged commit 9f91163 into main Jul 1, 2026
7 checks passed
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