Just the other day I published an update to an app of mine that would allow you to place non-Leanback apps on your homescreen. This was done by dynamically creating an app which would simply redirect the user to the correct activity. This has gotten a lot of positive reception, although some users pointed out an interesting screenshot of the new NVIDIA Shield TV that seemed to make this feature obsolete.
The screenshot, originally from German tech site Golem.de, depicted the user’s homescreen. You can see their apps, each having banners. However, there are two apps which do not have banners. Instead they have just an icon and text. Does this mean the launcher will now be surfacing non-Leanback apps? No.
How Leanback Launcher Works
NVIDIA uses the Leanback Launcher, a launcher that is built by Google. It seems to contain some internal APIs that allow OEMs to hook into it to present custom rows. This allows NVIDIA to present its custom row for its apps, or add options for Shield accessories. But whenever the launcher is updated, that update comes from Google, from the Play Store.
The launcher is fairly straightforward. It gets all of the Leanback apps and presents them in an order. This order can be customized by the user.
How does it do this? It uses Android’s internal system to search for all activities that match the filter
android.intent.category.LEANBACK_LAUNCHER. This is similar to
android.intent.category.LAUNCHER, but designates a TV activity. From this, a new tile can be drawn on the screen.
Now the launcher wants to display content on top of that tile. It gets the activity metadata as a
ResolveInfo object, and tries to load the associated
Drawable by calling
resolveInfo.activityInfo.loadBanner(getPackageManager()). For most apps this will obtain the banner of the activity if that is set, or the banner of the application if that is set. However, what if there is no banner set? That would mean our
Drawable above would be
null, and we can’t put that on the tile.
Thus, a workaround is added. When there is no banner, we instead load the icon. Most apps have an icon. It can be accessed by calling
resolveInfo.activityInfo.loadIcon(). To make it apparent which app is displayed, the name of the activity or app is displayed to the right.
What this means is that just including the
LEANBACK_LAUNCHER filter means your app will appear on the homescreen. This is what I exploit in the Tv App Repo to get tiny shortcuts to appear. I use the same code to get the icon and app name, and generate an APK with that intent filter. So if these two apps contain the
LEANBACK_LAUNCHER in their manifest, a metadata file that lists all information about the app, then they are effectively Leanback apps.
There are two apps shown in the screenshots, ES Datei Explorer and AppStarter. ES Datei Explorer is the popular ES File Explorer in English. By opening up the APK for this app, which can be obtained through APK Mirror or other sources, we can see the contents of the manifest. Below is an excerpt from that file.
<activity android:theme="@ref/0x7f0a0096" android:label="@ref/0x7f08000e" android:name="com.estrongs.android.pop.view.FileExplorerActivity" android:launchMode="1" android:configChanges="0x4a0" android:windowSoftInputMode="0x30"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="resource/folder" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
So, ES File Explorer does technically support Leanback even though it doesn’t have a banner. Apps can be uploaded to the Play Store that technically support Android TV even if they are not manually reviewed for Android TV. Additionally, once the app passes manual review, the app can later remove TV support without being reviewed again.
The second app, “AppStarter” is not available on Google Play. It is an open source app on GitHub. Ironically, it is actually a custom launcher, primarily designed for Amazon Fire TV, that lets you access sideloaded apps that don’t show up on the main launcher. Since it’s open source, we can quickly look at the manifest.
<!-- Main Activity (Launcher Activity) --> <activity android:name="de.belu.appstarter.gui.MainActivity" android:label="@string/AppName" android:launchMode="singleInstance" android:stateNotNeeded="true" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.HOME"/> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> </intent-filter> </activity>
Again, this activity lists support for the Leanback Launcher yet neglects to provide a banner.
I can see how this may have caused some discussion in the community. The inconvenience of many apps not appearing on your homescreen is certainly frustrating. However, the reason they don’t appear is usually because they’re not designed for the form factor. Surfacing these apps would cause users to activate them and have a frustrating experience when the app doesn’t work as expected.
For power users, ones who will use workarounds for these unoptimized apps, they can use third-party launchers or other solutions to get to the apps they want.