├── .gitignore
├── .idea
├── $CACHE_FILE$
├── .gitignore
├── .name
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── compiler.xml
├── jarRepositories.xml
└── misc.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── trianguloy
│ │ └── isUserAMonkey
│ │ ├── MainActivity.java
│ │ └── tools
│ │ ├── Animations.java
│ │ └── ClickableLinks.java
│ ├── play
│ ├── contact-email.txt
│ ├── contact-website.txt
│ ├── listings
│ │ └── en-US
│ │ │ ├── full-description.txt
│ │ │ ├── graphics
│ │ │ ├── feature-graphic
│ │ │ │ └── featured.png
│ │ │ ├── icon
│ │ │ │ └── ic_launcher-playstore.png
│ │ │ └── phone-screenshots
│ │ │ │ ├── 1.png
│ │ │ │ └── 2.png
│ │ │ ├── short-description.txt
│ │ │ └── title.txt
│ └── release-notes
│ │ └── en-US
│ │ └── default.txt
│ └── res
│ ├── drawable
│ └── ic_launcher_foreground.xml
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-anydpi-v26
│ └── ic_launcher.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── values-v14
│ └── styles.xml
│ └── values
│ ├── ic_launcher_background.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | # release/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # IntelliJ
40 | *.iml
41 | .idea/workspace.xml
42 | .idea/tasks.xml
43 | .idea/gradle.xml
44 | .idea/assetWizardSettings.xml
45 | .idea/dictionaries
46 | .idea/libraries
47 | # Android Studio 3 in .gitignore file.
48 | .idea/caches
49 | .idea/modules.xml
50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you
51 | .idea/navEditor.xml
52 |
53 | # Keystore files
54 | # Uncomment the following lines if you do not want to check your keystore files in.
55 | #*.jks
56 | #*.keystore
57 |
58 | # External native build folder generated in Android Studio 2.2 and later
59 | .externalNativeBuild
60 | .cxx/
61 |
62 | # Google Services (e.g. APIs or Firebase)
63 | # google-services.json
64 |
65 | # Freeline
66 | freeline.py
67 | freeline/
68 | freeline_project_description.json
69 |
70 | # fastlane
71 | fastlane/report.xml
72 | fastlane/Preview.html
73 | fastlane/screenshots
74 | fastlane/test_output
75 | fastlane/readme.md
76 |
77 | # Version control
78 | vcs.xml
79 |
80 | # lint
81 | lint/intermediates/
82 | lint/generated/
83 | lint/outputs/
84 | lint/tmp/
85 | # lint/reports/
86 |
87 | # Android Profiling
88 | *.hprof
--------------------------------------------------------------------------------
/.idea/$CACHE_FILE$:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Spelling
10 |
11 |
12 |
13 |
14 | SpellCheckingInspection
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | isUserAMonkey & isUserAGoat
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | xmlns:android
33 |
34 | ^$
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | xmlns:.*
44 |
45 | ^$
46 |
47 |
48 | BY_NAME
49 |
50 |
51 |
52 |
53 |
54 |
55 | .*:id
56 |
57 | http://schemas.android.com/apk/res/android
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | .*:name
67 |
68 | http://schemas.android.com/apk/res/android
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | name
78 |
79 | ^$
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | style
89 |
90 | ^$
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | .*
100 |
101 | ^$
102 |
103 |
104 | BY_NAME
105 |
106 |
107 |
108 |
109 |
110 |
111 | .*
112 |
113 | http://schemas.android.com/apk/res/android
114 |
115 |
116 | ANDROID_ATTRIBUTE_ORDER
117 |
118 |
119 |
120 |
121 |
122 |
123 | .*
124 |
125 | .*
126 |
127 |
128 | BY_NAME
129 |
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # isUserAMonkey & isUserAGoat
2 |
3 | Android app made by TrianguloY
4 |
5 | Get it on Google Play:\
6 | https://play.google.com/store/apps/details?id=com.trianguloy.isUserAMonkey \
7 | [
](https://play.google.com/store/apps/details?id=com.trianguloy.isUserAMonkey)
10 |
11 | Get it on F-Droid:\
12 | https://f-droid.org/packages/com.trianguloy.isUserAMonkey/ \
13 | [
](https://f-droid.org/packages/com.trianguloy.isUserAMonkey/)
16 |
17 | You can use parts of this project in your own ones, create pull request, or upload modified versions of it AS LONG AS you credit me.
18 |
19 | How to credit:
20 | - You must add my nick (TrianguloY) in an 'about' or 'acknowledgments' section visible to the user.
21 | - You must add a link to this GitHub main page (https://github.com/TrianguloY/isUserAMonkey) or subpage (if you used a part of the code or an asset) in an 'about' or 'acknowledgments' section visible to the user.
22 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdkVersion 30
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "com.trianguloy.isUserAMonkey"
11 | minSdkVersion 8
12 | targetSdkVersion 30
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 |
32 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trianguloy/isUserAMonkey/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.trianguloy.isUserAMonkey;
2 |
3 |
4 | import android.annotation.TargetApi;
5 | import android.app.Activity;
6 | import android.app.ActivityManager;
7 | import android.content.Context;
8 | import android.content.Intent;
9 | import android.content.res.Resources;
10 | import android.net.Uri;
11 | import android.os.Build;
12 | import android.os.Bundle;
13 | import android.os.UserManager;
14 | import android.util.Log;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.TextView;
18 | import android.widget.Toast;
19 |
20 | import com.trianguloy.isUserAMonkey.tools.Animations;
21 | import com.trianguloy.isUserAMonkey.tools.ClickableLinks;
22 |
23 | import java.util.HashMap;
24 |
25 | /**
26 | * The main, and only, activity
27 | */
28 | public class MainActivity extends Activity implements ClickableLinks.OnUrlListener {
29 |
30 | // ------------------- data -------------------
31 |
32 | /**
33 | * tags to urls map
34 | */
35 | private static final HashMap links = new HashMap<>();
36 |
37 | static {
38 | links.put("TrianguloY", "https://github.com/TrianguloY");
39 | links.put("GitHub", "https://github.com/TrianguloY/isUserAMonkey");
40 |
41 | links.put("isUserAMonkey", "https://developer.android.com/reference/android/app/ActivityManager.html#isUserAMonkey()");
42 | links.put("monkey", "https://developer.android.com/studio/test/monkey.html");
43 |
44 | links.put("isUserAGoat", "https://developer.android.com/reference/android/os/UserManager.html#isUserAGoat()");
45 | links.put("Goat Simulator", "https://play.google.com/store/apps/details?id=com.coffeestainstudios.goatsimulator");
46 |
47 | links.put("strange-function-in-activitymanager-isuseramonkey-what-does-this-mean-what-is", "https://stackoverflow.com/a/7792165");
48 | links.put("proper-use-cases-for-android-usermanager-isuseragoat", "https://stackoverflow.com/a/13375461");
49 | links.put("Android-Documentation-Easter-Eggs", "https://github.com/vitorOta/Android-Documentation-Easter-Eggs");
50 | links.put("Noto Emoji", "https://github.com/googlefonts/noto-emoji/blob/f2a4f72/svg/emoji_u1f412.svg");
51 | }
52 |
53 | // ------------------- initialization -------------------
54 |
55 | /**
56 | * App initialization
57 | */
58 | @Override
59 | protected void onCreate(Bundle savedInstanceState) {
60 | super.onCreate(savedInstanceState);
61 | setContentView(R.layout.activity_main);
62 | ViewGroup parent = findViewById(R.id.parent);
63 |
64 | // init animations
65 | Animations.enable(parent);
66 |
67 | // init links
68 | ClickableLinks.linkifyAll(parent, this);
69 | }
70 |
71 | // ------------------- listeners -------------------
72 |
73 | /**
74 | * A button was clicked
75 | */
76 | public void onButtonClick(View view) {
77 | switch (view.getId()) {
78 | case R.id.m_run:
79 | // run the isUserAMonkey function
80 | runMonkey();
81 | break;
82 | case R.id.g_run:
83 | // run the isUserAGoat function
84 | runGoat();
85 | break;
86 | case R.id.m_expand:
87 | // show details for the isUserAMonkey function
88 | swap(view, R.id.m_details);
89 | break;
90 | case R.id.g_expand:
91 | // show details for the isUserAGoat function
92 | swap(view, R.id.g_details);
93 | break;
94 | }
95 | }
96 |
97 | /**
98 | * A link (in a textview) was clicked
99 | */
100 | @Override
101 | public void onLinkClick(String tag) {
102 | if (!links.containsKey(tag)) {
103 | // link not present, error
104 | String msg = "The entry '" + tag + "' wasn't present in the links hashmap";
105 | Log.d("NotFoundException", msg);
106 | if (BuildConfig.DEBUG) // crash in development
107 | throw new Resources.NotFoundException(msg);
108 | return; // ignore in production
109 | }
110 |
111 | try {
112 | // open
113 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(links.get(tag))));
114 | } catch (Exception e) {
115 | // can't open
116 | Toast.makeText(this, R.string.no_browser, Toast.LENGTH_LONG).show();
117 | }
118 | }
119 |
120 | // ------------------- functions -------------------
121 |
122 | /**
123 | * Just a (hopefully) inlined function to hide one view and show another
124 | *
125 | * @param hide view to hide
126 | * @param show identifier of view to show
127 | */
128 | private void swap(View hide, int show) {
129 | hide.setVisibility(View.GONE);
130 | findViewById(show).setVisibility(View.VISIBLE);
131 | }
132 |
133 | /**
134 | * Run the isUserAMonkey function, and update the ui accordingly
135 | */
136 | private void runMonkey() {
137 |
138 | // views
139 | TextView result = this.findViewById(R.id.m_result);
140 | TextView comment = this.findViewById(R.id.m_comment);
141 |
142 | try {
143 |
144 | // run
145 | boolean isUserAMonkey = ActivityManager.isUserAMonkey(); // <-- This!
146 |
147 | // result
148 | result.setText(Boolean.toString(isUserAMonkey));
149 |
150 | // comment
151 | if (isUserAMonkey) {
152 | comment.setText(R.string.m_true);
153 | } else {
154 | comment.setText(R.string.m_false);
155 | }
156 |
157 | } catch (Throwable e) {
158 |
159 | // unavailable (unexpected)
160 | result.setText(R.string.unavailable);
161 | comment.setText(R.string.m_crash);
162 | comment.append("\n\n");
163 | comment.append(e.toString());
164 | }
165 |
166 | // update
167 | ClickableLinks.linkify(result, this);
168 | ClickableLinks.linkify(comment, this);
169 | }
170 |
171 | /**
172 | * Run the isUserAGoat function, and update the ui accordingly
173 | */
174 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) // to suppress the wanted unavailable error
175 | private void runGoat() {
176 |
177 | // views
178 | TextView result = this.findViewById(R.id.g_result);
179 | TextView comment = this.findViewById(R.id.g_comment);
180 |
181 | try {
182 |
183 | // run
184 | boolean isUserAGoat = ((UserManager) getSystemService(Context.USER_SERVICE)).isUserAGoat(); // <-- This!
185 |
186 | // result
187 | result.setText(Boolean.toString(isUserAGoat));
188 |
189 | // comment
190 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
191 | // pre lollipop, always return false
192 | if (isUserAGoat) {
193 | comment.setText(R.string.g_lollipop_true);
194 | } else {
195 | comment.setText(R.string.g_lollipop_false);
196 | }
197 | } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
198 | // post lollipop and pre R, checks for goat simulator
199 | if (isUserAGoat) {
200 | comment.setText(R.string.g_true);
201 | } else {
202 | comment.setText(R.string.g_false);
203 | }
204 | } else {
205 | // post R, always return false
206 | if (isUserAGoat) {
207 | comment.setText(R.string.g_r_true);
208 | } else {
209 | comment.setText(R.string.g_r_false);
210 | }
211 | }
212 |
213 | } catch (Throwable e) {
214 | // unavailable
215 |
216 | // result
217 | result.setText(R.string.unavailable);
218 |
219 | // comment
220 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
221 | // pre jelly bean, expected crash, function unavailable
222 | comment.setText(R.string.g_unavailable);
223 | } else {
224 | // unexpected crash
225 | comment.setText(R.string.g_crash);
226 | }
227 | comment.append("\n\n");
228 | comment.append(e.toString());
229 | }
230 |
231 | // update
232 | ClickableLinks.linkify(result, this);
233 | ClickableLinks.linkify(comment, this);
234 |
235 | }
236 |
237 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trianguloy/isUserAMonkey/tools/Animations.java:
--------------------------------------------------------------------------------
1 | package com.trianguloy.isUserAMonkey.tools;
2 |
3 | import android.animation.LayoutTransition;
4 | import android.os.Build;
5 | import android.view.ViewGroup;
6 |
7 | /**
8 | * Enables the animations for changing components
9 | */
10 | public class Animations {
11 | static public void enable(ViewGroup view) {
12 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
13 | view.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trianguloy/isUserAMonkey/tools/ClickableLinks.java:
--------------------------------------------------------------------------------
1 | package com.trianguloy.isUserAMonkey.tools;
2 |
3 | import android.text.SpannableStringBuilder;
4 | import android.text.method.LinkMovementMethod;
5 | import android.text.style.ClickableSpan;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import java.util.ArrayList;
11 | import java.util.regex.Matcher;
12 | import java.util.regex.Pattern;
13 |
14 | /**
15 | * Container for {@link #linkify(TextView, OnUrlListener)}
16 | */
17 | public class ClickableLinks {
18 |
19 | /**
20 | * Listener for when a link is clicked. The link's tag specify which link was clicked.
21 | */
22 | public interface OnUrlListener {
23 | void onLinkClick(String tag);
24 | }
25 |
26 | /**
27 | * Converts a TextView with custom tags into clickable links to use in a custom listener.
28 | * Pattern: "[[tag|display text]]" or "[[tag and display text]]" (similar to wikipedia linking)
29 | *
30 | * For example, a TextView with text "Press [[main|here]] to open or [[reset]]."
31 | * will be converted into "Press here to open or reset."
32 | * so that when clicked in the 'here' word: listener.onClick("main") will be called,
33 | * and when clicked in the 'reset' word: listener.onClick("reset") will be called.
34 | * (note: all spaces are kept in both tag and display text)
35 | *
36 | * @param textView TextView to convert
37 | * @param listener Listener for when a link is clicked. The link's tag specify which link was clicked.
38 | */
39 | public static void linkify(TextView textView, final OnUrlListener listener) {
40 | ArrayList matches = new ArrayList<>(); // keeps matches, reverse order
41 | SpannableStringBuilder text = new SpannableStringBuilder(textView.getText()); // final text
42 |
43 | // search all matches
44 | final Matcher matcher = PATTERN.matcher(text);
45 | while (matcher.find()) {
46 | matches.add(0, new Match(matcher.start(), matcher.end(), matcher.group(1), matcher.group(2)));
47 | }
48 |
49 | // replace matches (in reverse order)
50 | for (final Match match : matches) {
51 | ClickableSpan clickable = new ClickableSpan() {
52 | public void onClick(View view) {
53 | listener.onLinkClick(match.tag);
54 | }
55 | };
56 | text.setSpan(clickable, match.start, match.end, 0); // first set span
57 | text.replace(match.start, match.end, match.text); // then replace (span is automatically adapted)
58 | }
59 |
60 | // finish conversion
61 | textView.setText(text);
62 | textView.setLinksClickable(true);
63 | textView.setMovementMethod(LinkMovementMethod.getInstance());
64 | }
65 |
66 | /**
67 | * Runs the {@link #linkify(TextView, OnUrlListener)} on all textviews of the hierarchy recursively
68 | *
69 | * @param container parent where to search
70 | * @param listener listener to apply to all textviews
71 | */
72 | public static void linkifyAll(ViewGroup container, OnUrlListener listener) {
73 | for (int i = 0; i < container.getChildCount(); i++) {
74 | View view = container.getChildAt(i);
75 |
76 | if (view instanceof TextView) linkify((TextView) view, listener);
77 | else if (view instanceof ViewGroup) linkifyAll((ViewGroup) view, listener);
78 | }
79 | }
80 |
81 | // ------------------- private -------------------
82 |
83 | /**
84 | * Pattern: "[[tag|display text]]" or "[[tag and display text]]" (similar to wikipedia linking)
85 | */
86 | private static final Pattern PATTERN = Pattern.compile("\\[\\[([^|\\]]*)(?:\\|([^]]*))?]]");
87 |
88 | /**
89 | * Just a container
90 | */
91 | private static class Match {
92 | final int start;
93 | final int end;
94 | final String tag;
95 | final String text;
96 |
97 | Match(int start, int end, String tag, String text) {
98 | this.start = start;
99 | this.end = end;
100 | this.tag = tag;
101 | this.text = text == null ? tag : text;
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/play/contact-email.txt:
--------------------------------------------------------------------------------
1 | correo--correo+iuam@hotmail.com
--------------------------------------------------------------------------------
/app/src/main/play/contact-website.txt:
--------------------------------------------------------------------------------
1 | https://triangularapps.blogspot.com/
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/full-description.txt:
--------------------------------------------------------------------------------
1 | Did you know that in the Android SDK there is a function called 'isUserAMonkey' and another called 'isUserAGoat'?
2 | https://developer.android.com/reference/android/app/ActivityManager.html#isUserAMonkey()
3 | https://developer.android.com/reference/android/os/UserManager.html#isUserAGoat()
4 |
5 | What are they? What do they do? With this app you can test them and learn a bit about their purpose.
6 |
7 | As usual, this app is extremely small (less than a standard picture), totally free, contains no ads, has no permissions, and their sole purpose it to act as an interactive explanation of two strange easter eggs in the Android SDK.
8 |
9 | The more you know.
10 |
11 | ------------------------------------------------------------
12 |
13 | App developed by TrianguloY (https://github.com/TrianguloY).
14 | The source code of the app is available on GitHub (https://github.com/TrianguloY/isUserAMonkey).
15 | Special thanks to StackOverflow https://stackoverflow.com/a/7792165 and https://stackoverflow.com/a/13375461 for the detailed information.
16 | The monkey emoji in the icon was extracted from the Noto Emoji font (https://www.google.com/get/noto/help/emoji/).
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/graphics/feature-graphic/featured.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/play/listings/en-US/graphics/feature-graphic/featured.png
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/graphics/icon/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/play/listings/en-US/graphics/icon/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/graphics/phone-screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/play/listings/en-US/graphics/phone-screenshots/1.png
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/graphics/phone-screenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/play/listings/en-US/graphics/phone-screenshots/2.png
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/short-description.txt:
--------------------------------------------------------------------------------
1 | The android sdk has strange functions called 'isUserAMonkey' and 'isUserAGoat'
--------------------------------------------------------------------------------
/app/src/main/play/listings/en-US/title.txt:
--------------------------------------------------------------------------------
1 | isUserAMonkey & isUserAGoat [curiosity]
--------------------------------------------------------------------------------
/app/src/main/play/release-notes/en-US/default.txt:
--------------------------------------------------------------------------------
1 | V 1.0
2 | - First release
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
14 |
17 |
20 |
23 |
26 |
29 |
32 |
35 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
31 |
32 |
40 |
41 |
46 |
47 |
52 |
53 |
60 |
61 |
67 |
68 |
69 |
75 |
76 |
83 |
84 |
89 |
90 |
99 |
100 |
108 |
109 |
114 |
115 |
120 |
121 |
128 |
129 |
135 |
136 |
137 |
143 |
144 |
151 |
152 |
157 |
158 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | isUserAMonkey & isUserAGoat
3 | App developed by [[TrianguloY]].\nThe source code of the app is available on [[GitHub]].\n\nSpecial thanks to StackOverflow \'[[proper-use-cases-for-android-usermanager-isuseragoat]]\' and \'[[strange-function-in-activitymanager-isuseramonkey-what-does-this-mean-what-is]]\' for the detailed information. Check also [[Android-Documentation-Easter-Eggs]] where you can find even more easter eggs!\n\nThe monkey emoji in the icon was extracted from the [[Noto Emoji]] font.
4 |
5 | Show detailed explanation…
6 | Press the \'run\' button above to execute the function
7 | unavailable
8 | Can\'t open links, is a browser installed?
9 |
10 | ActivityManager.[[isUserAMonkey]]()
11 | The android SDK contains a strange function called \'[[isUserAMonkey]]\'.\nAre you a Monkey? Let\'s find out!
12 | According to the [[isUserAMonkey|official documentation]]:\n\n\"Returns \"true\" if the user interface is currently being messed with by a monkey.\"\n\nInternally this function checks for a test suite program, called \'[[monkey]]\', that tries to press randomly on the screen (like a monkey). This is usually used for automatic tests, so this function could be used to see if such test is running or not.
13 | The function returned true, you are a monkey!\nThis means that you are using a testing device with the \'[[monkey]]\' testing suite program that presses randomly on the screen. Or perhaps your ROM did this on purpose?
14 | The function returned false, this is the expected result.\nThis means that you are not using a testing device with the \'[[monkey]]\' testing suite program that presses randomly on the screen.
15 | For some reason the function crashed, this was unexpected, as this function should exists and run correctly. Maybe your ROM messed it somehow?
16 |
17 | userManager.[[isUserAGoat]]()
18 | The Android SDK also contains another strange function called \'[[isUserAGoat]]\'.\nAre you a Goat? Press to check!
19 | This function, which was added in Android 4.2 (previously it didn\'t exist) was, according to the [[isUserAGoat|official documentation]]:\n\n\"Used to determine whether the user making this call is subject to teleportations.\nReturns whether the user making this call is a goat.\".\n\nOriginally the function always returned false, which could had been used as an internal joke, or an easter egg, or perhaps as a tool for coding purposes (the compiler removes code which is known to never execute, like \'if(false)…\' but sometimes you do need that code in the final app, so calling instead a function avoids the compiler code deletion process).\n\nWhen Android 5.0 was released, this function changed to check whether the user had installed the \'[[Goat Simulator]]\' app, probably to confirm the joke, with the message:\n\"As of LOLLIPOP, this method can now automatically identify goats using advanced goat recognition technology.\"\n\nStrangely, when Android 11 released, this function was changed again to always return false with description\n\"As of R, this method always returns false in order to protect goat privacy.\"\nMaybe because it was messing with some internal tooling or used incorrectly? I don\'t know.
20 | This was unexpected! You are using a device with Android version between 4.2 and 5.0, where this function was hardcoded to always return false. But it returned true?? Maybe you are using a ROM which changed it?
21 | You are using a device with Android version between 4.2 and 5.0, where this function was hardcoded to always return false, so this was the expected result.
22 | You are using a device with Android between 5.0 and 11.0, where a \'true\' result means that you have the \'[[Goat Simulator]]\' app installed!
23 | You are using a device with Android between 5.0 and 11.0, where a \'false\' result means that you don\'t have the \'[[Goat Simulator]]\' app installed.
24 | This was unexpected!\nYou are using a device with Android version above 11.0, where this function was hardcoded to always return false. But it returned true?? Maybe you are using a ROM which changed it? Or a future Android version where it was changed again??
25 | You are using a device with Android version above 11.0, where this function was hardcoded to always return false, so this was the expected result.
26 | The function is unavailable on Android below 4.2, so unfortunately it crashes when you try to run it.
27 | This was unexpected, you are using a device with Android below 4.2 where this function shouldn\'t exist, but it does? Perhaps you are using a ROM which decided to implement it.
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:4.1.1"
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TrianguloY/isUserAMonkey/78818e6a28056baa92307f741057d67aa809244e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jan 10 23:56:32 CET 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "isUserAMonkey & isUserAGoat"
--------------------------------------------------------------------------------