Merge "Fix wrong waitingOnAMSLockEnded()."