Who gets the dependent

Have a fairly complex dependent question:

1. My gf's son was under legal custody of his grandparents until August 2019.

2. Physical custody of her son switched to her June 1st.

3. Grandparents want to claim the dependent and all credits saying they were guardians for 8 months.

 

Looking for confirmation. Mother has full rights to the exemption due to having physical custody of him for more than 6 months. She also provided his support for more than half the year. He is young so he has no income himself.

Do the grandparents have any rights to the exemption in this situation as long as the mother wants to claim him?