Skip to content

fix(windows): check microphone permission status via AppCapability - #1589

Open
MrSpy00 wants to merge 1 commit into
Baseflow:mainfrom
MrSpy00:fix/windows-microphone-permission
Open

MrSpy00 wants to merge 1 commit into
Baseflow:mainfrom
MrSpy00:fix/windows-microphone-permission

Conversation

@MrSpy00

@MrSpy00 MrSpy00 commented Nov 23, 2026

Copy link
Copy Markdown

checkPermissionStatus and
equestPermissions on Windows currently return GRANTED unconditionally for every permission group, so disabling microphone access in Windows Privacy settings has no effect on Permission.microphone.status.

This queries Windows::Security::Authorization::AppCapabilityAccess::AppCapability::Create(Lmicrophone).CheckAccess() for PermissionGroup::MICROPHONE and maps:

  • Allowed -> GRANTED
  • DeniedBySystem -> RESTRICTED
  • DeniedByUser / UserPromptRequired / NotDeclaredByApp (and winrt::hresult_error fallback) -> DENIED

Other permission groups keep their existing behavior.

Fixes #1507

Pre-launch Checklist

  • I made sure the project builds. ( lutter build windows --debug in permission_handler_windows/example)
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran lutter analyze and fixed any errors.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Windows runtime validation is still needed to confirm that AppCapability reflects both microphone privacy toggles and returns to granted access when re-enabled in unpackaged Flutter apps.

No open issues 🎉

What changed in this PR

Addresses #1507 by checking Windows microphone access through AppCapability instead of always reporting it as granted. Other permission groups retain their existing behavior.

Changes:

  • Shares microphone status checking between checkPermissionStatus and requestPermissions, mapping access results and WinRT errors to permission statuses.
  • Adds integer argument validation for checkPermissionStatus.
File Description
permission_handler_windows/​windows/​permission_handler_windows_plugin.cpp Adds AppCapability-based microphone checks and permission argument validation.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows 11 microphone permission not checked correctly

2 participants