Java and MySQL were already out in the open as open source projects when Oracle acquired Sun though.
I don't know much about Android's history but if Dalvik was created exclusively by Google and they had no intention of open sourcing it fully... it'd be akin to a closed source Java app on top of the open source OpenJDK... which would be allowed.