AOSP, like Chromium OS, is an open source operating system, but Google isn’t nearly as open with its ongoing development as they are with Chromium. Instead, most of the source code for the next version of Android is held from the public until Google is ready to release it. However, not every code change is withheld from the public AOSP Gerrit. Code changes tweaking some under-the-hood components that aren’t interesting to anyone but system engineers (and nerds like me) are committed to the AOSP master branch all the time. Sometimes, these seemingly uninteresting code changes point to something exciting coming down the line, and in today’s edition of Android Dessert Bites, I’ll be looking at one such change and what it may mean for the Pixel.
Earlier this week, my friend Luca Stefani informed me about a patch submitted to the Linux kernel’s power supply subsystem. Google engineer Jack Wu submitted this patch last week, which adds a new power_supply_type string called “dock”, joining other power supply descriptors like “Battery”, “UPS”, “Mains”, “USB”, and “Wireless”. The purpose of these descriptors, according to this presentation from Sebastian Reichel, the maintainer of the Linux kernel’s power supply subsystem, is to supply information to userspace applications about the type of power supply that’s powering the device. Having information about what’s powering the device is useful as it lets the OS and applications adjust their performance profiles accordingly. If a device is running off a battery, for example, then it wouldn’t be wise to run high performance tasks that might lock the CPUs to near their maximum frequencies.
This kernel patch raises the question: Why does Google want to add this new power_supply_type now? Google does pay contractors to work on improving the overall security of the Linux kernel, but this patch doesn’t seem to be for general maintenance. Google recently committed to an “upstream first” development model for new features, which means they want to land new kernel code in the mainline Linux kernel first before merging it to the Android Common Kernel branches. Since Google has yet to submit a kernel driver that actually uses this new feature, though, this patch hasn’t landed in the mainline Linux kernel.
Google may not be ready to release their kernel driver yet, but they’ve begun work on the Android bits to “support Dock charging”. None of the Android-specific code changes reveal any useful information about Google’s plans for this feature, which is unsurprising given the nature of Google’s public versus private development. Yet I still find these code changes interesting.
Since the early days of Android, the platform has supported the concept of physical docks. The ACTION_DOCK_EVENT broadcast was introduced with Android 2.0 to notify apps of changes in the physical docking state of the device, while the UiModeManager class was introduced a few releases later with broadcasts that are sent when the device has been placed in a car or desk dock. Google’s documentation on docking also mentions other dock types introduced in Android 3.0, but more importantly, it also mentions that the dock state is “typically closely linked to the charging state as many docks provide power to docked devices.” It should go without saying that docks often provide power to devices that are docked to them, but this was always obvious, so why is Google now adding “dock” as a supported power supply type when the BatteryMonitor class is nearly a decade old.
Keep in mind that the Motorola Atrix with its laptop dock came out in 2011, so at that point in time, device makers thought physical docks would be all the rage. They obviously weren’t, but they seem to be making a resurgence, so the gossiper in me speculates that these recent changes have to do with an upcoming Pixel software or hardware feature. Exactly what that may be is something I don’t know, but it wouldn’t be the first time that a vague hint in AOSP led me to predict a Pixel feature.
Still, I admit my speculation lacks tangible evidence. I did notice that the Google engineer who’s working on dock charging support also submitted a series of code changes that improve charging support on foldables, and there’s considerable evidence that Google is working on its own foldable phone. In addition, one of the reviewers of these code changes is the Pixel team lead for charging and battery. Without additional evidence, though, I’d take any conclusions you might draw with a pinch of salt.
I decided to take a different approach to this week’s edition of Android Dessert Bites after nearly burning myself out from last week’s post on the security patch process (which I really recommend reading!) If you’re looking for the kind of in-depth explainer that I posted last week, then keep your eyes peeled for a future edition I have planned for Android Dessert Bites where I’ll talk about the incredibly important but woefully underdocumented Google Requirements Freeze program. Follow the Esper blog as well as I’ll be posting some articles there soon that cover unpublicized changes to the Android platform that are poised to have a profound impact.