JDK-8315647 : Notification no longer appears in the Windows 11 notification center
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,17,20,21
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2023-08-30
  • Updated: 2024-01-17
  • Resolved: 2024-01-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 11 and Windows 10
Problem happen on JDK17, 20 and 21ea.

A DESCRIPTION OF THE PROBLEM :
Notification no longer appears in the Windows 11 notification center after automatically disappear.
The notification still appears in the Windows 10 notification center after automatically disappear.

REGRESSION : Last worked in version 11.0.20

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run example.
2. Click button to show notification.
3. Wait until notification disappears automatically.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The notification still appears in notification center.
ACTUAL -
The notification still appears in notification center under Windows 10.
The notification is no longer displayed in the notification center under Windows 11.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

public class Main {
    public static void main(String[] args) throws Exception {
        var frame = new Frame("Notification Example");
        var button = new Button("Notify");
        frame.add(button);
        var image = new BufferedImage(32, 32, BufferedImage.TYPE_4BYTE_ABGR);
        var trayIcon = new TrayIcon(image);
        SystemTray.getSystemTray().add(trayIcon);

        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                e.getWindow().dispose();
                System.exit(0);
            }
        });
        button.addActionListener(e -> {
            trayIcon.displayMessage("Hello World", "Lorem ipsum", TrayIcon.MessageType.INFO);
        });

        frame.pack();
        frame.setVisible(true);
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
no workaround found

FREQUENCY : always



Comments
Discussion on the client-libs-dev mailing list: https://mail.openjdk.org/pipermail/client-libs-dev/2024-January/016817.html
09-01-2024

This is an exact duplicate of JDK-8310352. Nothing has changed since August 2023, it is how Windows 11 handles balloon notifications for notification icons. If you compile the NotificationIcon Sample [1][2], you'll see the same behaviour. Therefore it's not a Java problem. To build and compile the sample, you can use the following sparse checkout of Microsoft samples: git clone --filter=blob:none --sparse https://github.com/microsoft/Windows-classic-samples.git windows-samples cd windows-samples git sparse-checkout add Samples/Win7Samples/winui/shell/appshellintegration/NotificationIcon Navigate to the NotificationIcon folder and open NotificationIcon.sln in Visual Studio to compile and run it. If required, I can attach the compiled version of the application. [1] https://learn.microsoft.com/en-us/windows/win32/shell/samples-notificationicon [2] https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/Win7Samples/winui/shell/appshellintegration/NotificationIcon
08-01-2024

An Eclipse Adoptium user also reported this issue with the following (very similar) repro: ### 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
07-01-2024

Checked with attached testcase in Window10, Test result in Windows 10 ================== 8u381: Pass jdk11: Pass jdk17: Pass jdl20: Pass jdk 21ea35: Pass
04-09-2023