2020-02-06, 17:45
Since the Android Leanback launcher is both slow and ugly I decided to use Kodi 18.5 as the launcher on my 2015 Sony Bravia AndroidTV running Android 7, I thought I'd share my experiences:
SET UP BUILD ENVIRONMENT
Set up build environment as per https://github.com/xbmc/xbmc/blob/Leia/d...Android.md - i did it in a Ubuntu 16.04 VMWare environment. There were some issues with java and the key store (I can't remember exactly what) but use a completely fresh Ubuntu install and you should be good. The README specifies NDK 18 which can't be found, use 18b and then rename $HOME/android-tools/android-ndk-r18b to $HOME/android-tools/android-ndk-r18.
MODIFY ANDROIDMANIFEST.XML.IN TO MAKE KODI DETECTED AS A LAUNCHER
Modify tools/android/packaging/xbmc/AndroidManifest.xml.in to make Kodi a launcher (I know there are bridge apps such as https://play.google.com/store/apps/detai...mclauncher but we are going to modify and build Kodi anyway) so that:
MODIFY XBMCAPP.CPP TO CATCH HOME BUTTON INTENT
To react to "Home button press" add handling for android.intent.action.MAIN/android.intent.category.HOME in void CXBMCApp::onNewIntent(CJNIIntent intent) (found on line 1076 in xbmc/platform/android/activity/XBMCApp.cpp):
BUILD KODI
As per https://github.com/xbmc/xbmc/blob/Leia/d...Android.md
MODIFY SKIN TO REACH ANDROID SETTINGS
Add a button to access Android settings, there is no package for the settings (at least not on Android 7) but StartAndroidActivity accepts an empty string as package name so the following will launch the Android settings from a skin: StartAndroidActivity("", "android.settings.SETTINGS") - from settings you can reach everything in Android. I run a modified version of Pellucid by Chris Bevan with background images added to the various Nav screens.
DEPENDING ON SYSTEM SET UP DISABLE TV AND KODI VOLUME CONTROL
If, as I do, you have a sound system which you can program to take the IR signals from your TV remote you may want to unmap the Android and Kodi volume control and only control the volume on the sound system:
Uninstall the Leanback launcher through adb shell pm uninstall -k --user 0 com.google.android.leanbacklauncher once this is done the select launcher dialog will be displayed when the launcher should be visible, select always
The above setup is much snappier (and a lot better looking) than Leanback for me, so overall great success..
And that's it so far..
S
SET UP BUILD ENVIRONMENT
Set up build environment as per https://github.com/xbmc/xbmc/blob/Leia/d...Android.md - i did it in a Ubuntu 16.04 VMWare environment. There were some issues with java and the key store (I can't remember exactly what) but use a completely fresh Ubuntu install and you should be good. The README specifies NDK 18 which can't be found, use 18b and then rename $HOME/android-tools/android-ndk-r18b to $HOME/android-tools/android-ndk-r18.
MODIFY ANDROIDMANIFEST.XML.IN TO MAKE KODI DETECTED AS A LAUNCHER
Modify tools/android/packaging/xbmc/AndroidManifest.xml.in to make Kodi a launcher (I know there are bridge apps such as https://play.google.com/store/apps/detai...mclauncher but we are going to modify and build Kodi anyway) so that:
- Launcher intent filter is added to Main activity:
Quote: <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
- Splash and Main activities have android:launchMode="singleTop"
- Splash and Main activities have android:documentLaunchMode="never"
- Splash and Main activities have android:excludeFromRecents="true"
MODIFY XBMCAPP.CPP TO CATCH HOME BUTTON INTENT
To react to "Home button press" add handling for android.intent.action.MAIN/android.intent.category.HOME in void CXBMCApp::onNewIntent(CJNIIntent intent) (found on line 1076 in xbmc/platform/android/activity/XBMCApp.cpp):
Quote: if(action == "android.intent.action.MAIN" && intent.hasCategory("android.intent.category.HOME"))The above will send Kodi to Home.xml when the Home button is pressed (the key press doesn't generate a key press event, it only generates a MAIN/HOME intent). One could look at clearing the "Kodi window stack" as well (so that back button press after pressing home goes nowhere).
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTIVATE_WINDOW, WINDOW_HOME, 0, nullptr); // Sets Home window as active
} else // below is original code
if (!targetFile.empty() && (action == "android.intent.action.VIEW" || action == "android.intent.action.GET_CONTENT"))
{
CLog::Log(LOGDEBUG, "-- targetFile: %s", targetFile.c_str());
...
BUILD KODI
As per https://github.com/xbmc/xbmc/blob/Leia/d...Android.md
MODIFY SKIN TO REACH ANDROID SETTINGS
Add a button to access Android settings, there is no package for the settings (at least not on Android 7) but StartAndroidActivity accepts an empty string as package name so the following will launch the Android settings from a skin: StartAndroidActivity("", "android.settings.SETTINGS") - from settings you can reach everything in Android. I run a modified version of Pellucid by Chris Bevan with background images added to the various Nav screens.
DEPENDING ON SYSTEM SET UP DISABLE TV AND KODI VOLUME CONTROL
If, as I do, you have a sound system which you can program to take the IR signals from your TV remote you may want to unmap the Android and Kodi volume control and only control the volume on the sound system:
- Modify the Kodi keymap (either manually in android/data/org.xbmc.kodi/files/.kodi/userdata/keyboard.xml or through Add-on:Keymap Editor) removing mappings of VolumeUp, VolumeDown and Mute
- Use https://play.google.com/store/apps/detai...tton&hl=en or similar to unmap vol up, down and mute from Android
Uninstall the Leanback launcher through adb shell pm uninstall -k --user 0 com.google.android.leanbacklauncher once this is done the select launcher dialog will be displayed when the launcher should be visible, select always
The above setup is much snappier (and a lot better looking) than Leanback for me, so overall great success..
And that's it so far..
S