It has been some decades already that hidden messages can be found on different media, jokes for connoisseurs and all kind of secret hidden features related to different games and applications. We all know these hidden features as “Easter Eggs” and the first record of them dates back to 1976. That very first time occurred with “Colossal Cave Adventure”, a game of text adventure which included the hidden phrase “Xyzzy” and that communicated two rooms.
However, the term “Easter Egg” was first used later on. Around 1979 injustice appeared. Atari did not allow to include the names of creators in their games. Joseph Warren Robinett Jr. (designer and programmer), decided to take justice in his own hands and on his game “Adventure”, a graphic adventure inspired in its predecessor from 1976, hid an almost invisible object, a small grey pixel, which when activated led to a hidden room where “Created by Warren Robinett” was displayed.
When the secret was found out, Atari executives firstly wanted to stop the distribution of “Adventure” and to even change the cartridges from buyers. However, it was a very popular game and this solution was not feasible. Consequently they decided to resort to the old “it’s not a bug, it’s a feature”, as they started to incorporate surprises in their games, thus inviting players to collectively participate in the “quest for Easter Eggs”.
In this way, a common practice for many creators of games, applications and software started out which is still standing nowadays. Android SDK developers are no exception to this. That is why I am sharing today a list of some of the “Easter Eggs” I have bumped into along my years of Android developer.
What a terrible level
The name of this group of methods contains a joke. The class
Log is used to send messages of depuration, which can be checked later through console with the command
adb logcat or on the Android Monitor. To help filter the messages, the class allows us to select the level of priority of each message, either by means of its specific methods or using a constant of priority on the base method
The mostly used methods are the
d(…) (for the DEBUG level) and
e(…) (for ERROR), although
w(…) (WARNING), and
i(…) (INFO) are also commonplace. There are also other groups of methods, maybe not very widely used: v(…) (VERBOSE, the lowest priority level) and the one we are focusing on today:
The acronym “WTF” has a clearly recognizable meaning for English-speaking people, though on Android documentation it means “What a Terrible Failure”. It aims only at very big mistakes, those that should never happen. On Android versions prior to API 23 (Lollipop or previous), when a message was sent using these methods, it was sent with ASSERT level, which caused the application to crash with an error. As from Marshmallow, it is a simple ERROR.
Advanceable can be implemented in views that behave as a collection and want to grant control by the
App Widget Host, the controller that allows us to embed widgets within another application (for instance, on an app created to replace the Home Screen).
Advanceable features only two methods:
advance, that indicates the view that it has to move within its collection, and a method that warns that
advance is about to be called, and enables to perform initialization tasks if necessary.
While accustomed to certain standards of acronyms, we developers could expect a similar method to have a name such as “onPrepareAdvance”or something equally neutral or informative. But no. Google offers:
Not all users are humans
Android developers seem to know that a device can be owned by animals instead of humans. There are two methods that allow us to know whether the current user is a monkey or a goat.
The first method is
isUserAMonkey, and it is found on
ActivityManager. The description is surprising:
“It returns true if the user interface is being manipulated by a monkey”.
Although it may sound funny, it has actual utility: it allows us to differentiate real users interactions from the ones caused on a MonkeyRunner testing environment.
This is not the case of the following method:
isUserAGoat, on UserManager. This method was originated from a decision taken by Google who announced in 2009 that they had stopped using landscaper services to eliminate the excess of bushes around their offices, and they have changed them for goats, since they were deemed environmentally friendlier.
This brought about several internal jokes connected to goats. One of them came up through the developers of Chrome, who included a column on the task manager indicating, for each running task, the amount of “Goats teleported”.
The method we refer to, first appeared on Android API 17, and its first version simply gave “false” as a result. However, as from Android Lollipop, the method checks on the Package Manager whether the package “com.coffeestainstudios.goatsimulator” is installed. In other words, it reports “true” if the user has installed the “Goat Simulator”, the very well-known goat simulator.
Crazy constants galore
UserManager also hides a (not at all) funny detail: On the list of components that can be used to disable user features with the method
DevicePoliceManager, we can find the “
DISALLOW_FUN”, that prevents from experimenting fun and enjoy happiness.
Another constant with an interesting name, but really useful though, is
FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND. “Jazz Hand” is a dancing gesture that shows an open hand, with fingers stretched, and many a time with fast movements.
This constant, which is found on
PackageManager is to be used with
hasSystemFeature, and allows us to detect whether the device can register at least five points of pressure simultaneously.
On the early versions of the Android API
SensorManager, we could find a constant to describe a “tricorder”-type sensor, the famous gadget from the series Star Trek.
However, when relocating the constants related to the
Sensor-class sensors, this value was left aside.
SensorManager, there are still two other funny constants:
And what about you? Do you know any other hidden secret on the Android SDK?