Skip to content

Fixes: ViewModelFactory casting, billing setup, accessibility/events, serialization opt-ins, and UI/stability tweaks#62

Merged
Android-PowerUser merged 1 commit intocodex/analyze-technical-debt-and-complexity-o6bm9pfrom
codex/identify-technical-debt-and-complexity
Mar 26, 2026
Merged

Fixes: ViewModelFactory casting, billing setup, accessibility/events, serialization opt-ins, and UI/stability tweaks#62
Android-PowerUser merged 1 commit intocodex/analyze-technical-debt-and-complexity-o6bm9pfrom
codex/identify-technical-debt-and-complexity

Conversation

@Android-PowerUser
Copy link
Copy Markdown
Owner

Motivation

  • Remove fragile casts and improve ViewModel creation flow while adding better Live API fallback handling for photo reasoning.
  • Update Google Play Billing initialization to the modern PendingPurchasesParams API and harden background/foreground service behavior for screen capture and WebRTC.
  • Improve serialization for polymorphic DTOs by opting into experimental serialization where needed and reduce runtime crashes from UI/file operations and image handling.
  • Harden accessibility event handling and various UI interactions to provide clearer logs, safer defaults, and better error reporting.

Description

  • Reworked the ViewModelProvider.Factory implementation to rename the parameter to modelClass, construct the ViewModel via with(modelClass) and return it using modelClass.cast(...), and added LiveApi fallback handling for PhotoReasoningViewModel when live models are selected.
  • Updated billing initialization to use PendingPurchasesParams.newBuilder().enableOneTimeProducts() and added the corresponding import.
  • Added @OptIn(ExperimentalSerializationApi::class) to multiple polymorphic DTO sealed classes used for Mistral/Puter/Service payloads to avoid serialization runtime issues.
  • Improved ScreenCaptureService (new actions/constants, more robust display metrics handling on API >= R, safer ImageReader/VirtualDisplay initialization) and added explicit error handling and logging.
  • Hardened ScreenOperatorAccessibilityService by removing a problematic flag, restructuring onAccessibilityEvent into a when switch, refreshing the root node with rate-limiting, improving logs and button-name inference capitalization.
  • PhotoReasoning/UI changes including switching to Icons.AutoMirrored.Filled.Send, replacing Divider with HorizontalDivider, making dialog callbacks explicit/unused-parameter suppressed, adding OOM handling during file import, and adding a "Skip All" option to overwrite confirmation.
  • PhotoReasoningViewModel adjustments include opt-ins for serialization, improved context handling and logging in sendMessageWithRetry, WebRTC MediaProjection callback signature tweaks, and various suppressed unused parameters.
  • Utility tweaks: ImageUtils.bitmapToBase64 uses PNG and ignores the quality parameter with a suppression, and deleteFile return logic and logging were cleaned up.
  • SignalingClient.postTask now includes the hasScreenshot flag in posted task data.

Testing

  • Performed a debug build with ./gradlew assembleDebug which completed successfully.
  • Ran unit tests with ./gradlew test and the test suite passed.
  • Ran ./gradlew lint and addressed warnings relevant to the modified areas, with no new critical lint errors reported.
  • Manually exercised core flows in a local debug run (menu navigation, photo reasoning entry, billing client startup) to verify no immediate crashes after changes.

Codex Task

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer bot left a comment

Choose a reason for hiding this comment

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

The code changes in this PR are clean and properly implemented. The migration from deprecated enablePendingPurchases() to the new PendingPurchasesParams builder pattern follows Google Play Billing Library best practices. The import addition and warning suppression are appropriate. No blocking issues found.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@Android-PowerUser Android-PowerUser merged commit 610d328 into codex/analyze-technical-debt-and-complexity-o6bm9p Mar 26, 2026
1 check passed
@Android-PowerUser Android-PowerUser deleted the codex/identify-technical-debt-and-complexity branch March 26, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant