Proper use cases for Android UserManager.isUserAGoat()?
I was looking at the new APIs introduced in Android 4.2. While looking at the UserManager class I came across the following method:

public boolean isUserAGoat ()

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

Returns whether the user making this call is a goat.

How and when should this be used?
improve this question | comment
Russell Hane Created at: 2013-11-13 17:07:32 UTC By Russell Hane
see also LIKE_TRANSACTION & TWEET_TRANSACTION on IBinder…… - Emanuel Heathcote
Incidentally, Chrome also has a "Goats Teleported" internal statistic.  Presumably, it's some sort of internal name for a memory management technique. - Camille Kassulke
Source of the change:‌​a21ad7314372de41a8b57%5E! - Kip Gottlieb
@djechlin perhaps it is legitimate, but OP should accept user1597833's answer that cites the source and the hordes should move along. it is ridiculous that a question such as this gains so much traction. it just seems disingenuous to ask this question and to allow it to stay open. - Joany Price
It's a bug. Returns false all the time :( - Miss Berniece Prohaska
8 Answers
In the discipline of speech recognition, users are divided into goats and sheeps.

For instance here on page 89.

  Sheeps are people for whom speech recognition works exceptionally well, and goats are people for whom it works exceptionally poorly. Only the voice recognizer knows what separates them. People can't predict whose voice will be recognized easily and whose won't. The best policy is to design the interface so it can handle all kinds of voices in all kinds of environments

Maybe, it is planned to mark Android users as goats in future to be able to configure the speech recognition engine for goat's needs. ;-)
There's a funny named method/constant/whatever in each version of Android. 

The only practical use I ever saw was in the Last Call for Google I/O Contest where they asked what it was for a particular version, to see if contestants read the API diff report for each release. The contest had programming problems too, but generally some trivia that could be graded automatically first to get the number of submissions down to reasonable amounts that would be easier to check.
This appears to be an inside joke at Google. It's also featured in the Google Chrome task manager. It has no purpose, other than some engineers finding it amusing. Which is a purpose by itself, if you will.

In Chrome, open the Task Manager with Shift+Esc. 
Right click to add the  Goats Teleported column.
There is even a huge Chromium bug report about too many teleported goats.

The following Chromium source code snippet is stolen from the HN comments.

int TaskManagerModel::GetGoatsTeleported(int index) const {
  int seed = goat_salt_ * (index + 1);
  return (seed >> 16) & 255;

Complementing the @djechlin answer (good answer by the way!), this function call could be also used as dummy code to hold a breakpoint in an IDE when you want to stop in some specific iteration or a particular recursive call, for example:

isUserAGoat() could be used instead of a dummy variable declaration that will be shown in the IDE as a warning and, in Eclipse particular case, will clog the breakpoint mark, making it difficult to enable/disable it. If the method is used as a convention, all the invocations could be later filtered by some script (during commit phase maybe?).

Google guys are heavy Eclipse users (they provide several of their projects as Eclipse plugins: Android SDK, GAE, etc), so the @djechlin answer and this complementary answer make a lot of sense (at least for me).
I don't know if this was "the" official use case but the following produces a warning in Java (that can further produce compile errors if mixed with return statements, leading to unreachable code):

if(1 == 2) {
    System.out.println("Unreachable code");

However this is legal:

if(isUserAGoat()) {
    System.out.println("Unreachable but determined at runtime, not at compile time");

So I often find myself writing a silly utility method for the quickest way to dummy out a code block, then in completing debugging find all calls to it, so provided the implementation doesn't change this can be used for that.
Google has a serious liking for goats and goat based Easter eggs. There has even been previous Stack Overflow posts about it.

As has been mentioned in previous posts, it also exists within the Chrome task manager (it first appeared in the wild in 2009):

<message name="IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN" desc="The goats teleported column">
    Goats Teleported

And then in Windows, Linux and Mac versions of Chrome early 2010). The number of "Goats Teleported" is in fact random:

 int TaskManagerModel::GetGoatsTeleported(int index) const {
     int seed = goat_salt_ * (index + 1);
     return (seed >> 16) & 255;

Other Google references to goats include:

Mowing with goats
The goats are baaaahk
The earliest correlation of goats and Google belongs in the original "Mowing with goats" blog post, as far as I can tell.

We can safely assume that it's merely an Easter egg and has no real-world use, except for returning false.
There is a similar call, isUserAMonkey(), that returns true if the MonkeyRunner tool is being used. The SDK explanation is just as curious as this one. 

    static boolean   isUserAMonkey()
    Returns "true" if the user interface is currently being messed with by a monkey.

Here is the source. 

I expect that this was added in anticipation of a new SDK tool named something with a goat and will actually be functional to test for the presence of that tool.  

Also see a similar question, Strange function in ActivityManager : isUserAMonkey- what does this mean, what is its use?.
From their source, it looks like the method returns false all the time:

 * Used to determine whether the user making this call is subject to
 * teleportations.
 * @return whether the user making this call is a goat 
public boolean isUserAGoat() {
    return false;

It looks like the method has no real use for us as developers. Someone has previously stated that it might be an Easter egg.
Your Answer