Android API – isUserAGoat()?

We all know there are some methods and/or values in the Android API that sound funny and seem to have no purpose. Lets deep dive into a single method and find out its history.

For this blog we will have a look at the method:


This method is available in the UserManager class from Android. It is introduced in API 17 (JELLY_BEAN_MR1) and it returns a boolean value.

The description says:

Used to determine whether the user making this call is subject to teleportations.


As of LOLLIPOP, this method can now automatically identify goats using advanced goat recognition technology.

Now this bit is interesting, why mention this for a method that has no real purpose right? Lets investigate further.

Returns true if the user making this call is a goat.

Thanks to the update as in LOLLIPOP this should be the real deal then.

Now we know as much as any developer at this point. But what was the reason behind this? an easteregg? just for fun? The first step was too look into the source code of this method.

It seems that this method was introduced by Dan Morrill back in September 10th, 2012

Source code here

Now we know that this method always return “false” when called upon. So developers found it funny to use this method whenever they needed a constant boolean. Because why not? I checked the searched results of GitHub and some were really using it.

Now let’s get back to the description in the Android API.

As of LOLLIPOP, this method can now automatically identify goats using advanced goat recognition technology.

When I checked the source code it seemed there was indeed an update on the isUserAGoat().

Source code here

So instead of always returning “false” it now checks if the device has a package named “com.coffeestainstudios.goatsimulator“!

Searching the play store there is indeed an app with that package name. Goat Simulator.

So now all those developers that used this method could now have crashes on random phones for all they know, expecting it to return false forever!

Why the Goats? I found no real explanation but googlers seem to like goats for some reason, no wonder they made an easter egg out of it. there is also a serious investment in goats: – as blogged in googleblog – mowing with goats goats are baaaahk and recorded in youtube after all they are native lawn movers, efficient as well.

Some say the method is a bug!

Even for this leaked footage of a goat man

Bottom line: if you don’t control the implementation of a method and decide to use it for purposes other than stated in the API documentation, you’re heading for trouble.

Add a Comment

Your email address will not be published.