Is User a Monkey?

Monkey FaceOne of the things I love about Google is that the company has a sense of humor. Just look at how seriously they take April Fools day, or the easter-egg built into Google Docs.

This sense of humor didn’t miss the Android team. Take a look at the official documentation for ActivityManager. What’s this I see?

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

Yep, that’s an official method in the Android source code, as of API version 8. I actually tested this method in one of my apps, and output the result to the debug log. What happens when I use the app? Quite understandably, the function returns false 🙂 I’m not a monkey.

Did you ever doubt it?

Update: As @brk3 pointed out on Twitter, this function is actually designed to be used with the Android Monkey tool, for debugging applications. So it’s not entirely pointless.

Via Richard Lalancette