com.apple.screenIsLocked notification fires when screensaver or sleep begins even if "require password after sleep or screensaver begins" is set to something other than "immediately" in System Preferences

Originator:kane.cheshire
Number:rdar://26264008 Date Originated:13 May 2016
Status:Open Resolved:
Product:OS X SDK Product Version:10.11.4
Classification:Other bug Reproducible:Always
 
Summary:
When the screensaver or screen sleeps, the com.apple.screenIsLocked NSDistributedNotificationCenter notification fires regardless of what is set for "require password after sleep or screensaver begins" in System Preferences > Security & Privacy, so long as the checkbox next to that setting is checked.

Steps to Reproduce:
1. Set up a simple Xcode project, register for the notification with the NSDistributedNotificationCenter as so: 

[NSDistributedNotificationCenter.defaultCenter addObserver:self
                                                    selector:@selector(screenDidLock)
                                                        name:@"com.apple.screenIsLocked"
                                                      object:nil];

2. In System Preferences, check the box next to "require password after sleep or screensaver begins" and set it to require a password for anything other than "immediately"

3. Run the Xcode project and allow the screen to sleep before what was set in the previous step

4. Note that the notification fires even though the screen is not locked and does not ask the user for a password

Expected Results:
The notification should not fire as the screen is not locked and the user is not required to enter a password

Actual Results:
The notification fires even though the user is not required to enter a password and the screen is not locked

Version:
OS X 10.11.4 (15E65), all Mac models

Notes:


Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!