The law around these sorts of things can get pretty hair-splitty. My guess is that the situation here is that Amazon client libraries and OpenJDK are distributed with a license to create derivative works that are based on their respective products, but that these licenses do not necessarily grant a license to create a new thing that works the same out of whole cloth. Should Oracle win the case, that would seem to imply that the Court believes they do not. Alternatively, the fact that open source licenses do not appear to have even been brought up in the course of these hearings would perhaps imply that the existence of open source libraries that implement these APIs is legally irrelevant.
For a copyright infringement to have taken place, there generally needs to be an unauthorised instance of recording or of duplication, of some copyrighted work.
I put generally as, I believe, precisely recreating someone else's photo can still count as an infringement of their copyrights, despite that you haven't copied the image itself in the usual sense of making duplicates. Singing someone else's song can also infringe on their copyrights over the song. I don't think this would apply here though.
(Disclaimer: I'm not a lawyer, I could well be missing something obvious.)
How things actually shake out would depend a lot on the specifics of the Court's ruling, and I am not a lawyer either. But, if the court rules that Oracle owns a copyright to the Java APIs, and that this means they can prevent others from implementing their own versions of those APIs, and this right remains in effect even though they release a full implementation of them under GPLv2, then I can't see any particular reason to expect that things would work differently for Amazon's APIs and Apache2.