Community
Participate
Working Groups
Created attachment 282454 [details] Sound recording and playback demo application After a recent macOS upgrade to 10.15.4 (Catalina) java programs launched from within Eclipse can no longer capture data from the local audio and video devices. This occurs for a clean install of Eclipse for Java 2020-03 (eclipse-java-2020-03-R-macosx-cocoa-x86_64.dmg) running with AdoptOpenJDK 13.0.2 or OpenJDK 14.0.1. The symptoms do not include error messages. When launching from within Eclipse the received device data is all zero's, which is silence for audio and black for video. The same program runs correctly from an iTerm bash shell using the command line generated from the Eclipse run configuration. One work-around to the problem is to launch the Eclipse application from an iTerm bash shell command line. When using this work-arounds, the audio and video data are captured correctly. macOS Catalina changes in permissions is the likely culprit. With Catalina, there are additional requirements for applications to explicitly request permissions for mic and camera usage. This is accomplished by adding entries the Info.plist file of any installed application. The two related entries that are required are: <key>NSMicrophoneUsageDescription</key> <string>Need microphone access for uploading videos</string> <key>NSCameraUsageDescription</key> <string>Need camera access for uploading Images</string> The same java app launched from within Intellij works correctly. Intellij does include these Info.plist entries, which may explain why. See the following for more details on this new Apple requirement: https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos. Locally I am not able to confirm these Info.plist entires will fix the issue because I cannot modify the entires prior to installing the application. When I attempt to do so the install fails digital signature verification. Modifying Info.plist after installation seems to have no effect. An open source demo application with which I was able recreate this problem is attached to this report. Launched from within Eclipse, recording with this demo only plays silence. Running the same demo from the command line records from the system mic and plays it back.
The signing with entitlements is something that's part of the releng process.
@Lakshmi, Do you have an idea about these entries in Info.plist? can you please check this requirement? Thanks
Can you create a gerrit patch with changes? Here is the link for infoe.plist. https://git.eclipse.org/c/equinox/rt.equinox.framework.git/tree/features/org.eclipse.equinox.executable.feature/bin/cocoa/macosx/x86_64/Eclipse.app/Contents/Info.plist Thanks
(In reply to Sravan Kumar Lakkimsetti from comment #2) > @Lakshmi, Do you have an idea about these entries in Info.plist? can you > please check this requirement? > From the documentation this is requirement since 10.14. I tried to add the entries to Info.plist and run the example but as mentioned in description, it didn't seem to have an effect. I'm not sure, but may be the Info.plist gets cached and so the changes don't have any effect. We can try the changes in a build and see if it fixes the problem.
(In reply to Lakshmi Shanmugam from comment #4) > (In reply to Sravan Kumar Lakkimsetti from comment #2) > > @Lakshmi, Do you have an idea about these entries in Info.plist? can you > > please check this requirement? > > > > From the documentation this is requirement since 10.14. I tried to add the > entries to Info.plist and run the example but as mentioned in description, > it didn't seem to have an effect. I'm not sure, but may be the Info.plist > gets cached and so the changes don't have any effect. > We can try the changes in a build and see if it fixes the problem. That would be a good idea. Lets try that
I found additional important information. In addition to the Info.plist of the bundled app, the Entitlements must be set when the app bundle is signed. If a process has the Info.plist entries, but does not have the associated entitlements, it will be terminated by macos when it requests access. Here are the relevant entitlements missing from Eclipse 2020-03 for audio and camera resources: <key>com.apple.security.device.audio-input</key> <true/> <key>com.apple.security.device.camera</key> <true/> The Apple developer website shows a list of other useful resource request entitlements here, under 'See Also - Resource Access': https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_device_audio-input I check the entitlements for my local Eclipse 2020-03 install: run 'codesign -d --entitlements :- /Applications/Eclipse-2020-03.app/' Executable=/Applications/Eclipse-2020-03b.app/Contents/MacOS/eclipse <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.security.cs.allow-jit</key> <true/> <key>com.apple.security.cs.allow-unsigned-executable-memory</key> <true/> <key>com.apple.security.cs.disable-executable-page-protection</key> <true/> <key>com.apple.security.cs.allow-dyld-environment-variables</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/> <key>com.apple.security.cs.debugger</key> <true/> </dict>
It is working for microphone access with the following Info.plist entry: <key>NSMicrophoneUsageDescription</key> <string>To enable audio input for recording in Eclipse, click OK (recommended). You can also enable audio input later in System Preferences > Security & Privacy > Privacy > Microphone.</string> The app needs to be codesigned after changing the Info.plist. I verified this with macos 11.1 and Eclipse Version: 2020-09 (4.17.0) Build id: 20200910-1200 The keys needed for camera access, etc. may be found in this document: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW25