4 ms·
Is user a goat?
- chillydawg 11y agoExcellent :D Perhaps it should have been mountain goat, though?
- herbig 11y agopublic boolean isUserAGoat() { return mContext.getPackageManager() .isPackageAvailable("com.coffeestainstudios.goatsimulator"); }
- strangecasts 11y agoI thought this was a joke at first, but this is apparently the genuine implementation: https://android.googlesource.com/platform/frameworks/base/+/android-5.0.0_r6/core/java/android/os/UserManager.java https://android.googlesource.com/platform/frameworks/base/+/...
- bradreaves 11y agoNot to be confused with isUserAMonkey(): http://developer.android.com/reference/android/app/ActivityManager.html#isUserAMonkey() http://developer.android.com/reference/android/app/ActivityM...
- brenniemac 11y agoA junior dev once thought it would be funny to quietly slip this into some code right before a release not realizing it had changed in lollipop. He was lucky I happened to have Goat Simulator installed and caught it. if (!userManager.isUserAGoat()) { ... Super important business logic ... }