Categories
Tech Thinking hard, or hardly thinking?

Two-Hand Philosophy

Monday morning! Time to get to work!

This morning, I put on my morning playlist to find my inspirational message from The Rock himself, Mr. Dwayne Johnson, was missing.

I notice that the five tracks from “Dwayne Johnson Workout” were missing from my playlist on my computer. These are 30-second clips of Dwayne Johnson telling you how hard work is worth the effort. It’s 2020, folks. I listen to these multiple times every single day.

I pulled these from a bigger playlist, “Dwayne Johnson’s Progress Workout Playlist“, with his motivational spoken tracks and some POWERFUL ROCK MUSIC TO KEEP YOU GOING. I click through, and they are all greyed out and unplayable in the original playlist too. Harrumph.

I knew these worked yesterday! My stomach drops. I had a feeling I had to act quickly.

I grab my phone, put it in in Airplane Mode instantly, trying to catch it before it realizes the tracks have been removed. As silly as it seems, to be faster than a computer, I have a chance here. Android pauses nearly all apps when it thinks your phone is sitting on a desk, not plugged in. (They call it Doze.) I had also marked the whole playlist for offline playing. Spotify says they give you ~30 days in offline mode before you have to go back online to reauthorize things. Maybe I can finagle a way to keep these tracks, so The Rock can help me get my work done and tell me I’m doing a great job.

After confirming I was in Airplane Mode, I open up Spotify. 4 of the 5 tracks are playable. The first, however, was greyed out and unavailable. :/ 4 outta 5 ain’t bad, folks. We can do this!

I tweet about the tracks going missing, and do a little research. They came out about a month ago, as part of a promotion Dwayne Johnson is doing. They’re on Spotify under “Seven Bucks Productions“, which was founded by (and still CEO’ed by) Dwayne Johnson. It doesn’t look like they’re available anywhere else, and I can’t buy them.

Before I dig in, I should confirm that there isn’t a weird glitch with my account or something. I jump into Spotify support chat. They quickly confirm that these tracks were no longer available in any region, so I rule out VPNing to a different country as a helpful component of my recovery strategy. The support person won’t tell me any reason why the tracks were no longer available, if they were always going to be pulled today, or if they were coming back.

OK, so let’s say there’s some sort of glitch and Spotify thinks the tracks violate some policy, or some intern somewhere marked them as a violation and another company automatically pulled them, or some other wishy-washy excuse. How can I get these tracks back?!

The first thing most folks will think of is copying the files. I knew that the Spotify cache was encrypted. This means they had gone out of their way to protect it. I am not a full-time security engineer, but I have done more than my fair share of security work. While there are likely issues that someone who could really devote some time could dig into, I’m not particularly interested in trying the front door, if I can see a bunch of bars and locks and guards from across the street.

This is voice, not a huge orchestral recording. I should be able to get the audio in a roundabout way and still have a decent recording. I look at the Android API docs to see if apps can record other app’s audio. They can, as of Android 10! Apps can block this in their manifest, but let’s give it a shot. Screen Recorder is free, has no ads, and uses these APIs. I install it, turn up the audio quality settings, and set it to record internal audio. I start the recording, open Spotify, and play one of the aforementioned tracks. I stop the recording, play it back, and… bupkis. No audio. Looks like Spotify blocks the recording in its manifest.

Android 11 comes with a screen recorder, now! Maybe because it’s part of the system, it has different permissions and can record this audio! I add the Quick Setting tile, set it to record audio from internal sources, and… nothing. Harrumph.

OK, what about analog? Some fellow nerds call this “the a(nalog) hole“. The Pixel 2 doesn’t have a headphone jack, but I have a USB-C headphone jack adapter. I could run a 3.5mm patch cable to my laptop, grab the audio, and have *something!*

After connecting it up, I jump into Audio settings on my Macbook to switch the headphone jack to an input. Hmm, where’d the “use this jack for audio input” box go? Oh, now you can only get audio input using TRRS cables? I don’t have any way to make the audio from my phone output that way. :/ I have some TRRS adapters at my workshop (and USB audio dongles that have mic inputs) but it’s rapidly approaching Monday afternoon and I haven’t yet gotten started with my “work”.

What about decompiling the APK, modifying the manifest to enable recording, signing it, and putting it back on my phone? I’ve done deeper APK modifications in the past with some of my AOSP work. I’m not a pro-level Android APK reverse engineer, but this shouldn’t be a long job. As I think about it, however, I realize that I can’t figure out any way to do this while preserving the offline file. As far as I know, I’d have to remove the current APK before loading my modified APK onto it.

What about something even more esoteric? The avenues are limited. My phone isn’t rooted and I don’t have this song on any Spotify installations on any emulators. I take a quick look, anyway, and folks report that Spotify has a fair amount of anti-piracy/anti-reverse engineering/anti-root stuff built-in. Fine, fine.

What about through a system-level debug utility? I do know my way around AOSP documentation and I’ve set that stuff up before… I quickly find:

“For privacy the tee sink is disabled by default, at both compile-time and run-time. To use the tee sink, you will need to enable it by re-compiling, and also by setting a property. Be sure to disable this feature after you are done debugging; the tee sink should not be left enabled in production builds.”

AOSP Documentation, Audio Debugging

Alright. I take stock of my options. I think my best bet is to figure out how to get the audio out of my phone on a 3.5mm cable and record it. Many of my computers, my Macbook, even the ones running Linux, (WHO NEEDS FREEDOM IF IT CAN’T HELP THE ROCK TELL YOU THAT HE APPRECIATES YOUR HARD WORK?!?!) have combined headphone/mic jacks. After some reading, it seems that many of those have the ADC/DAC TRRS muxing done automatically by some intermediate circuitry, rather than under the direction of the operating system. I do have a computer that has a split headphone/mic jack, but my 6YO uses it all day for “distance learning”.

Rather than interrupt my son’s education (for this increasingly lengthy endeavor) for twenty minutes as I get levels set and these tracks backed up, I decide to put this on pause. It’s REDACTED o’clock on Monday morning, and I haven’t billed a single minute yet. I’ll get to work, two-hand philosophy, without Dwayne Johnson in my ears, and after my oldest is done with school, after I get some work done, I’ll make a copy of these tracks. My phone’s in Airplane Mode; I’ve got nothing to worry about. If this all fails, I have other ways of recording 3.5mm audio at my workshop, like USB audio dongles, Teensy Audio Shields, a variety of dev boards…

Before I really get to to work, I post some of this to a few places, to see if any smart folks had any other ideas. Some recommended keeping this phone in Airplane Mode forever, turning it into a Dwayne Johnson shrine. (Spotify gives you a 30-day timer when you go into offline mode, so once they learned about that, it morphed into requiring a software-defined cellular base station without internet access, with a modified clock.) Other folks recommended setting up an offline wifi network, joining my phone to it along with another computer that I’m also logged into in Spotify, seeing if I could play the track through the computer from my phone, and then using some fancy audio routing software to record it on the computer. I think that’s an amazing idea! I would want to try that *after* all else had failed, because I guess it’s possible Spotify could share “media no longer available” lists even offline, and I didn’t have any computers logged into my Spotify account that didn’t already know that those tracks shouldn’t be available.

Alright, end of the day! Let’s do this! I take my phone, still in Airplane Mode, over to my son’s computer, connect up the USB-C to 3.5mm adapter and the 3.5mm patch cable. I don’t think I’m exactly supposed to blast headphone-driving outputs into this mic input, electrically speaking, so I play a random track (the Phineas and Ferb theme, actually) while looking at the levels to get the volumes right. l use arecord to grab some audio, then play it back. My brain knows that it’s a photocopy of a photocopy of a photocopy, but it sounds fine to my Old Man Ears (and I’m trying hard to be optimistic). IT’S GO TIME, BABY!

I switch over to the list of the five Dwayne Johnson motivational tracks, and… What? My face falls. They’re all marked unavailable. How? They worked REDACTED hours ago, and it’s been in Airplane Mode since the morning!

Did my phone take itself out of Airplane Mode? Did Spotify see I was trying to get at its music and go into lockdown? Did the tracks have some sort of deadline metadata built into them? I know that, in general, you can put Spotify in offline mode and play music for days and days. It says up to a month–I’ve never tested that, but I’ve used it over long weekends without internet access. This Dwayne Johnson catastrophe happened in the span of a day, so I truly have no idea what happened.

One favorite–my mom.