adoptium / adoptium-support

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

Windows 11: Notifications vanishes after few seconds. #987

Open sblantipodi opened 8 months ago

sblantipodi commented 8 months ago

Please provide a brief summary of the bug

With previous version of Windows and JDK notification sticked in the Windows Notification Center forever until cancelled.

Since the latest Windows/JDK, notifications vanishes automatically after few seconds.

Code to reproduce the problem

import java.awt.*;

public class Main {
    public static void main(String[] args) throws Exception {
        SystemTray tray = SystemTray.getSystemTray();

        Image image = Toolkit.getDefaultToolkit().createImage("");
        TrayIcon trayIcon = new TrayIcon(image);
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("Demo");
        tray.add(trayIcon);

        trayIcon.displayMessage("Hello, World", "notification demo", TrayIcon.MessageType.INFO);
    }
}

Expected Results

Notifications sent from a TrayIcon should not vanish automatically after few seconds but should stay in the notification center until cancelled by the user.

Actual Results

Notifications sent from a TrayIcon vanishes automatically after few seconds

What Java Version are you using?

21.0.1

What is your operating system and platform?

Windows 11

How did you install Java?

MSI

karianna commented 8 months ago

https://bugs.openjdk.org/browse/JDK-8315647

sblantipodi commented 7 months ago

@karianna thanks for the kind answer, I appreciate it. I know that this isn't the best place where to open this issue but I don't know where to open it and I don't know where to start to fix it. I want to thank you karianna and your team for the great work you are doing here and for the continued help you give to the community, this is much much appreciated.

People from OpenJDK closed this issue with a PASS status but it's obviously not passed since I can reproduce it in all my computers with various JDK versions and various Windows versions :) I opened similar issue in past but my issues has been closed as well with a passed status.

it's sad to see that issues are closed without even testing them since sometimes opening them requires time...

karianna commented 7 months ago

I've added you use case to that issue to see if that helps them repro.

karianna commented 7 months ago

See https://bugs.openjdk.org/browse/JDK-8310352 - this is a Windows issue that will need to be reported to Microsoft.

sblantipodi commented 7 months ago

Thanks for the answer karianna, I appreciate it. One last question if possible.

Java is using a 30 years old API for the notifications. The same API used in Windows 95 (Shell_NotifyIcon).

Microsoft released new APIs for Windows 11 notifications. (ToastNotification).

Is it correct to consider it a Windows issue? Every other languages updated their APIs to use the new Windows APIs, why Java still uses a 30 years old API for such an important feature like OS Notifications?

karianna commented 7 months ago

Thanks for the answer karianna, I appreciate it. One last question if possible.

Java is using a 30 years old API for the notifications. The same API used in Windows 95 (Shell_NotifyIcon).

Microsoft released new APIs for Windows 11 notifications. (ToastNotification).

Is it correct to consider it a Windows issue? Every other languages updated their APIs to use the new Windows APIs, why Java still uses a 30 years old API for such an important feature like OS Notifications?

Might be, I've updated the upstream issue with some MSFT learn docs on the new API

karianna commented 7 months ago

https://bugs.openjdk.org/browse/JDK-8310352 has been updated with a link to the new feature request for toast notifcations

sblantipodi commented 7 months ago

hope to see it implemented in the near future, thank you for your help and for your super great work here karianna, it is much appreciated.

github-actions[bot] commented 4 months 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.

github-actions[bot] commented 1 month 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 1 month ago

https://bugs.openjdk.org/browse/JDK-8323821 for the new feature

sblantipodi commented 1 month ago

something tells me that we will not see it implemented (for the next years) but thanks for linking the new feature request. :)