ScheduleOSUpdate command will trigger update on iOS device immediately if it is already "scheduled for later"

Number:rdar://45414727 Date Originated:October 19 2018
Status:Open Resolved:
Product:iOS + SDK Product Version:
Classification:MDM Reproducible:Always

The MDM ScheduleOSUpdate only returns with a Status of Idle, Downloading, UpdateAvailable, or Installing (and others). However, if a passcode exists on the device, the user can schedule the update for later, at which the MDM status returns "Installing".

However, if one more ScheduleOSUpdate is sent (with Default, or InstallASAP as the InstallAction), the update is triggered IMMEDIATELY, which is undocumented, unexpected behavior.

Steps to reproduce:
- iOS device (not on latest version) with passcode configured.
- Send "ScheduleOSUpdate" with InstallAction of Default
- When upgrade notification appears on device, schedule update for later (between 1AM and 3AM). 
- Send MDM command "OSUpdateStatus" 
- Note that status is "Installing"
- Send MDM command "ScheduleOSUpdate" again 

Actual behavior
- Device begins update IMMEDIATELY.

Expected behavior: 
- Device should not be forced to upgrade immediately, since the user has entered the passcode agreeing to a LATER update, not explicit permission for the MDM to upgrade whenever. 
- Device should return a different status of "Scheduled"


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!