While I don't know with Apple and Google, historically these types of companies, namely MS and before perhaps IBM, do crap to break the new guys system. Example was the MS chant, DOS ain't done until Lotus won't run. Code in Windows to detect non-MS DOS and create problems. Contracts that screwed the competition and various other things that came out in the MS anti-trust trial. There is also the trick of buying out your competitors like MS did with Nokia.
IBM invented FUD (fear, uncertainty and doubt) to attack competitors and had their own anti-trust thing done to them.
The reason that most desktops/laptops run MS software was not because it was better, but due to anti-competitive behaviour at the time.
People up the page claim that Apple has a habit of using their gate keeping store to deny some interesting software access to the store then some months later, come out with their own version of the interesting software. Whether true or not, I don't know but a trial might find it to be true.
There's also deals with the Mobile networks that might have had something to do with it, Apple started out with a deal with AT&T IIRC, and back then all phones were locked, so another way to kill competition, "hey AT&T, we'll give you a deal if you don't deal with the new kid" kind of thing.
As time goes on, it also gets harder and harder to break into an established market.