Shared publicly  - 
 
Play Music v5.2.1204L - What the hell is XDI?

Google has neglected to release a changelog so I guess it's up to me/us, along with a teardown.

- "Genre Radio" is now a thing. I don't have All-Access access to try. AP has screenshots: http://andp.lc/1allLii.
- There is now a "Send Feedback" menu item
-  Downloads queue now looks like a real part of an Android app, instead of a broken, blank, white screen. (old/new screen is also tablet vs phone, so use your imagination.) It also does resuming!

XDI - a music player for Google Glass
Edit: +Josh Brown figured out it's Glass related. I think it's a remote control music API for Google Glass (and it looks like it could be for other stuff, too)
Remember this? https://gist.github.com/zhuowei/5929452 Glass has music controls. This is the other half of it.


- There's a new activity called ".xdi.XdiPlayActivity" and a few references to "XDI" in the new music code, including an entirely new folder. 
- There's ".xdi.XdiContentProvider," which has a permission called "com.google.android.xdi.permission.ACCESS_APP_BROWSE_DATA",  and a new authority, "com.google.android.music.xdi."
- There's also a new icon for whatever "XDI" is, an all-black Play Music icon.
- All the smali in the XDI folder ends with the word "Cursor."
- There is a lot of duplicate functionality here. That and the simple logo makes me think it's for a watch or something.

Let's hear your theories

(Thanks to +Tommy Nunno for the apk, which is here: https://docs.google.com/file/d/0BxI1YpjkbX0OaUI2RGhQNEE4YWM/edit?usp=sharing)
91
9
Cristian Giordano's profile photoSimon Jones's profile photoRaul Santos's profile photoAdam Lawrence (coggy9)'s profile photo
73 comments
 
X = Cross
D= Device
I= nofuckingclues

EDIT: Maybe I stands for "initialization", or whatever, meaning a way to start music playing from another device?
 
+Duccio Mondanelli integration! I was actually wondering if this was for a watch or something. I really have no proof of that though.
 
There is a lot of duplicate functionality here, which makes me think it's for some other device, like a watch.

Really though, why is there new code being added for things like "artist detail"?
 
If it's not a watch, which probably is, maybe car integration?
 
Progressive rewrite? Use some old, use some new, and phase out the old as you roll up?
 
Cross-Device Integration could mean being able to use one device as a remote while the other plays and/or switching the music to another device (rdio has this functionality).
 
Could this be multi-device playback (via Chromecast) a la what the Nexus Q used to be capable of? Many devices, one playlist
 
If its really watch that means system level UI would be light with that dark icon! Glass icons are white on black UI.

What other light UI do we know of? :)
 
Whatever it is, the content provider is exported, meaning it expects other apps to use it...

Edit: so is XdiPlayActivity, so it expects other apps to deep link too. It's got its own IntentFilter and everything.
 
Thank goodness they fixed the downloads menu, that bugged me.
 
+Ron Amadeo seems like they added into the setting stream quality. So now you can choose to listen to crappy sounding music but not complain about data usage or high quality sucking up tons of data. Over Mobile networks of course.
 
Looking at it more deeply, this has nothing to do with Chromecast. This looks more like it's exposing its data to other apps. I'm not sure whether they'll be public apps or internal to Google (I suspect the latter).
 
+Josh Brown - it would be nice to be able to access my Google Play Music from other music players though. I could see that being a very useful addition.
 
+Ian Lake It's not library meta-data. That's what I thought at first, but going into more detail I don't think so
 
Wow the download queue looks a lot better now.
 
I'm tearing down that ContentProvider right now. I'll let you know if I can figure out what it's for.
 
OK, I've combed through the java and I swear XDI is a tiny music app within the music app. Now what?
 
P.S. The Download to SD card hack that was removed in the last update is still gone.
 
+Ron Amadeo There's also a new internal Activity you can start via Nova's Activity launcher for XDI, but it doesn't do anything by itself. Hrm.
 
I just realized there's an an XDI version of the search icon. It's white this time. weird.
 
I just found  <color name="xdi_background">#fff68419</color>, which is the Play Music orange color. So whatever it is has its own theming.
 
OK, so tearing through that ContentProvider yielded a lot of valuable info. They've got paths that map to just about every part of the app.

launcher
launcher/items/
launcher/items/#
browse/headers
browse/#
mymusic/headers
mymusic/#
mygenres/headers
mygenres/#
details/albums
details/albums/*/sections
details/albums/*/tracks
details/albums/*/actions
details/playlists/#
details/playlists/#/sections
details/playlists/#/tracks
details/playlists/#/actions
details/artists/*
details/artists/*/sections
details/artists/*/albums
details/artists/*/actions
details/artists/*/topsongs
search
search/headers/#
explore/headers
explore/#
explore/featured/headers
explore/featured//
explore/recommendations/headers
explore/recommendations//
explore/newreleases/headers
explore/newreleases//
explore/genres//
explore/genres///headers
explore/genre/featured/items///*
explore/genre/newreleases/items///*
explore/genre/featured/*/headers
explore/genre/newreleases/*/headers
explore/genre/items/*
explore/genre/*/headers
meta/#
metatitle/*
 
lol some of the "star slash star"s got turned into bold slashes. but you get the idea.
 
This looks like a Play Music API. It could be a public API, but I find that unlikely. More likely is that this will interface with a smartwatch app or something like MyGlass to allow the user to browse their Play Music library from another connected device.
 
Could the xdi code be complied into its own app then launched or am I on the completely wrong tangent?
 
It looks like XDIPlayActivity lets you start a Radio station from another app. It takes a lot of extras in its Intent, though, so it'll be hard to test.

it needs:
int container
String name
long id
String id_string
int offset
String artUri
 
XdiLauncherActivity is only started so it can launch the other app's BROWSE activity. It creates the BROWSE Intent, starts it, then calls finish() on itself. Not sure why they're doing that in an Activity. Also worth mentioning that it's not in the manifest, so it's either still in development or not intended to be used.
 
I was thinking a play music api might be it, but why are there custom icons?
 
This isn't a public API. I'm sure of it now. I'm still gathering details on the kind of API it is, but I can tell you it definitely involves Glass in some way.
 
Ok, so XdiUtils.isXdiEnvironment(Context context) looks something like this:

public static boolean isXdiEnvironment(Context context){
    if(MusicPreferences.isGlass())
        return true;
    if(!XdiUtils.isXdiClientInstalled(context))
        return false;
    return true;
}

MusicPreferences.isGlass() literally checks Build.DEVICE and returns true if it's "glass-1". I'm still hunting down what isXdiClientInstalled does for sure, but it definitely involves a hard-coded list of package names.
 
BTW, I'm translating smali to Java by hand, so there may be the occasional logic error. I'm pretty confident in that part though.
 
As I suspected isXdiClientInstalled iterates through XdiUtils.XDI_PACKAGE_NAMES (a private static final String[]) and returns true if any of them are installed. Right now that array is empty, though, so it's anyone's guess what apps it's looking for.
 
Anyone know how long MusicPreferences.isGlass() has been there?
 
Isn't it weird listen to music on glass? i mean: 1) is via bone conduction 2) it's Mono.
 
I don't know that it's necessarily for listening. This could be a remote control from glass.
 
It looks like Glass would be used as a remote control. It's got calls to isGlass() in the RemoteControlClient code, and in the MusicContentProvider there's this weird SecurityException("isNautilusUser can only be accessed on from within music app or on a glass device"). Anyone seen the codename "Nautilus" before?
 
During the "tutorial" the app will auto-select your account for you if you're on Glass when signing in...
 
Well, I tried installing the Music app on Glass, but it doesn't appear to do anything special via Launchy. I'll play around and see if any other parts have changed.
 
Also, as a side note, listening to music on Glass is not as horrible as I'd thought. Still pretty terrible, but I could see it working.
 
+Josh Brown XDI is brand new, so music preferences is new, too.

The glass music app would have to be a remote. There's no way to get headphones for glass. (Other than maybe, Bluetooth?) So there's some glass component we'd need to get it to work.
 
MusicPreferences isn't part of XDI, it's just referenced. It's used all over the app.
 
Could Nautilus be a codename for All Access?
 
Well, if its in the xdi folder, its new.
 
+Ron Amadeo  I meant the isGlass() method in com.google.android.music.preferences.MusicPreferences.
 
Also new discovery: if isXdiEnvironment() returns false, the XdiContentProvider aborts in its creation, meaning just about all of XDI becomes useless. I still don't think this is the remote itself, but it's definitely providing the data to the remote. And whereas before I thought this would live on the phone/tablet, more and more I'm seeing stuff meant for living on Glass.
 
BTW, I've written a small app to break open that ContentProvider and see what data is inside. I'm just starting to get stuff, and it looks promising.
 
Holy crap! I just got it to play music on Glass via the XdiPlayActivity. And that ContentProvider definitely has all the info you could ever want about the user's library (except a way to actually get the music files). Best I can figure is that XE10 (or possibly something hidden in XE9) will enable music playback.

Glass (and possibly other accessories, e.g. a watch) will be able to browse your library for sure, although I'm not sure if playback will happen there or if the MyGlass app (or something similar) will trigger playback on the connected device.

"OK, Glass, listen to Lover's Carvings"
 
I'm Glad Google finally redid the Downloads screen.
 
There's no visuals, just audio. And recording audio on Glass sucks. I can send you my source, though. It dumps the contents of the ContentProvider to the log or tries to start the playback activity (depending on a hardcoded boolean). It's all really messy code, though. I just wanted to poke around.
 
+Josh Brown I don't think playback will ever happen on the glass device, it's just a remote, that's why there's no way to get at the music. 

This is for Glass and smartwatches and stuff. Just a remote music app, not for playing on the wearable device. Streaming music files over bluetooth or whatever would be insane.
 
+Ron Amadeo It'll play it back just fine. It's just that there's no way to access the files directly through this API. The client app can cause the Play Music app to play stuff on its behalf, though. All the stuff I've been doing so far has been local on Glass. It never tried to send anything to my phone.
 
But I agree that it would be most useful as just a remote. The two pieces aren't strictly tied together, so the data could be read on one device and trigger playback on another, but both devices would still need the Play Music app installed.

And Play Music, even if installed on Glass, is still fully capable of playback.
 
+Josh Brown Audio can happen anywhere from phones to tablets, tvs, chromecast supported devices. 

It Could pick up default device if you are connected on same wifi networks OR if device is in bluetooth trusted zone like motoX
 
+Rajesh Handa "Can" and "is likely to" are two different things. At this point playback is most likely either on Glass directly (so no cross-device communication) or on the Android phone (cross-device communication handled by the MyGlass app). My bet would be the latter, although the former is certainly possible.

Edit: also worth noting that I've already got the former case working on my Glass. That doesn't mean that's the route Google will take, though.
 
true true but something doesn't feel right about music on glass or watch.  
 
If anyone else wants to dig through that ContentProvider and see how to get it to play music, I posted my source at https://github.com/keyboardr/XdiExplorer

It's currently configured to run through the /browse/1 part of the ContentProvider (the Listen Now section, basically) and play the first thing it finds that is directly playable (usually radio stations). I suggest walking through the code yourself to see how everything works. You need to have the Play Music apk installed before this will work.

Beware: the code is quick and dirty.
Also Beware: there's no way to stop the music just yet. I hope you like whatever song or radio it decides to play
Add a comment...