It is based on a pending I485. As long as you have a pending I485, you are qualified to apply for EAD and AP. It has nothing to do with I140 approval. Of course, your I485 is based on your I140, if I140 is denied, your I485 becomes invalid simultaneously,hence the EAD and AP.