1. Welcome to the official forum for MINIX devices!
    Dismiss Notice

Android TV on the Minix U9-H

Discussion in 'NEO U9-H Custom ROMs, Kernels & Discussion' started by JJ-KwiK, Jun 22, 2017.

  1. JJ-KwiK

    JJ-KwiK Active Member

    WARNING!

    These modifications are not officially supported by Minix or Google. If something bad happens to your box while installing this mod, you are the sole person responsible. Be aware that you will probably lose your warranty!


    [​IMG]

    With that being said, I've been using this Android TV modification on my two U9-Hs without any problems. It's also very easy to return to stock by restoring your nandroid backup.


    New automatic method - Install via TWRP (easy method)
    Show Spoiler

    Important: You will lose everything. It will boot up to a fresh / unused copy of Android TV and the leanback launcher.

    Steps:
    Creating a backup (just to be safe):

    • Download the TWRP recovery image and place it on the root of your SD card or USB stick. Here - https://yadi.sk/d/ixouPLCq3GtLU3
    • Power Off the U9-H and insert your SD Card or USB stick into the U9-H
    • Using a thin piece of wire or something similar (I use an unfolded staple) press and hold the recovery button inside the small hole on the bottom of the U9-H
    • Press the power button while still holding the recovery button. Hold the Recovery button until the TWRP logo appears.
    • Allow write access in TWRP (it automatically pops up)
    • Using the remote's air mouse, select backup
    • Select storage and select your SD card or USB stick and hit ok
    • Make sure boot, system and data are checked
    • Slide the, "Swipe to Backup", slider (should take about 3 minutes to complete)
    • Power down the U9-H

    Installing Android TV:

    • Download my latest Android TV release (found below)
    • Insert your SD card or USB stick into your PC
    • Using Winrar or 7zip, extract the FW00X-ATV_Mod-2017-XX-XX.rar file to the TWRP backup folder on your SD card or USB stick. The path should look similar to this - TWRP\BACKUPS\q201\FW00X-ATV_Mod-2017-XX-XX.
    • Place the USB or SD into your U9-H and boot to TWRP
      • Using a thin piece of wire or something similar (I use an unfolded staple) press and hold the recovery button inside the small hole on the bottom of the U9-H
      • Press the power button while still holding the recovery button. Hold the Recovery button until the TWRP logo appears.
    • Using the remote's air mouse, select restore
    • Select storage and select your SD card or USB stick and hit ok
    • Select the latest Android TV release (FW00X-ATV_Mod-2017-XX-XX)
    • Make sure boot, system and data are checked
    • Slide the, "Swipe to Restore", slider (should take about 90 seconds to complete)
    • Restart and enjoy your new Android TV

    Downloads:
    v. 1.4 - 2017/10/31 (based on FW007A)
    https://mega.nz/#!ofBlUDRS!fMDPb47hg678rhL5CcZzIhWcN4DmCj5y7s7hmsu09t0
    **Before updating, disconnect from the internet, then clear cache/data for Play Services and Play Store**

    Old:
    v. 1.3 - 2017/08/23 (based on FW006)
    https://mega.nz/#!YKRx2RTL!OIoHkcEls8pr9qcVDGcAr5c4Oj43HCOeR36RE770l2s

    v. 1.2 - 2017/07/25 (based on FW005)
    https://mega.nz/#!ISQVkTzC!5NSIksuzwlrXQRPeNoRDgatNuZkTQcX0q3WVzh7rq3I

    v. 1.1 - 2017/07/14 (based on FW005)
    https://mega.nz/#!sDx1Qa6D!a2fmoI3kEsDYtklDGq13IpGpAvSys6oTH4B4s99Ja2o

    v. 1.0 - 2017/07/09 (based on FW005)
    https://mega.nz/#!cf5iGCaA!tPZWYVS-pVfnKvgyOyVtKvNXSteNJYjNeDMyvRvhwNg

    Code:
    Changelog:
    v. 1.4 - 2017/10/31 (based on FW007A):
    - Upgraded base FW to 007A (supports the same changelog as the official FW007A from Minix)
    - Added an app drawer to the Leanback Launcher
    - Added a power menu to the Leanback launcher
    - Netflix support is getting better. Download the ATV version from the Aptoide app store. Manually select standard audio. 5.1 will not work. A 5.1 audio fix is coming soon.
    
    v. 1.3 - 2017/08/23 (based on FW006):
    - Upgraded base FW to 006 (supports the same changelog as the official FW006 from Minix)
    - Fixed the Google App / Search (was a separate patch previously)
    |--> Gives the ability to access "Search" and "Speech" via Android settings
    |--> Gives the ability to decide which apps are searchable
    |--> Gives the ability to change the temperature unit
    |--> Gives the ability to turn off safe search
    |--> Gives the ability to block offensive words
    - Removed additional files that are not needed for ATV (slightly smaller build)
    - Fixed a music recommendation bug at boot
    - Added a build.prop edit to optimize Youtube for 4K
    
    v. 1.2 - 2017/07/25 (based on FW005):
    - A 320dpi has been set system wide
    - Live Channels and other apps that require a 320dpi have be fixed (settings, keyboard, Live TV etc...)
    - Included Alternative app store - Aptoid TV
    - Modified build.prop to spoof the Xiaomi Mi Box (was using Shield as a reference in the previous versions)
    - Fixed issue with Play Store. It was incorrectly downloading / upgrading ~10% of apps to their respective mobile versions
    - Uses the official leanback launcher now (grey screen bug will be fixed by Google via a Play Store update)
    
    v. 1.1 - 2017/07/14 (based on FW005):
    - Fixed a bug in the bottom system bar that causes the systemui to crash occasionally
    - Finally fixed the DPI issue. The launcher now scales to a 320dpi. The previous build only scaled to a 240dpi
    - Fixed the keylayout files for the A2, A2 Lite and A3 (some apps were not registering an enter keypress)
    - Now that the keylayouts are fixed, switched to the official Android TV keyboard (keyboard recommendations now work)
    - I fixed a bug that forced some apps to launch in portrait mode despite emulating an official Android TV
    - Added back the AirPinPro apk
    
    v. 1.0 - 2017/07/09 (based on FW005):
    - Initial release
    



    Old manual method - Keep settings / app data (hard, only for advanced users, method)
    Show Spoiler

    Prerequisites:

    Part 1: Required Files (download and extract to your USB stick)
    - Android TV Launcher (Leanback Launcher)
    - Google Play Services (Leanback – Android TV)
    - Google Play Store (Leanback – Android TV)
    - tv_core_hardware.xml
    - tv_features.xml
    - Live TV Folders
    - Katniss (Google App)
    - Modified TV remote .kl files (A3, A2 Lite and A2)
    - Leanback Keyboard
    Download - https://mega.nz/#!ALIXGZbL!0GR_saSCbyvtxsH49CNIYBwZvNHEIt2Z39X9ZYShun0

    Part 2: Modifying the build.prop
    In this step, we will be modifying the build.prop in order to trick Google into believing your Minix U9-H is an official / certified Android TV device.

    • Insert the USB stick into the Minix U9-H
    • Using ES File Explorer, navigate to Device/system
    • Copy the build.prop to your USB stick
    • Insert the USB stick into your PC
    • Rename the build.prop to build.txt
    • Open with Wordpad
    • Use Ctrl+F to find this line “ro.product.name”
    • Replace everything after the = symbol on that line with “once” (excluding quotation marks)
      • Ex. ro.product.name=once
    • Use Ctrl+F to find this line “qemu.hw.mainkeys”
    • Replace the 0 with a 1
      • Ex. qemu.hw.mainkeys = 1
    • Use Ctrl+F to find this line “ro.sf.lcd_density”
    • Replace 240 with 320
      • Ex. ro.sf.lcd_density=320
    • Use Ctrl+F to find this line “ro.nrdp.modelgroup”
    • Replace 905 with XIAOMIM12TRIAL
      • Ex. ro.nrdp.modelgroup=XIAOMIM12TRIAL
    • Navigate to the bottom of the build.prop and add the following 2 lines:
      • # 4K for youtube
      • sys.display-size=3840x2160
    • Save, close and rename the file back to build.prop
    • Insert the USB stick back into the Minix U9-H
    • Using ES File Explorer, navigate to Device/system
    • Rename the existing build.prop that is found in Device/system to build.bak
    • Copy your modified build.prop to the same folder
    • Long select the new build.prop, select more, select properties and modify the permissions (https://puu.sh/wqG7g/ea4fd96e2f.jpg)

    Part 3: Installing the proper xml files and kl files
    • Using ES Files Explorer, copy the “tv_core_hardware.xml” and “tv_features.xml” files from your USB stick
    • Paste the 2 files in the Device/system/etc/permissions/ directory
    • Apply the proper permissions to each file separately (one at a time). (Long select the file, select more, select properties and modify the permissions (https://puu.sh/wqG7g/ea4fd96e2f.jpg))
    • Rename handheld_core_hardware.xml to handheld_core_hardware.bak
    • Return to your USB stick and copy the .kl file for the remote you own / use
    • Navigate to Device/system/usr/keylayout
    • A3:
      • Rename the current Vendor_0c40_Product_7a1c.kl file to Vendor_0c40_Product_7a1c.bak
      • Paste the new Vendor_0c40_Product_7a1c.kl file (Long select the new kl file, select more, select properties and modify the permissions (https://puu.sh/wqG7g/ea4fd96e2f.jpg)
    • A2 Lite:
      • Rename the current Vendor_400c_Product_107a.kl file to Vendor_400c_Product_107a.bak
      • Paste the new Vendor_400c_Product_107a.kl file (Long select the new kl file, select more, select properties and modify the permissions (https://puu.sh/wqG7g/ea4fd96e2f.jpg)
    • A2:
      • Rename the current Vendor_0c40_Product_7a18.kl file to Vendor_0c40_Product_7a18.bak
      • Paste the new Vendor_0c40_Product_7a18.kl file (Long select the new kl file, select more, select properties and modify the permissions (https://puu.sh/wqG7g/ea4fd96e2f.jpg)

    Part 4: Installing Leanback Play Services and Launcher
    • Disconnect the Minix U9-H from the internet
    • From the main launcher, open settings and navigate to apps / system apps
    • Uninstall Updates for the Google Play Services and Google Play Store
    • Disable the Play Store
    • Return home and open ES File Explorer
    • Navigate to your USB stick and install the PlayServicesLeanback2.apk, and the LeanbackKeyboard.apk
    • Navigate to system/priv-app/Phonesky/ and change the apk extension to .bak
    • Return to system/priv-app/ and create a folder called PlayStoreLeanback
    • Copy the PlayStoreLeanback.apk from your USB and paste it into the PlayStoreLeanback folder in system/priv-app/
    • Copy the LeanbackLauncher, Katniss, TV and TVProvider folders from USB
    • Paste all 4 folders to the Device/system/priv-app/ directory
    • From the launcher, navigate to settings/keyboard and change the default keyboard to the leanback keyboard.
    • Restart the Minix U9-H (Should boot-up to the Leanback Launcher)
    • From the main launcher, open settings and navigate to apps/system apps and enable the Google Play Store
    Part 5: Preventing OTAs and app conflicts
    • Using ES File explorer, navigate to Device/system/app/
    • Open the FotaUpdate folder and rename the FotaUpdate.apk to FotaUpdate.bak
    • Open the OTAUpgrade folder and rename the OTAUpgrade.apk to OTAUpgrade.bak
    • Return home and navigate to settings/apps/system apps
    • Locate the Google app
    • Clear data / cache and disable
    • Restart the Minix U9-H

    Part 6: Installing required apps
    - Once rebooted, connect the device to the internet and log into your Google account
    - Install the following apps from the Play Store
    • --- Navigate to Settings/Display/Daydream to enable
    Part 7: Success!
    Everything should be working now. Your device should now function just like an official certified Android TV device.



    Tips:
    - If you do not want to use the sideload launcher to access sideloaded apps that do not display in the launcher, use this tool - http://atvlauncher.trekgonewild.de/
    - To filter which apps are allowed to provide you recommendations, navigate to Settings/Home Screen/Recommendations Row
    - Apps can be set in two orders, custom and recency. Navigate to Settings/Home Screen/Apps & Games Row



    To Do:
    - Add ATVRemoteService


    Known Issues:
    - Chromecast (Does not work and will never work)
    - The Android TV version of Netflix does work, but can't be installed from the Play Store (Check this thread for instructions - HERE)

    - Native VPN is broken. (3rd party VPN apps like OpenVPN or PIA work)
    - A launcher bug causes a grey screen when placing apps in a custom order. A restart is required after the order is set/saved (this is a bug in Google's Leanback Launcher. It will be fixed via an automatic Play Store update)



    Revert Back:
    To revert back to the default Minix settings / UI, simply restore your TWRP backup.


    Thanks:
    I would like to thank Alienpearl, ricardopvz and applisto for guidance.


    Enjoy your non-certified Android TV!
     
    Last edited: Jan 14, 2018
    ceusito, WilliF, Cizzz and 7 others like this.
  2. skynet

    skynet Moderator Moderator

    Thanks for this great tuto (y)
    A lot of work. Do you know if Netflix may work in HD ?
     
  3. JJ-KwiK

    JJ-KwiK Active Member

    I don't have a Netflix account to test, but the modded Netflix HD apk that has been floating around should work.
     
  4. underwriter

    underwriter Member

    Nice tutorial, but there are some setbacks in doing this:

    It seems impossible to unsinstall Updates for the Google Play Services and Google Play Store
    • It keeps wanting to replace it with default. (Yes, I disconnected internet)
    • And as such, it wouldn't install the PlayServicesLeanback2.apk, the PlayStoreLeanback.apk cause it fails.
    • Can you please detail more?
     
  5. JJ-KwiK

    JJ-KwiK Active Member

    I'm not sure what you mean by, "It keeps wanting to replace it with default", so I'm going to assume that you mean it's trying to update after you uninstall the updates.

    Try the following:
    - Disconnect from the internet
    - From the main launcher, open settings and navigate to apps / system apps
    - Clear app data and cache for the Google Play Services and Google Play Store
    - Uninstall Updates for the Google Play Services and Google Play Store

    If that doesn't work, what firmware are you on?

    There is a way to manually add both, but I'm out of town until Monday (holiday in Canada). Are you OK holding off until then?
     
  6. underwriter

    underwriter Member

    Thanks for prompt response.
    I already tried clearing the app data and cache.
    I'm on the latest firmware, 005 for U9-H
    I did disconnect the internet before the uninstallation process, but it keeps asking to replace it with the default app, if I click ok, it would fail and when I click cancel, then nothing happens.
    So I guess the manual add maybe the only option at this. I can definitely wait till whenever you have time. No hurry in life.
    Thanks again.
     
  7. JJ-KwiK

    JJ-KwiK Active Member

    OK. I havent tried the new 005 firmware, so that may be the problem.

    I will post instructions on how to add both manually on Monday.

    Have a good weekend.
     
  8. underwriter

    underwriter Member

    No problems. Enjoy your weekend too!
     
  9. underwriter

    underwriter Member

    Just an update:
    I just did a full firmware restore to 004 and repeated the process so I can take pictures and show you what I meant. Out of curiosity, I installed Titanium Backup and uninstalled both Services and Store, then installed the provided apks, but it fails saying Google Play Store has stopped working. Similar result on both firmware 004 and 005. I rooted before the process.
     

    Attached Files:

  10. JJ-KwiK

    JJ-KwiK Active Member

    On 004, are you able to uninstall the updates and replace with the factory version? If you are, the apks I provided should install above the factory versions.
     
  11. underwriter

    underwriter Member

    You're supposed to be on holiday. It was meant as an update so you'll see it on Monday.
    It just acts like it did, then nothing. Then I tried installing the versions you provided. It failed to install. Hence I decided to use Titanium Backup.
     
  12. JJ-KwiK

    JJ-KwiK Active Member

    I find it so odd that you are not able to uninstall the 2 app updates to replace the apps with the factory versions...

    While refining the process, I originally tested the tutorial on a cheap T3 box. On that box, I had to manually install the two apps as well, but not because I was unable to uninstall the app updates. The Leanback versions of each app wouldn't install over the base apk.

    I would try the following prior to manually installing the two apps.
    - Restore your backup then perform a factory reset.
    - Do not connect to the internet and do not log into your Google account.
    - Root.
    - Install ESFileExplorer from USB.
    - Navigate to the Play Store and Play Services apps via Settings / Apps and clear data / cache and uninstall the app updates.

    - Navigate to System / priv-app / Phonesky (Play Store) with ESFileExplorer and select the apk. Make note of the version # and the Installed #.
    - Do the same for the Play Services (System / prive-app / PrebuiltGmsCore).

    If the version and installed are the same, I would try starting the tutorial from scratch without connecting to the internet. If you are still unable to uninstall the app updates, we can try the manual way.
     
  13. underwriter

    underwriter Member

    I'm honestly stomped myself.
    I followed the instruction again to the core, but without connecting to the internet after restore.
    Still same result. As you can see on attached photos, version and installed # are all different in both apps.
    So sorry to keep distracting you from your holiday.
    Perhaps, you could describe the manual install method?
    Does this perhaps have to do with a special protection in place on newer Android OS (6.01)?
     

    Attached Files:

  14. JJ-KwiK

    JJ-KwiK Active Member

    OK, so I reverted to stock and upgraded to 005. I also performed a factory reset, just to start fresh. I ran into a similar problem as you because the base apk for the PlayStore is a higher version number than the leanback version I provided.

    Here are the steps I have taken to get the Play Services and the Play Store installed:
    - Do not connect to the internet or login to a Google account
    - From the main launcher, open settings and navigate to apps / system apps
    - Clear the app data / cache for the Google Play Services and Google Play Store
    - Disable the Google Play Services and Google Play Store apps
    - Using ES File Explorer, navigate to system/priv-app/Phonesky/ and change the apk extension to .bak
    - Using ES File Explorer, navigate to system/priv-app/PrebuildGmsCore/ and change the apk extension to .bak
    - Restart your box
    - Using ES File Explorer, navigate to system/priv-app and create 2 folders
    1- PlayStoreLeanback
    2- PrebuiltGmsCorePano
    - Apply the following permissions to each folder - https://puu.sh/wqH71/a59246e2ce.jpg
    - Copy the PlayStoreLeanback.apk from the download and paste it into the PlayStoreLeanback folder.
    - Copy the PlayServicesLeanback2.apk from the download and paste it into the PrebuiltGmsCorePano folder.
    - Rename the PlayServicesLeanback2.apk to PrebuiltGmsCorePano.apk
    - Apply the following permission to each apk - https://puu.sh/wqG7g/ea4fd96e2f.jpg
    - Copy the lib folder from inside the PrebuildGmsCore folder and paste it inside the PrebuiltGmsCorePano folder.
    - Restart your box
    - Open settings/apps/system apps, locate and enable the Google Play Services and Google Play Store apps (which should be the correct versions now).

    Proceed with the rest of the tutorial.
     
    Last edited: Jul 4, 2017
  15. underwriter

    underwriter Member

    I really appreciate the time you took to look into this. I'll follow the direction sometime tomorrow and give you feedback.
     
  16. JJ-KwiK

    JJ-KwiK Active Member

    Did you have any luck?
     
  17. underwriter

    underwriter Member

    I finally found time to do it this morning.
    Play Store now shows me all apps for Android Tv so I installed a few of them.
    Noted issues:
    1) Leanback launcher not working. It fails even on restart and throws error when I select it. (I'll take photo tonight and post)
    2) Google Play & Movies not working. See attached photo.
    3) Live channels launches, displays that it needs permission and then crashes. (I'll take photo later tonight and post as well)
    4) Comedy Central app gives error

    Once again, thanks for the time you put into this. It's well appreciated.
     

    Attached Files:

  18. JJ-KwiK

    JJ-KwiK Active Member

    I'm happy to hear that it's somewhat working. I have this mod working on two Minix boxes without issue.

    1- Did you apply the proper permissions to the folder and to the apk inside?

    3- Did you apply the proper permissions to each folder and each apk.

    Problems 1 and 3 are both part of the tail end of step 4. I'm willing to bet that you didn't set the permissions properly somewhere. Also, as an FYI - The live TV app will only work once you install an app that uses it. Try downloading pluto.tv, run it once, then open the live TV app.

    2- I forgot to add a WIP for Google Play Movies and TV. At the moment, that's the only app that still launches in its mobile form. Force stop the app, clear data/cache and restart the box. It might be giving you an error because of your leanback launcher issue.

    4- I'm not home at the moment, but I'll give the app a try. What's the error?

    Other than the Google play movies and TV mobile issue, which I will fix soon, those problems aren't present on my 2 boxes. I'm fairly positive you're getting an error because of apk and folder permissions though.
     
    Last edited: Jul 6, 2017
  19. underwriter

    underwriter Member

    I'll completely restore the device on Saturday and start all over. I did it in the morning so there's the possibility that I might have overlooked something. I'll give you feedback then.
     
  20. underwriter

    underwriter Member

    I tried this again last night and this morning with results different from expected. Trust me, I followed all the steps to the book, and both times with errors so if you've done this more than once without errors, then there's definitely something else. I suspect the build.prop. I'll come back to that in a minute.
    After following all steps, restarted device:
    1) Leanback Launcher not working. It booted straight to Minix launcher.(Both last night and this morning after freshly flashing and restore each time)
    2) I installed Vevo Hd from PlayStore. If I start the app from minix launcher or all app list, it starts the mobile version, but if launched from PlayStore, it starts tv version though I installed only one version from leanback PlayStore. See video link: https://www.dropbox.com/s/ognevgesdh0dw8t/IMG_2879.mp4?dl=0
    3) It was throwing random installer error. See attached photo
    4) As leanback launcher wasn't working, after all process, I installed a version from PlayStore, but no joy. See attached photo

    Question now is: when you modify the build.prop, does it correspond with what I have? See attached photo. I have also uploaded my modified build.prop so if you could look at it? https://www.dropbox.com/s/1onv30gltrqyb90/build.prop?dl=0

    I'm definitely about to give up. Gotta say you have an amazing patience!
     

    Attached Files: