adoptium / adoptium-support

For end-user problems reported with our binary distributions
Apache License 2.0
46 stars 15 forks source link

macOS: How to request microphone access? #281

Closed tresf closed 2 years ago

tresf commented 3 years ago

Question

Why won't Java ask for Microphone access? How does one package a Java application so that will properly ask for permission to use the microphone?

Please see the following unit test: https://github.com/tresf/SoundRecorder.

Test Pass/Fail Details
Terminal :white_check_mark: PASS javac SoundRecorder.java && java SoundRecorder, from Terminal, it works.
Reset with: sudo tccutil reset Microphone com.apple.Terminal
IntelliJ :white_check_mark: PASS From the Project Explorer, Right Click SoundRecorder.java, Run. It works.
Reset with: sudo tccutil reset Microphone com.jetbrains.intellij.ce
Bundle :no_entry_sign: FAIL ./package.sh, double-click SoundRecorer.app. It doesn't work.

Passing criteria:

Some initial observations:

Java version tested:

Some general questions:

Related questions:

Note: Big Sur can have caching issues between signing steps.

tresf commented 3 years ago

Some general questions:

  • Are entitlements required for Microphone access to work?

This Unity thread suggests they may be needed:

Quoting:

We discovered that in addition to ensuring NSMicrophoneUsageDescription was in the plist in the mac app bundle package Contents when built, these entitlements also needed to be set:

com.apple.security.device.audio-input
com.apple.security.device.microphone

Then the signtool must be run (and a cert may be required)

... however signing with these entitlements alone doesn't seem to fix the symptom.

github-actions[bot] commented 2 years ago

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

karianna commented 2 years ago

Fixed in 17.0.2 (but not backported)