mojira.dev

jkilcline

Assigned

No issues.

Reported

No issues.

Comments

Thanks so much for sharing this! That's quite a fix - it's been such a thorn in my side I'd love to get the details on how you did it - Do you have a google doc or something with the rest of the code?

Having worked with Apple in a previous role for a very popular application, I think I can add a bit of useful context here - both why this problem exists and why it's taken so long to fix.

Many years ago, Mojan made a java version of Minecraft and app launchers for various platforms (Windows, MacOS) that could launch the largely identical java code on each platform. This common java code make it much much easier to maintain compatibility between users who are running the game on MacOS and Windows as they are all running the same game code. Only the launcher needs to be different between platforms, and there's not much code in the launcher so it's not too bad to keep updated. The launcher really just lets the user log in, get the current version, and launch that version of the code with the user's sign in credentials. Even if a user was on a slightly old version of the launcher, if their java game code is up to date, everything still works.

Over the years, Apple has been building infrastructure so apps and games don't have to manage how they get updated. This makes some developers happy but some don't want to change over to the new infrastructure because it'll mean lots of changes (and some of the steps had to be done manually, increasing the chance for mistakes every time an update occurs). With time, it's become possible to automate all the steps of the deployment process and almost all developers got on board (it's very hard to fight with the platform that your code is running on).

Apple kept the ability for developers to update themselves (or download applications from the web) but they also recognized this type of download was a big security issue for users. Applications downloaded from the App Store could be vetted (over days or weeks) to comply with security requirements (or any policy they chose) in ways that weren't possible for apps downloaded over the internet. Apple added all sorts of warnings to users around downloading and installing apps, to encourage developers to use their App Store and approvals process, by scaring away users who might give up on seeing the warning messages when they try to install or use an app downloaded off the internet.

So from Apple's perspective there's a "hole" in their security, that users can download and install apps without going through the App Store, that they would love to close up, but can't quite do it, as too many developers would get angry. It's a bit more complicated though, as the App Store is also a payment platform - if they can get developers to use it, they can demand a cut of the revenues from those apps. This keeps a lot of developers (and companies) away from the App Store, as it's a significant tax on revenues to accept payments through the App Store (and a significant strategic cost to adopt all the policies of the App Store).

So in addition to the security and revenue advantages to pushing everyone to the App Store, this also reduces the complexity of what Apple's developers have to fix. If every game developer uses only the App Store and only the most modern infrastructure from Apple, there are fewer critical issues that will come up in Apple's legacy code infrastructure. However, to avoid breaking compatibility with all their old apps (and angering the developers and users) they keep allowing apps launched in the Java environment (like the Minecraft game) to run but they'd really like Minecraft to switch to using their new infrastructure.

So Apple has a bug "Java environment apps don't adhere to screen time" but while Java is used lots of places, few games are running on Java, and those that are running on Java, they'd really like to switch over to their infrastructure. So they don't prioritize a fix for this, even though their users (or the parents of their users) would really like a fix. It's possible this will get fixed at some point, if a really motivated mom or dad inside apple decided to champion this feature, but it's a lot of work that could, from Apple's perspective, be done by developers just updating to the modern Apple infrastructure.

Fixing it generally might be pretty hard (creating entries for java apps that show up in screen time, but not for all the weird java things that might be created by installers or system utilities that aren't relevant to parents). Hacking a fix (admitting that there are a lot of kids playing Minecraft, and that Minecraft is probably the only common java app with this problem, and then hardcoding an entry in screen time for it) would feel terrible, but probably not take long. Regardless, from Apple's perspective, it'd be better to leave this as an issue for the Minecraft team and move on.

So if Apple doesn't want to fix it, why wouldn't Minecraft just do it? Well, it's a lot bigger of a fix that it would seem like to an outsider. The options, basically, are:
1. Change the way the app is wrapped up, signed and launched so the java version looks like a normal Mac app
2. Give apple a significant chunk of their sales revenue on Mac and switch to the App Store for distribution.
3. Something really hacky

#1 doesn't sound too bad, but there's a ton of hidden work in there:

  • the launcher is probably integrated into the testing infrastructure, so that launcher-tester integration would need to be rebuilt.

  • the complexity of testing would go up, as on Mac you would have a different "shaped" app (one that combines the launcher) that would need to be tested - bugs which used to be isolated to "just a launcher bug" are now in the "giant macOS combined thing" codebase.

  • the launcher does way more than download the app now, so all the functionality would need to be migrated or combined into the final combined app

  • there might be other requirements to be a "normal Mac app" that aren't currently being met by the java app (icons? code to handle shutdowns? power saving compatibility?

  • even if you embed java in your app, now you have to worry about making sure the embedded version getting out of data - aren't you going to manage that depdency and updating it? What about users that are on locked down machines? Are there permission issues?

#3 is something that developers hate, as they have to maintain the hack, as users will come to expect something to work (in this case screen time). A gross hack might be any of these:

1. Have the launcher try to kill the java app if screen time is coming to lock it out (https://developer.apple.com/documentation/deviceactivity/)
2. Have the launcher send a "you can play for another 60 seconds" to the java app, once a minute, so long as screen time hasn't locked it down. The java app would have to keep track (and shut down if it runs out of time).
3. Make an additional "Mac-screentime-experimental version" build of the app (https://alvinalexander.com/java/how-build-macos-application-from-java-jar-file-jarbundler/) that compiles in java to make a single file Mac application (instead of a java jar file) and have the launcher download and run that for Mac users. Leave a checkbox in the launcher with a warning "this might not work / might crash" and see if users end up happier (and judge how many new bugs come from the weird experiment - maybe it'll "all just work" (haha). More likely, every update creates a new version of the app (so you have multiple entries in screen time) and a host of other issues pop up.
4. Make a "Screen-time-compatible-build" of the launcher, that folds in java, the code to run both the launcher and the a particular version of the Minecraft game itself. It would only run this version and need a complete redownload every time Minecraft updates. See if anyone can download it and make it run and how miserable they are after an update requires a redownload.
5. Have an intern write a "Good old java games" launcher app and dig through to find a few dozen old java games on GitHub to create a fun way for kids of play old games again. Suddenly Minecraft isn't the only thing that has a java-apps-don't-respect screen time problem and the priority of the Apple bug will move up. Note, if you search for "Mac java game" almost every result points to Minecraft - impressive, but makes the case for fixing the bug at Apple much harder - it's a Minecraft bug to them, not a platform issue, because no one else is using that legacy part of the platform for games.
6. Hire a former Google PM with a last name like this account and he'll make this issue go away and users will be very happy. Working at Apple or Mojan, he'd set up a quick conversation across teams would allow them to recognize why this is stuck and draw straws on whose hack is less bad because in the end, the kids are suffering, and it's both teams' problem.

Cheers,
John