Why is the function isUserAMonkey () in the Android SDK?

  • I, too, was wildly wondering what this method means. I wanted to ask the exact same question. - angry
  • four
    and the author himself knows the answer? or is he just interested too? - LackOfKnowledge
  • The user can be not only a monkey, but also a goat - Real KEK

4 answers 4

Well, in general, and the answer is to habre: functional testing tools - Monkey and MonkeyRunner .

  • Well, this is understandable ... And the question was: why do we need a method? - Barmaley
  • 3
    Judging by the answers, the method is needed to protect against unwanted actions. As with stress tests using monkey, and in the case when random events come from the real user. For example, when you carry an unblocked device in a bag so that outgoing calls or payment transactions via a bank card, etc. are not made. True, it is not entirely clear how exactly programmers from Google distinguish between a macaque and a human ... - Nicolas Chabanovsky

There is an assumption that this is somehow related to the method of automatic testing of the Monkey Exerciser interface. For example, that the interface correctly passed this test.

  • it's just a joke, Easter eggs from the developers, like the wtf () =) tool - Gorets
  • and the joke is that in any case the method returns false UPD and if it is shaken before that, then true =) - Gorets
  • hmm ... did not suspect - antonderevyanko
  • 2
    try running monkeyrunner and see what the function returns. - KoVadim 2:49 pm
  • More specifically, guys, more specifically ... Warm of course, warm - Barmaley

There is another interesting function in android.os.UserManager: public boolean isUserAGoat () Here is a quote from the documentation:

This is a subject to teleportations.

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

Returns

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

In fact, there is a check whether the application "Goat Simulator" is worth it. These are the jokes of programmers from Google

    using MonkeyRunner, you can write a python script that deploit apk to the device and then blablabla, and the function isUserAMonkey checks in the code whether the application is installed this way or standardly