Add opt-in Android prepared consent flow for global recording#26
Open
ananjaemin wants to merge 6 commits into
Open
Add opt-in Android prepared consent flow for global recording#26ananjaemin wants to merge 6 commits into
ananjaemin wants to merge 6 commits into
Conversation
Open
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an opt-in Android prepared consent flow for global screen recording.
Currently, Android asks for MediaProjection consent when
startGlobalRecording()is called. That works for the existing flow, but it makes it difficult for apps that need to request screen recording consent first, move the user through another screen or setup step, and start recording later without showing the system consent dialog again.This PR introduces a prepared consent lifecycle for that use case while keeping the existing
startGlobalRecording()behavior unchanged by default.What Changed
Android
requestScreenRecordingConsent()to request MediaProjection consent before recording starts.ScreenRecordingService:idlepreparedrecordingreleaseScreenRecordingConsent()to release a prepared session when the app no longer needs it.isScreenRecordingConsentGranted()andgetScreenRecordingSessionState()for checking the prepared/recording state.usePreparedConsentto the existingstartGlobalRecording().optionsobject.usePreparedConsentistrue, Android starts recording from the prepared MediaProjection session instead of showing the consent dialog again.usePreparedConsentis missing orfalse, the existing global recording flow is preserved.iOS
requestScreenRecordingConsent()resolves totrue.releaseScreenRecordingConsent()does nothing.isScreenRecordingConsentGranted()returnsfalse.getScreenRecordingSessionState()returns"idle".JS API
Added:
Extended the existing
startGlobalRecording().optionsobject:usePreparedConsentdefaults tofalse, so existing users do not need to change their code.Example
Documentation
startGlobalRecordingdocs to includeoptions.usePreparedConsent.input.options.Why This Is Opt-In
This is intentionally not enabled automatically.
Existing calls like this keep the current behavior:
The prepared flow is only used when the caller explicitly passes:
usePreparedConsent: trueIf
usePreparedConsentistruebut no prepared Android session exists,onRecordingErrorreceives:Example Usage
If the user leaves the flow before recording starts:
Backward Compatibility
startGlobalRecording()behavior is unchanged by default.usePreparedConsentis optional and defaults tofalse.usePreparedConsentis added to the existingoptionsobject; this PR does not introduce a new top-level options shape.Verification
Verified:
yarn typecheckyarn lintgit diff --check