Skip to content

[windows] 麦克风权限状态不应无条件显示已授权 #16

Closed

Description

@Cooper-X-Oak

现象

  • 触发条件:Windows 上打开 OpenLess,进入首次运行或设置页权限检查。
  • 当前表现:check_microphone_permission 和 request_microphone_permission 在非 macOS 分支直接返回 Granted,即使系统麦克风权限关闭、无默认输入设备或录音流启动失败,UI 仍显示“已授权”。
  • 证据:openless -all/app/src-tauri/src/permissions.rs 的非 macOS 实现:
pub fn check_microphone() -> PermissionStatus {
    PermissionStatus::Granted
}

pub fn request_microphone() -> PermissionStatus {
    PermissionStatus::Granted
}

App.tsx 会把 granted 视为门禁通过,因此 Windows 上会跳过 onboarding。

影响

  • Windows 用户看到“麦克风已授权”,但实际录音可能完全无响应或在开始录音后才失败。
  • 权限问题被延迟到 Recorder::start / cpal 错误,用户无法从设置页修复。
  • 自动化测试和人工验证会误判权限状态,无法稳定复现“录音无响应”的根因。

建议接受标准

  • Windows 分支不再无条件返回 Granted。
  • 至少通过默认输入设备探测或一次可控的 cpal 权限/设备检查区分 granted、denied、notDetermined 或可操作错误。
  • 设置页和 onboarding 能展示 Windows 上真实的麦克风不可用状态。
  • 当权限或设备不可用时,开始录音前给出明确错误提示,而不是进入无响应状态。

TODO / 不确定项

  • TODO:确认 Windows 目标系统版本下是否优先接入 Windows Runtime microphone capability 查询,还是先用 cpal 设备/stream 检测兜底。

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions