You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refine MediaProjection permission and screenshot initiation logic.
This commit implements the following changes:
1. Introduces an `isProcessingExplicitScreenshotRequest` flag in MainActivity
to differentiate between permission requests originating from app startup
versus those from explicit screenshot commands.
2. Modifies `MainActivity.screenshotRequestHandler` to set this flag when
an explicit screenshot request requires permission.
3. Modifies `MainActivity.mediaProjectionLauncher` to only start
`ScreenCaptureService` if the permission was granted as a result of an
explicit request (i.e., the flag is true). The flag is reset afterwards.
4. Restores the call to `requestMediaProjectionPermission()` in
`MainActivity.onCreate()` to ensure permission is prompted at startup
if not already granted. Due to change #3, this no longer auto-starts
the capture service.
5. Confirmed that the `takeScreenshot()` call within
`ScreenCaptureService.startCapture()` is necessary to fulfill the
explicit screenshot request that leads to the service starting. This
is no longer an "unwanted automatic" screenshot but part of the
explicit flow.
This addresses your feedback to:
- Ensure permission is requested at app startup.
- Prevent this startup permission request from automatically taking a screenshot.
- Ensure explicit screenshot requests function correctly.
- Remove any other unintended automatic screenshots.
0 commit comments