- Extended ScreenCaptureManager interface with getMediaProjection() and getScreenDensity()
- Implemented MediaProjection sharing in ScreenCaptureManagerImpl
- Fixed LongScreenshotCapture initialization with proper MediaProjection access
- Simplified captureFrame() method to directly acquire images from ImageReader
- Added proper initialization checks and error handling in ScreenCaptureService
This resolves the "Cannot start collection - not initialized" error by ensuring
LongScreenshotCapture is properly initialized with the shared MediaProjection
instance during ScreenCaptureService startup.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Applied user's preferred coding conventions:
- Braces on new line (opening { goes below function/statement)
- Local variables in snake_case for better distinction:
* display_metrics (instead of displayMetrics)
* window_manager (instead of windowManager)
* captured_image (instead of image)
Benefits:
- Improved readability at a glance
- Clear distinction between member variables, parameters, and locals
- Consistent style throughout the new architecture components
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Created ScreenCaptureManager interface and ScreenCaptureManagerImpl to separate
screen capture concerns from ScreenCaptureService, improving architecture:
## New Files:
- ScreenCaptureManager.kt: Interface defining screen capture operations
- ScreenCaptureManagerImpl.kt: Implementation handling MediaProjection lifecycle
## Changes to ScreenCaptureService.kt:
- Remove direct MediaProjection/ImageReader/VirtualDisplay handling
- Use ScreenCaptureManager via dependency injection pattern
- Delegate screen capture operations to manager
- Get screen dimensions from manager instead of storing locally
- Proper manager lifecycle with release() in onDestroy()
## Benefits:
- Single Responsibility Principle: Service focuses on orchestration
- Testability: Screen capture logic can be unit tested in isolation
- Maintainability: Clear separation of concerns
- Reusability: Manager can be used by other components
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>