The long road to 64-bit only Android
Back in 2017, Apple ended support for 32-bit applications with iOS 10.3.2, dropping compatibility with old, unmaintained apps from the dawn of the smartphone. It took the company just four years to transition iOS from 32-bit to 64-bit only software, a remarkably quick turnaround made possible by Apple’s total control of its hardware, the iOS operating system, and the App Store.
Google, on the other hand, does not exert the same level of control over the hardware that can run Android or the methods of app distribution, so Android still supports running 32-bit applications to this day. That’s despite the fact that the Armv8 ISA introduced the AArch64 execution mode back in 2011, Android 5.0 Lollipop introduced platform-level support for 64-bit apps in 2014, and Google Play mandated that apps support 64-bit CPUs in 2019. Android as an OS platform won’t deprecate 32-bit support for quite a while, but we’re finally nearing the point where the first devices will ship with 64-bit only support. Before that happens, though, we’re about to enter a weird transitional period thanks to the launch of asymmetric 32-bit SoCs from Qualcomm and MediaTek.
Earlier this week, Qualcomm announced the Snapdragon 8 Gen 1, the company’s first system-on-chip to use the Armv9 ISA. The CPU features one Cortex-X2 core, three Cortex-A710 cores, and four Cortex-A510 cores, but only the three Cortex-A710 cores support execution of 32-bit applications. MediaTek’s flagship Dimensity 9000 chipset, which was announced just two weeks ago, has a similar core configuration. That means 2022’s flagship smartphones will only use three of their eight CPU cores to execute 32-bit apps.
This, at first glance, seems problematic given the way CPU affinity works in Linux. As explained in this LWN article, Linux’s task scheduler was designed to assume that all CPUs can run any given task, albeit at different performance or power consumption levels depending on the specific core chosen for the task. However, the introduction of CPUs with some cores that can execute 32-bit tasks and some that cannot changes the equation; the scheduler distributing tasks to a CPU core incapable of executing that task could be detrimental.
Fortunately, kernel engineers at Arm and Google were well aware of this impending problem, so late last year they began work on a series of patches to support asymmetric 32-bit SoCs, which kernel engineer Will Deacon hilariously described as systems built by “some crazy folks.” These patches have been picked to the mainline and android12-5.10 Android Common Kernel branches already, so Android devices with the latest chipsets from Qualcomm or MediaTek will almost certainly have this feature. This document explains in-depth how Linux’s task scheduler will handle the asymmetry if you’re interested in more details.
If you’re wondering why SoCs are being productized with a mix of 32/64-bit capable cores in the first place, the reason is that there are still markets where 32-bit apps are being distributed. Over 99% of new and updated apps on Google Play are bundled with a 64-bit APK, thanks to Google’s policy update in 2019 that forced developers to distribute 64-bit versions of their apps. However, there are a myriad of app stores in China, each of which have their own set of rules, so there isn’t a gatekeeper like Google that can force app developers to recompile their apps. Thanks to an agreement between the top app stores in China, though, the distribution of 32-bit apps will be largely phased out next year. With these requirements in place, the first 64-bit only SoCs are set to be productized in 2023, and that’s finally when we’ll see the first Android devices ship without support for 32-bit apps.
Android itself is also finally ready to support 64-bit only configurations. Android 12 is the first version of the OS to support 64-bit only builds. All Android devices currently on the market run either a 32-bit or 32/64-bit hybrid Android build, but Google aims to eliminate the latter through the use of compatibility requirements. The latest revision to the CDD explicitly requires device makers to build 32-bit Android for low RAM devices. The goal is to reduce the types of Android builds to two — Android 32-bit only and Android 64-bit only — to reduce fragmentation until 32-bit support can be fully deprecated years from now.
Once Android’s 32-to-64-bit transition is finally complete, though, some iconic apps will unfortunately be retired from use, as was the case when iOS dropped 32-bit support. Apps, especially older games that haven’t been recompiled, will be lost to history without emulation, which is unfortunate because Android is as important to the history of the smartphone as iOS. Data preservationists will surely maintain backups of old Android apps, though, and it’s much easier to run older versions of Android than it is iOS, so things aren’t as bad as they seem.
This week’s edition of Android Dessert Bites took you down the road to 64-bit Android, which is a change that’s years in the making. The benefits of 64-bit only Android won’t be visible to most users, but they’ll make a big difference to device makers. One of the primary benefits is improved security, as a higher available address space allows for better address space layout randomization (ASLR) and enables other features like memory tagging extension (MTE), pointer authentication (PAC), and branch target identification (BTI). Other benefits include better performance and reduced costs from not having to support multiple ABIs.
If you’re an app developer, I hope your app is among the 99% of new and updated apps on Google Play that are compliant with the 64-bit policy. If you have a legacy 32-bit app, Google has a guide on how to get your app ready for 64-bit devices. Apps written in purely Java or Kotlin already support 64-bit devices, but apps that use native code may need to be recompiled with 64-bit libraries.
The first smartphones with Qualcomm’s Snapdragon 8 Gen 1 will launch later this month, while the first smartphones with MediaTek’s Dimensity 9000 will arrive in late Q1 2022. It’ll be interesting to see if there are any unforeseen quirks with running a 32-bit app on one of these asymmetric 32-bit SoCs — if you have a recommendation for an app to try, I’m open to suggestions! If you have any other questions or an issue you want me to look into, please feel free to reach out to me at firstname.lastname@example.org.
Keep your eyes peeled for the next edition of Android Dessert Bites, as I plan to share a few interesting code discoveries related to the next version of Android — Android 13 “Tiramisu”.
64-bit Android: Where we’re at in July 2022
This article was originally published in early December of 2021, when it was clear that the transition to 64-bit only had just begun. There have been a few advancements since then, so I thought it’d be worth mentioning them in a brief update.
Perhaps the biggest news is the introduction of Arm’s new lineup of Cortex CPUs in late June. The new Cortex-X3 and Cortex-A715 are 64-bit only cores, but the refreshed Cortex-A510 adds optional 32-bit compatibility. While this means that 32-bit support hasn’t entirely disappeared from 2022’s lineup of Arm cores, it shows that the transition to 64-bit is moving along. After all, the previous Cortex-A710 supported both 32-bit and 64-bit apps, but this year’s Cortex-A715 doesn’t. 32-bit support is in the refreshed Cortex-A510, but it isn’t configured by default.
Moving along, there’s the Android side of things. As I previously mentioned, Android 12 can be compiled with 64-bit only components, making Android 12 the first true 64-bit only Android OS. However, this is something that OEMs can only do for testing purposes, as 64-bit only builds of Android 12 aren’t GMS certifiable. This will likely change with the upcoming Android 13 release, however.
It’s worth noting that Android Automotive has already moved to 64-bit only builds with Android Automotive 12. The reason Android hasn’t ditched 32-bit support in the handset side of things is that certain markets (namely China) still sees the distribution of 32-bit apps and games, so legacy support is needed to not alienate those customers. However, since the introduction of an agreement between the top Chinese app markets last year, the number of 32-bit apps and games being distributed in the market has been dwindling, and we are almost at a point where legacy support can be safely dropped. One method to speed this process up is to shame 32-bit apps into updating, as proposed by an Arm engineer, but this method hasn’t been endorsed by Google yet.