News for hackers. Stuff that matters.
Re:Jokes and Humour in the Public Android API by uncircle on Monday June 16, 2025 @06:48AM (#44288288)

  public static final String DISALLOW_FUN
The default value is false. [...] Type: Boolean [...] Constant Value: "no_fun"

Source: https://developer.android.com/reference/android/os/UserManag...

---

How the hell did this pass code review? Are booleans strings on Android?

Re:Jokes and Humour in the Public Android API by objclxt on Monday June 16, 2025 @06:53AM (#44288323)
> How the hell did this pass code review? Are booleans strings on Android?

You are misreading the documentation, it's a key/value API.

`DISALLOW_FUN` is the string key you pass to `setUserRestriction`, which takes a boolean value.

Re:Jokes and Humour in the Public Android API by uncircle on Monday June 16, 2025 @06:56AM (#44288343)
That makes more sense. Thanks.
Re:Jokes and Humour in the Public Android API by izacus on Monday June 16, 2025 @07:04AM (#44288402)
Also this is an enterprise policy constant, so it gets sent (and configured) as string/string dictionary via REST API from MDM backend. That's mostly because the constants can be of mixed types (e.g. "MAX_PASSWORD_CHARS" : "1", "DISALLOW_NETWORK_SWITCHING: "true" - example, constants not actual).
Re:Jokes and Humour in the Public Android API by stevepotter on Monday June 16, 2025 @08:48AM (#44289039)
Someone else pointed out the reason for the datatype. A more subtle problem is the use of double negatives. Boolean APIs like "disable" will throw off users of your API.