As to factor number 2, the nature of the copyrighted work: For the last 20 years or so, courts have been backing away from the expansive approach of Whelan v. Jaslow and instead using a Computer Associates v. Altai "abstraction, filtration, comparison" analysis; in the end, courts typically hold that copyright protection for functional aspects of software is "thin." See, e.g., UC law professor (and MacArthur "genius grant" recipient) Pam Samuelson's 2013 review of the case law. [1]
From what I've read of the facts, number 3 -- the amount and substantiality of the portion used from the copyrighted work in relation to the work as a whole -- might have weighed heavily in Google's favor.
As to number 4, I didn't get a sense whether or not the evidence showed that Android has had a material adverse effect on the market for Java; that weighed heavily in the Supreme Court's thinking in the 2 Live Crew case.
[0] https://supreme.justia.com/cases/federal/us/510/569/case.htm...
[1] http://scholarlycommons.law.northwestern.edu/cgi/viewcontent...