Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-05-01 Thread Sergey Bylokhov
On Sat, 1 May 2021 11:26:39 GMT, Prasanta Sadhukhan  
wrote:

> Please confirm if it is working in 10.14 and in multiscreen environment. 
> Also, I guess a testcase can be written to see if notification center is 
> coming up for normal awt non-trayicon app(obscuring normal awt window or not)

I cannot confirm that it works on 10.14 since I do not have such a system, this 
is why in the description of this PR I requested to check the fix by someone on 
10.14/10.15. Thanks to Alexander who confirm it on 10.15.

To test this functionality the user will need to enable the notification 
center, which should be disabled by default for the execution of our tests, 
then checks that the "Do not disturb" is not set for the current time, remove 
the java from the allow/disallow list. And then the user should return all that 
back. If some step will be skipped it will affect the tests executed after. I 
prefer do not to request that.

> BTW, I see from 
> https://developer.apple.com/documentation/foundation/nsusernotificationcenter?language=objc
> that this class is deprecated, so I think we should not use this way of 
> notifying user and find some other alternative or do away with this or else 
> we will get new problems like this in newer releases.

I know, this information is already in the jbs. When we will move further from 
the macOS10.14 in our JDK trains we probably should migrate to the new API.

-

PR: https://git.openjdk.java.net/jdk/pull/3707


Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-05-01 Thread Alexander Zuev
On Tue, 27 Apr 2021 01:09:44 GMT, Sergey Bylokhov  wrote:

> The fix for the JDK-8187639 reimplemented the tray icon messages using the 
> standard notification center, it worked fine on macOS 10.9. But on the new 
> macOS, the usage of that API requests permission from the user. Since the 
> code was added to the NSApplicationAWT this request is always shown even if 
> the app does not use tray icons. This fix moves the code to the tray icon 
> itself. I have tested this on macOS 11.2. It will be good if someone can 
> check macOS 10.14 or macOS 10.15.

Marked as reviewed by kizune (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/3707


Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-05-01 Thread Prasanta Sadhukhan
On Tue, 27 Apr 2021 01:09:44 GMT, Sergey Bylokhov  wrote:

> The fix for the JDK-8187639 reimplemented the tray icon messages using the 
> standard notification center, it worked fine on macOS 10.9. But on the new 
> macOS, the usage of that API requests permission from the user. Since the 
> code was added to the NSApplicationAWT this request is always shown even if 
> the app does not use tray icons. This fix moves the code to the tray icon 
> itself. I have tested this on macOS 11.2. It will be good if someone can 
> check macOS 10.14 or macOS 10.15.

Please confirm if it is working in 10.14 and in multiscreen environment. Also, 
I guess a testcase can be written to see if notification center is coming up 
for normal awt non-trayicon app(obscuring normal awt window or not)

BTW, I see from 
https://developer.apple.com/documentation/foundation/nsusernotificationcenter?language=objc
 
that this class is deprecated, so I think we should not use this way of 
notifying user and find some other alternative or do away with this or else we 
will get new problems like this in newer releases. 

I think we should use 
https://developer.apple.com/documentation/usernotifications?language=objc 
"UNUserNotificationCenter" instead which is the favoured way since Mohave, it 
seems.

-

PR: https://git.openjdk.java.net/jdk/pull/3707


Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-04-29 Thread Victor Dyakov
On Tue, 27 Apr 2021 01:09:44 GMT, Sergey Bylokhov  wrote:

> The fix for the JDK-8187639 reimplemented the tray icon messages using the 
> standard notification center, it worked fine on macOS 10.9. But on the new 
> macOS, the usage of that API requests permission from the user. Since the 
> code was added to the NSApplicationAWT this request is always shown even if 
> the app does not use tray icons. This fix moves the code to the tray icon 
> itself. I have tested this on macOS 11.2. It will be good if someone can 
> check macOS 10.14 or macOS 10.15.

@prsadhuk  please review

-

PR: https://git.openjdk.java.net/jdk/pull/3707


Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-04-28 Thread Alexander Zvegintsev
On Tue, 27 Apr 2021 01:09:44 GMT, Sergey Bylokhov  wrote:

> The fix for the JDK-8187639 reimplemented the tray icon messages using the 
> standard notification center, it worked fine on macOS 10.9. But on the new 
> macOS, the usage of that API requests permission from the user. Since the 
> code was added to the NSApplicationAWT this request is always shown even if 
> the app does not use tray icons. This fix moves the code to the tray icon 
> itself. I have tested this on macOS 11.2. It will be good if someone can 
> check macOS 10.14 or macOS 10.15.

I've checked it on `10.15.7`.
before the fix - permission request appears immediately.
after the fix - permission request appears after using `TrayIcon`.

-

Marked as reviewed by azvegint (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3707


Re: RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-04-28 Thread Victor Dyakov
On Tue, 27 Apr 2021 01:09:44 GMT, Sergey Bylokhov  wrote:

> The fix for the JDK-8187639 reimplemented the tray icon messages using the 
> standard notification center, it worked fine on macOS 10.9. But on the new 
> macOS, the usage of that API requests permission from the user. Since the 
> code was added to the NSApplicationAWT this request is always shown even if 
> the app does not use tray icons. This fix moves the code to the tray icon 
> itself. I have tested this on macOS 11.2. It will be good if someone can 
> check macOS 10.14 or macOS 10.15.

@prrace @prsadhuk @azvegint Please review

-

PR: https://git.openjdk.java.net/jdk/pull/3707


RFR: 8264786: [macos] All Swing/AWT apps cause Allow Notifications prompt to appear when app is launched

2021-04-27 Thread Sergey Bylokhov
The fix for the JDK-8187639 reimplemented the tray icon messages using the 
standard notification center, it worked fine on macOS 10.9. But on the new 
macOS, the usage of that API requests permission from the user. Since the code 
was added to the NSApplicationAWT this request is always shown even if the app 
does not use tray icons. This fix moves the code to the tray icon itself. I 
have tested this on macOS 11.2. It will be good if someone can check macOS 
10.14 or macOS 10.15.

-

Commit messages:
 - Initial fix

Changes: https://git.openjdk.java.net/jdk/pull/3707/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3707&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264786
  Stats: 24 lines in 4 files changed: 9 ins; 9 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3707.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3707/head:pull/3707

PR: https://git.openjdk.java.net/jdk/pull/3707