We're still reeling from the fallout of the explosive decision in the lawsuit between Sonos and Google regarding patent infringement. Google immediately updated several of its devices to remove violating content, disabling volume control for speaker groups and pushing some users to update their devices using a new app on the Play Store. Days before, however, the company returned a utility initially removed in the lead-up to Android 12. If you've been wondering what's going on with Cast volume control, a new exposé is giving us an in-depth look.

Esper's Senior Technical Editor Mishaal Rahman published a great explainer into one of the weirdest repercussions of Google's ongoing law battles with Sonos. It's worth reading in full, as Rahman goes into complete detail about what's going on with Cast at a system level. The piece also confirms some suspicions regarding whether or not the company was acting in part because of its legal issues.

Last summer, Android 12's fifth beta release removed Cast volume controls, something that initially seemed like a bug before reality set in. If you've never streamed music or videos to a nearby receiver, this feature allows your device to automatically change the volume of anything actively casting just by using the volume rocker. With it, there's no need to switch between toggles or interact with Android itself manually — everything happens automatically. However, when the final stable (well, sort of stable) build launched in the fall, these controls were nowhere to be seen, leaving many to speculate on what was going on with a once-easily accessible utility. In December, a comment left in Google's issue tracker called out an unspecified "legal issue" that left many to assume Sonos was the culprit.

Last week's ITC decision seemed to confirm that theory, even as it came days after the January patch for Pixels added those volume controls back in. Rahman's post offers a look into why Google removed the feature and how it managed to add it back in. In early September, when Beta 5 arrived for testers, a change in Android's code caused it to stop checking for whether playback was happening on-device or remotely, which, in turn, affected nearly every app on your phone Rahman explains:

Previously, the getDefaultVolumeSession method only checked the playback state of the media session, regardless of whether it was local or remote. This platform change resulted in volume key events being dispatched only when the active media session used local playback. This, in turn, affected apps utilizing Google's support library for media, which is how most apps handle requests to adjust the volume for remote media sessions.

With Android 12's latest release, Google tweaked this rule for a second time. Instead of checking whether the playback was happening remotely, it added a new method: "canHandleVolumeKey." This rule returns either true or false, depending on whether one of three conditions is checked. The first check simply looks for local playback — simple enough. The second looks to see if the config_volumeAdjustmentForRemoteGroupSessions is set to true. AOSP builds have this set to true by default, but the patch that went out to Pixels at the start of this year does not.

So, if you're casting audio to a speaker, rule one fails. Rule two automatically fails on Pixel devices, bypassing it altogether. That leaves rule three, which looks to make sure there's only one route for the app — in other words, only one speaker is serving as a destination for the audio.

That wraps back around to speaker group volume control, which Google disabled following the decision in the Sonos results. It's certainly suspicious timing, implying the company may have known ahead of time that the case wasn't going to turn in its favor. The war between Sonos and Google is far from complete, but with some rapid changes made hours after the ITC had reached a ruling, it seems likely that an outright ban on imports won't go into effect.

These code changes are pretty complex, but Mishaal does a great job diving deep into how Android's code has changed due to these legal issues — and how some technically-savvy users can get speaker group controls back. It's definitely worth checking out his entire walkthrough if you're interested in how patent infringement can affect the software running on billions of devices worldwide.