Ensure media projection guards and correct display import#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private fun buildVirtualDisplayFlags(option: ConnectionOption): Int { | ||
| var flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR or DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION | ||
| if (option != ConnectionOption.USB_C) { | ||
| flags = flags or DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | ||
| } | ||
| if (lowLatency && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
| flags = flags or DisplayManager.VIRTUAL_DISPLAY_FLAG_TRUSTED | ||
| } |
There was a problem hiding this comment.
Remove privileged TRUSTED flag from virtual display
When buildVirtualDisplayFlags adds DisplayManager.VIRTUAL_DISPLAY_FLAG_TRUSTED whenever low-latency mode is on (the default), createVirtualDisplay will throw SecurityException on Android 13+ because normal apps do not hold android.permission.ADD_TRUSTED_DISPLAY. As a result the mirroring service crashes immediately on start for modern devices unless users manually disable low latency. Consider omitting this flag or gating it behind the privileged permission.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task