[DeviceNotifications] Keep last message for each device

Authored by bruns on Jul 7 2019, 6:02 PM.



Ejecting e.g. a USB stick removes it from the bus (bus power is removed),
but the last notification should be kept, otherwise a message like
"The device can be savely removed" immediately disappears.

Unfortunately it is almost impossible to tell when a device has been
physically removed (only indirectly, when a new device is plugged into
the same port), so allow some small leakage - in case the same device is
later replugged, no leakage happens.

Test Plan

Card reader:
1.insert medium, mount, unmount

-> message "Device can be savely removed" is shown in device notifier

for 5 seconds

  1. eject medium, reinsert -> device appears without message and with default label

Diff Detail

R120 Plasma Workspace
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Jul 7 2019, 6:02 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 7 2019, 6:02 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
bruns requested review of this revision.Jul 7 2019, 6:02 PM
ngraham accepted this revision.Jul 7 2019, 6:38 PM

I just noticed this a few days ago and it was annoying me. I tested with three flash drives and an external hard drive. Three correctly removed the notice after the disk was actually physically removed, and one removed it after the 5 second timeout. So I think the logic there seems robust enough.

This revision is now accepted and ready to land.Jul 7 2019, 6:38 PM
This revision was automatically updated to reflect the committed changes.