On 8/24/2021 6:08 AM, Filteredaccount1 wrote:
Hi Andy,

During the wait for JDK 18, would it be possible to describe on the bug ticket 
what manual workaround steps are required to apply to an existing jPackaged app 
for distribution both inside and outside the app store?

The instructions for working around this bug as described are in public comment in https://bugs.openjdk.java.net/browse/

The related app-store specific change is in the default entitlements file.  I will add comment to JDK-8272639. explaining how to work around that issue by using the --entitlements option.

There is one Info.plist for the app (<name>.app/Contents/Info.plist) and another for the runtime (<name>.app/Contents/runtime/Contents/Info.plist).

Only the first one is relevant here.  The key <key>NSMicrophoneUsageDescription</key> belongs in the entitlements file (not the Info.plist).

The default entitlements file for an app-store targeted app is src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/sandbox.plist , <https://github.com/openjdk/jdk/pull/5186/files#diff-064af7746a071efb64f850693ba0a83822ce96219333055600fdd9e42f878fc9>but that can be overridden using the --mac-entitlements option.

One final thing to note, MacOS keeps track of what you have ever previously granted microphone permission to (and will never ask again) based on the mac package identifier (which defaults to the main class name), so I explicitly set this using a shell script with jpackage option "--mac-package-identifier audio-$1" option, so I can pass in different values and create a unique one each time.

Hope this helps.

/Andy


There are two info.plist files inside a jPackaged app. In my experience adding 
keys to both didn’t turn the ask microphone permissions on.

<key>com.apple.security.device.audio-input</key>
<true/>

<string>The application is requesting access to the microphone.</string>

Also, I raised at http://bugreport.java.com/ 9071230. So developer time isn’t 
wasted, could this be cancelled? (seems setup so the general public cannot).

I can't see this issue, so it must already have been removed.

/Andy


Thank You,

Ben S.


Date: Wed, 18 Aug 2021 08:43:08 -0400
From: Andy Herrick <andy.herr...@oracle.com>
To: core-libs-dev@openjdk.java.net
Subject: Re: JPackage and ask for microphone permissions broken on
    OSX...
Message-ID: <1534b02b-262a-f338-aae5-d1693d007...@oracle.com>
Content-Type: text/plain; charset=utf-8; format=flowed

OK - I have reproduced this problem, filed an issue, and found the fix.

You can see the issue in https://bugs.openjdk.java.net/browse/JDK-8272639.

Basically another key is needed in application plist to cause
application to ask for microphone access.

It is far to late to get any fix into JDK17, but I will fix in JDK18 and
you can work around this issue in JDK17 (or JDK16) by using the
--resource-dir option:

Reply via email to