[TOTAL MOD] Playing With Fire (v4) NEW "LazyLeanback" Installer - AndroidTV on FireTV

Search This thread
Last edited:


Senior Member
Oct 30, 2016
Will this method work with Firetv Stick 4K? My Firestick 4K is already rooted, so do i still need to sign in with my Amazon account during this process?

Top Liked Posts

  • There are no posts matching your filters.
  • 50
    [TOTAL MOD] Playing With Fire (v4) NEW "LazyLeanback" Installer - AndroidTV on FireTV

    This is not another "How-To install GApps on FireTV Thread"
    Instead these heavy system modifications will finally allow you to completely control almost every aspect of the FireTV, including:

    • OpenGApps TV-Stock with almost all the main Android TV components working (Live Channels + USB Tuner, Leanback Launcher + Keyboard, Etc)
    • Button / Keycode Remapping + Change Default Launcher, Switch Keyboard IME, Access SuperSU Settings
    • Running Application View + Task Switcher, Foreground/Background Task Killers, Customizable On-Screen Shortcuts to Anything on the System
    • Access BOTH the Stock Amazon Settings Menu AND the Google Android TV Settings Menu at the Same Time (No signature spoofing either!)
    • Run and Install Apps from either the Google Play (Leanback-AndroidTV) Store OR the Official Amazon App Store
    • Automatic Updates to Google Play Services / Play Store / Play installed apps without issues thanks to minor build.prop tweaks
    • and finally Disabling / Using Amazon's own Blacklist against the various components of the Stock FireTV system that you want disabled.
    • Compatibility: Tested on AFTV-v1 running RBox v5.2.4.1 (r1 & r2) but as long as you have root you should be good to go
    • Confirmed working: on FireTV-v1 & FireStick-v1 & FireTV-v2, expected to work on FireStick-v2 once there is root.

    UPDATE: v4 "LazyLeanback" -
    I am now including two almost totally automated installer scripts for the newest v4 release of Playing with Fire. This NOT ONLY includes two bash scripts that automatically do almost everything for you with getting this installed, but also now includes a working "Updater script" that will stay with the ROM in the /system/addon.d/ folder, and allows you to flash the latest rbox releases over your current software without interfering with this MOD, SuperSU or Xposed Framework which will now all automatically get backed up and then put back into place properly once the new ROM is done installing! I have successfully tested this by wiping my entire system and reinstalling, using the LazyLeanback script to install the MOD, and then flashed the latest rbox [v5.2.4.1_r2] over my previous software. Everything worked and I was up and running on r2 without needing to rerun any MOD commands

    As should be expected with such major modifications to basically every aspect of the FireTV System, this is 100% IMPOSSIBLE WITHOUT ROOT + XPOSED + BUILD.PROP MODIFICATIONS + SYSTEM PARTITION CHANGES + PATIENCE AND CAREFUL READING OF ALL INSTRUCTIONS. This Mod is not called "Playing with Fire" for no reason, your literally holding your FireTV's life in your hands, if you don't pay attention YOU WILL GET BURNED! Therefore if anyone asks stupid questions like "can I haz Leanfire TV on my Stick now plz?" you will be laughed at and ignored if not worse.

    Screenshots from Completed Mod:

    Full Gallery of Completed MOD Screenshots: https://imgur.com/a/3lucP

    Installation Instructions:

    1. Step One: Required Files - Download the following files. For some of these I will have listed two versions (ARM) and (ARM64) so make sure you pick the version that's appropriate for the architecture of your CPU. FireTV-v1 (ARM) & FireTV-v2 (ARM64). Additionally as my FireTV is running the latest release v5.4.2.1 I am using API22 binaries in this guide. Everything "should" still work if your running an older release, but you will need to get the API21 binaries if still on Lollipop 5.0. If you don't know what architecture / api level your FireTV is I suggest you do some research, as if you don't know that type of basic information, things can end up quite badly for your FireTV.

      PlayFire_v2.tar.gz - https://www.androidfilehost.com/?fid=817550096634783100
      Obsolete: Use ONLY for Manual Installation as of "v4_LazyLeanback" Contains my PlayFire-TvSettings.apk (modified from Peleg's AFTV2ATV Project) along with the other necessary "universal" files that will be pushed into your system partition.

      XposedInstaller_3.1.1.apk - https://forum.xda-developers.com/attachment.php?attachmentid=3921508&d=1477916609

      xposed-v87-sdk22-arm.zip - http://dl-xda.xposed.info/framework/sdk22/arm/xposed-v87-sdk22-arm.zip
      xposed-v87-sdk22-arm64.zip - http://dl-xda.xposed.info/framework/sdk22/arm64/xposed-v87-sdk22-arm64.zip

      HDXPosed-1.3.apk - https://forum.xda-developers.com/attachment.php?attachmentid=4198322&stc=1&d=1503094312 Created by rbox

      Busybox-(Meefik) - This is my personal preference for Busybox installers, but you can use whichever installer you like. I have also included the TWRP Flashable ZIP which was generated from within the installed APK. Either version will work just fine, so pick whichever you find easier to install.

      Busybox-(Meefik)-v1.27.1 (Updated August 8th, 2017) (APK Installer): https://github.com/meefik/busybox/releases/download/1.27.1/busybox-1.27.1-33.apk
      Busybox-(Meefik)-v1.27.1 (TWRP Flashable ZIP): https://forum.xda-developers.com/attachment.php?attachmentid=4245669&stc=1&d=1503094312

      Chainfire's SuperSU-v2.82-20170528234214 - https://download.chainfire.eu/1113/SuperSU/UPDATE-SuperSU-v2.82-20170528234214.zip

      MAKE SURE YOU USE THIS SuperSU v2.82-20170528234214 and NOT THE CCMT version. One of the recent SuperSU-CCMT releases had a bug that resulted in device crashes and loosing root access when updating the binary. Also as this SuperSU is a Chainfire release, it's signed with a different key than the "official" CCMT versions so it will not show up in Play Store updates once everything has been installed. You can still flash the latest CCMT in TWRP at a later date if you want but it's not going to update automatically if installed using the Chainfire release posted above.

      Note: As OpenGApps is built fresh every day it's possible a future update may break something. If you have issues with the current release, then go ahead and download the Old "Known Good" release posted below. You can always upgrade GApps by re-running the ZIP installer with a later build that hopefully fixes your issue.

      TV-Stock (ARM):
      Current Release (Make sure you download the MD5 along with the ZIP)

      Known Working (Old Release)

      TV-Stock (ARM64):
      Current Release (Make sure you download the MD5 along with the ZIP)

      Known Working (Old Release)

    2. Step Two: Running the "LazyLeanback" Installation Scripts - New improvements as of "v4_LazyLeanback" are the Installation Scripts themselves as well as a brand new "addon.d" Updater script which allows ROM flashing without damaging the MOD installation, even through software upgrades. Both improvements are included in the "PlayFire" archive attached to this post. I have also removed the gapps-config.txt & Xposed Edge Config from the "PlayFire" archive so I can customize it for a different needs I've seen mentioned, now one version defaults to Leanback Launcher, and the other version Defaults to the Stock Amazon Launcher, you can pick whichever you'd like.

      WARNING: While I did test all of this on my own system, and was successfully able to use the scripts to install everything from this MOD's guide AND THEN FLASH THE LATEST RBOX r2 RELEASE WITHOUT NEEDING TO RERUN ANY MOD CONFIGURATION, the LAZYLEANBACK SCRIPTS should STILL BE CONSIDERED "ALPHA-RELEASE" SOFTWARE AND SHOULD NOT (YET) BE FULLY TRUSTED OR RUN BY THOSE WHO DO NOT AT LEAST KNOW THE BASICS ON HOW TO RECOVER FROM UNEXPECTED ERRORS WHEN INSTALLING MODIFICATIONS. Also even if my scripts do work on getting everything installed quickly, they are definitely quite "ugly" (you might see some errors or other weirdness when running them) but they DO work, just ignore the minor errors that may pop up. It will be ironed out once I get a chance to get back to this.

      You have been warned and I am (still) in no way responsible for any bricks that may occur from improper use of these instructions or badly written scripts.

      A VERY very brief run through of EVERYTHING you need to install this MOD is now simply the following:
      • 1) Download the required files listed above (and now including the separate Xposed Edge Configs and gapps-config.txt files)
      • 2) Download the new "PlayFire_v4_LazyLeanback.tar.gz" archive and MOVE EVERYTHING TO THE ROOT OF YOUR SD CARD
      • 3) Rename whichever version of the gapps-config file you want to use to EXACTLY "gapps-config.txt" and place it in /sdcard/gapps-config.txt
      • 4) Connect to your device's ADB terminal and run the following commands. NOTE: You MUST Install the Busybox.apk then open the app and install the Busybox Binary BEFORE YOU RUN the LazyLeanback Scripts, or everything may APPEAR TO INSTALL OK, BUT YOU WILL BE MISSING A CRITICAL step that allows OpenGApps TV-Stock to fully install all required libraries properly.
        tar -xzvf /sdcard/PlayFire_v4_LazyLeanback.tar.gz
        sh /sdcard/PlayFire/LazyLeanback.sh
      • 6) THATS IT, YOU'VE INSTALLED ALL THE HARD PARTS OF THE MOD AT THIS POINT. You still need to reboot into TWRP to install the Updated SuperSU-v2.82 (if you hadn't already) along with Xposed v87 and finally OpenGApps itself. Once you've successfully installed OpenGApps reboot into the system and run the next FINAL command AGAIN FROM A ROOT SHELL (OR IT WILL NOT WORK)
        sh /sdcard/PlayFire/LazyNoTouch.sh
      • 7) Go into Xposed and enable Xposed Edge, Then reboot (again) and go into Xposed Edge and Enable "Keys"
      • 8) YOU ARE DONE, ENJOY!.
        After all this you can finally go ahead and log into the Google Play TV (Leanback) Store, should have button mapping configured and can start my Blacklisting procedure.

      However please note that the TV-Stock GApps package is quite large even when many of the useless packages are being ignored via my custom "gapps-config.txt" file which directs the GApps installer and tells it specifically what to install and what to ignore[/B]. For example on my FireTV-v1 after doing a total wipe of System, Data, Internal, Dalvik/Cache, then reinstalling RBox's Prerooted Rom, I only had about 140MB of free space in my /system partition. That's why I have left my gapps-config.txt file in the "Test" mode, so you can attempt to run the TV-Stock installer without it actually writing any files (yet) so you know if you will have enough space in your system partition. NOTE: As my custom gapps-config.txt comes with the TEST option set, you must modify this file with the "sed" command below (or manually edit the file by commenting out the #TEST line) for TV-Stock Installer to actually run in “real-mode” and not "test-mode".

      Now go ahead and do a test-run of the TV-Stock installer. If it finishes without throwing “Error Code: 70 = insufficient storage” your good-to-go for the real-install once you comment out the TEST option. IF you DO get Error Code: 70 run the following line in terminal to view the TV-Stock Installer Logs and Determine what you want to do to free up some space. If you don't get any errors run the Completed Without Errors line.

      Test-Run Error Code: 70
      [email protected]:/ $ cat /sdcard/open_gapps_log.txt

      Test-Run Completed Without Errors
      [email protected]:/ $ sed -i -e 's|^Test|# Test|' /sdcard/gapps-config.txt


      Device Model | AFTB
      Device Type | tv

      And at long last, with all these steps completed you should get TV-Stock to install successfully!

      Enable Button Remapping via "Keys" in Xposed Edge & Editing the Xposed Edge Custom Configuration:
      Home Button Single Press = Leanback Launcher (Home)
      Home Button Double Press = Running Apps List Overlay + Task Switcher
      Home Button Long Press = On-Screen Menu Options
      Back Button Long Press = Kill foreground app
      Menu Button Long Press = Installed Applications Drawer Overlay + App Launcher
      Voice (Search) Button Single Press = Google Search (Katniss)
      Voice (Search) Button Long Press = TV Voice Input

      These settings along with all other custom button mappings can be edited within the Xposed Edge application. Please see the excellent guide @Y314K has put together (with detailed pictures) for some tips on how to configure more advanced features of this module. You also must ENABLE the "Xposed Edge" module within Xposed AND THEN ENABLE "Keys" from within the main Xposed Edge settings menu before all these configuration options will take effect. Please see Y314K's guide listed above for specific instructions on how to enable the REQUIRED "Keys" setting within Xposed Edge so that the button remapping gets activated.

    Known Issues:

    • Leanback Launcher Auto-Start: In order for Leanback Launcher to start automatically upon boot of the system you MUST first disable the default FireTV Launcher "com.amazon.tv.launcher". You can run "pm disable com.amazon.tv.launcher" or follow the steps from post #2 in this thread about how I configure the Amazon Blacklist. Once Xposed Edge is enabled, you can still run the default Launcher (even when it's frozen) through the on-screen menu.
    • No recommendations loading: is a known issue caused by Amazon's "com.amazon.device.sale.service" package. You must disable this either through my method from the 2nd post in this thread or the "traditional" way of "pm disable com.amazon.device.sale.service". Recommendations will only load once you've installed some official "leanback" apps from the Play Store and have run them at least once (and in the case of CableTV apps like FoxNow, ABC, NBC, etc logged in with your network provider)
    • Enabling Xposed Modules without a mouse: I highly recommend Vysor it's most importantly free, and it connects to your device through ADB and mirrors your device display on your computer and therefore allows you to use the mouse on your computer to manipulate your device, and click those check boxes.
    • Chromecast Receiver: Is problematic for a few reasons, A) is at least on my FireTV-v1 there's not enough space in the /system partition to install it as a system app, so I have installed it as a user-app through the Play Store once everything else is working. Issue B) is that NO ONE (at least from the research i've been doing into this) has yet figured out how to properly spoof the proper Google Identification check that the Chromecast Receiver is doing before allowing you to Cast to a TV Box. Over at FreakTab another developer listed the problem as "Cast service can't get a Cast device cert through ClientAuthSigner" but this is something I am also going to try and look into and would very much like to get working, so definitely a work in progress even if I don't really know how feasible it is to expect this functional anytime soon.
    • Google Voice Search: Google Search on the other hand is semi-working and my custom Xposed Edge configuration already contains a button remap of the Search button to the Google Search app instead of the default Amazon Voice Interface. The text-based search part of this works flawlessly, but I seem to run into an issue when trying to actually use the Voice control part at which point the app throws an error about "Not able to connect to Google at this time". I am also working on trying to figure this out, but it's exponentially more likely to be working in the near future than the Chromecast Receiver functions.
    • Google Play Store Apps with Known Issues and/or Root Verification Checks : Currently I am aware of two apps that if installed via Google Play Store WILL NOT WORK on the FireTV, these are Netflix (which is publicly known to be blocking access on rooted devices) and the Showtime App. However as of July 5th, 2017 both these apps works without ANY issues if simply installed from the Amazon AppStore, giving users of the Playing with Fire MOD the best of both worlds. Install any app you can from Google Play (to get more frequent updates & features), but be able to revert to using Amazon AppStore apps when the Play Version does not work, or in the case of many TV:Go apps which do not currently exist in the Play Store at all, but are available on FireTV devices (Includes but is not limited to: USA Network, TruTV, Science Channel, Discovery Channel, ID Network, Animal Planet, TLC Network, among others like "Local NOW" which is actually a LiveStream of the Weather Channel if you can log in with the appropriate CableTV Network Credentials)

    Excuse me if this is a dumb question (it probably is), but I'm not too versed in the current state of the modding scene for the FTV devices. From what I've seen, TWRP for the FTV devices is available, so what's stopping you guys from creating a flashable image from a TWRP backup? (I know it's possible on regular Android)

    A combination of technical, legal and logistical problems. This mod should work on all FireTV devices (I think, confirmation on AFTV1 + Stick1, still waiting on FireTV2 + Stick2) but I only have a FireTV-v1, my TWRP image would most likely brick any other type of FireTV device.

    There are also legal / licensing issues to contend with, particularly concerning the OpenGApps packages, but also the modified copy of "PlayFire-TvSettings.apk" (which I had to ask @peleg for permission to distribute which he kindly agreed to), and also the Xposed Edge + Custom Config (which I have PM'd @jozein about but have not gotten a reply yet) among others. Even something as ubiquitous as SuperSU is not a open source package, you must get permission from Chainfire / CCMT before you may include it in a Custom ROM. The way this MOD is currently setup I am only directly distributing the minimal amount of files I need to, everything else is being obtained by the end-user through the official channels and in the way the package owners have specified.

    • June 30th, 2017 (v1): Initial post introducing this MOD and exploring the capabilities that can be added to the FireTV through the Xposed Edge Module
    • July 2nd, 2017 (v2): Updated "PlayFire_v2.tar.gz" archive with a fixed gapps-config.txt and corrected some errors that were included in the initial commands
    • July 6th, 2017 (v3): Confirm MOD is working on AFTV1, AFTV2, and FTV-Stick1. Replace original build.prop edit method with new and improved sed/grep commands, update formatting of the MOD guide and add in final details on how to install and configure everything that is required for this MOD to work successfully
    • July 8th, 2017 (v4_LazyLeanback): Updated "PlayFire_v4_LazyLeanback.tar.gz" archive has been uploaded which contains NEW Auto-Installer Shell Scripts. Also as of v4_LazyLeanback the Playing with Fire MOD also includes a addon.d Updater script which allows you to flash the latest Rbox releases over your current software WITHOUT THEN NEEDING TO RE-RUN ANY MOD COMMANDS

    @peleg for the TvSettings.apk compatible with FireTV and AFTV2ATV Project which inspired this MOD
    @rbox for the Prerooted FireTV ROMs and HDXPosed Module without which all this would be impossible
    @jozein for the excellent Xposed Edge Module which provides almost 50% of the added features missing from the Stock AmazonTV Interface
    @stangri for the contribution of the "sed" commands to edit build.prop directly through terminal

    @talltree for being the first person brave enough to try this out on any device, and for his patience in helping me discover and fix a few initial flaws that were in the guide.
    @tmtprsn and @stangri for confirming a working MOD on FireStick-v1
    @f1ux for confirming a working MOD on FireTV-v2
    @dewa710 for helping me track down the cause and resolution to the "spinning circle of doom" issue caused by TV-Stock overwriting NoTouchAuth
    Blacklist Configuration: There are many ways in which you can disable the parts of the Stock AmazonTV system you do not want to have running, but I believe my new method is far superior as it uses Amazon's own blacklist technology against itself (which I just find incredibly funny) AND by disabling the components in this manner, every single time you reboot the system, the components will automatically get re-disabled if you happened to enable some function for whatever reason.

    Amazon has the potential to use two different systems to "blacklist" certain things. These are "com.amazon.tv.nimh" (Not in my House) and the "com.amazon.tv.settings.tv.AppDisableService" which is currently being used to explictly block (and "soft-disable") the following applications: FiredTV-Launcher, FireStarter, and OnbootKodi. Both blacklisters are explained in depth over at AFTVNews (http://www.aftvnews.com/tag/blacklist/).

    If you have followed my entire guide to this point the first blacklist I mentioned "com.amazon.tv.nimh" (Not in my House) has already been totally deleted from your system partition during the OpenGApps TV-Stock installation. I explicitly call this library out in my custom gapps-config.txt file and instruct the TV-Stock installer to delete all it's files. I do this because A) no one knows exactly what this component is capable of once Amazon decides to enable it's functions, and B) It currently has zero negative effect on a running FireTV system, so I fully remove it to prevent any future issues it may cause once Amazon decides to enable it's unknown functions.

    The next blacklist included with Stock FireTV systems is the "com.amazon.tv.settings.tv.AppDisableService" which quite simply is a text database listing certain packages Amazon has decided it does not like, and these packages are forcibly "frozen" (aka "soft-disabled") upon boot of the system. Over at AFTVNews they already have great instructions on how to totally disable this functionality and re-enable the blocked apps, but I am going to show you how to use Amazon's AppDisableService to disable Amazon system components instead of the Apps Amazon does not like. This way instead of totally stopping AppDisableService, we remove the Amazon specified apps, and add in Amazon System components that will then automatically be frozen upon boot of the system.

    To do this you need to launch the Amazon Settings On-Screen Menu I have included in my Xposed Edge configuration. To access this 1) Hold the Home Button until the On-Screen Menu Appears, 2) Navigate one space to the right, and then one space down in the On-Screen Grid, this will be a box with a bunch of Amazon System apps in it. Once you select the AmazonApps square, navigate to the bottom right most square, and this will launch the Internal Amazon Settings Debug Menu. 3) You want the select the option that is a orange square with the "Amazon Fire" text in white.


    Once you have selected the appropriate "Amazon Fire" Settings app from within my preconfigured On-Screen Menu, you will be presented with a Black Screen with a list of options. Scroll down to "com.amazon.tv.settings" and select this option. On the next black screen you will see a two columns, one labeled "Key" and another labeled "value". The only "Key" is DisableApps, while the value is the package names of FiredTV-Launcher, Firestarter, and OnbootKodi. Move your selector to the "Edit" button and go ahead and remove all three packages Amazon has included, and then add in whatever parts of the Amazon System you want disabled (i.e. anything you previously used pm disable on)

    I strongly suggest you use this Auto-PackageDisable feature to "soft-disable" the default AmazonFireTV Launcher "KFTV" so that the system will automatically boot into the Leanback Launcher. You can also disable any other Amazon System package, in my following example I also disable the blacklist technologies, KFTV Launcher, and Vizzini (Amazon's Voice Interface so that the Google Voice Interface can take over). My own "blacklist" includes the following, but you do not need to include everything I do, and can add additional packages I do not. My blacklist kills the Amazon OTA service, Amazon "Sale Service" which blocks the Leanback Launcher recommendations, and Amazon Voice Search among others.

    My personal blacklist includes:



    Manual Installation Instructions: If you want to fully understand what this MOD is actually doing to your system the manual instructions give a much clearer picture of what is being modified and why to achieve a successful Leanback install on the FireTV. These instructions are obsolete as of v4_LazyLeanback but are being retained in the thread as extra information for any other hackers who may want to take this further

    Manual Installation - (Part One): Modifying Build.Prop

    NOTE: The beginning of the commands is actually an important indicator of "where" your supposed to be inputting the commands.

    ~$ = the shell or command prompt on YOUR computer. With FireTV Utility you may need to type "exit" to get back to a "computer shell"
    shell@firetv:/ $ = the shell on the FireTV device. The "firetv" part will change depending on your device name
    root@firetv:/ # = Notice how the last part in red changed from $ --> # this is the difference between a normal user shell and a "root shell"

    EDIT: @stangri has provided some terminal commands that expertly accomplish the necessary build.prop modifications without needing to follow my old instructions to pull the file off the device, edit it and then push it back to the filesystem. Thanks to this contribution we can now edit build.prop with the following commands, BUT YOU MUST HAVE BUSYBOX INSTALLED FOR THESE COMMANDS TO WORK. First off make sure your device is powered on and connected to your network and has ADB debugging enabled.

    EDIT: This is the OLD BUILD.PROP METHOD. You can use this but it will be much easier to use the "sed" commands above.

    There are a few different ways this step can be done so do whatever is easier for you. As my FireTV-v1 has a built-in Ethernet port + USB port I find it convenient to connect via ethernet, use the USB keyboard to enter recovery and then ADB into recovery and edit the build prop with the command-line text editor "vi". However only the FireTV-v1 makes doing it that way easy, and anyone who knows how to use vi can probably figure this part out on their own without any further instructions.

    For the rest of you on FireTV-v2 or FireTV-Sticks here's probably the easiest way for you to complete this step. First make sure your device is powered on and connected to your wifi network with ADB Debugging enabled.

    ~$ adb connect "YOUR IP" 
    ~$ adb shell
    [email protected]:/ $ exit

    ~$ adb connect "YOUR IP" 
    ~$ adb pull /system/build.prop ~/

    If you get to a terminal prompt great, now type "exit". Now type "adb pull /system/build.prop/ ~/" this command should grab a copy of your build.prop and place it in your user's home directory. Now you need to edit the file using a good text editor (NOT Microsoft Word / WordPad / Any other "fancy" program that will add additional formatting, and wind up destroying the file). If on Windows I recommend NotePad++, if on any other operating system, you should be fine with the default text editor.

    NOTE: The first two lines are towards the top of of your build.prop file, while the last two lines should be the VERY BOTTOM. Also the first two lines already exist in the file and need to be modified, while the last two lines DO NOT already exist in your build.prop, you need to add them as the very last two lines.

    ro.build.version.number=573210520 --> ro.build.version.number=987654321
    ro.build.characteristics=default --> ro.build.characteristics=tv
    ^ TOP
    BOTTOM ٧

    Once you have completed the required build.prop modifications, we need to push the edited file back into the FireTV's filesystem

    ~$ adb connect "YOUR IP" 
    ~$ adb push ~/build.prop /sdcard/build.prop
    [email protected]:/ $ su
    [email protected]:/ # cp /sdcard/build.prop /system/build.prop && chmod 644 /system/build.prop && chown root:root /system/build.prop

    Unfortunately each device's build.prop contains completely different information, and this can even change within the same device between different software versions, so I cannot post an example for this one, as it would be useless and dangerous if someone tried to use it on the wrong device / software version. But this modification is necessary, the "top" edits give the TV-Stock installer the correct information to know this is a TV Device (otherwise it will detect the FireTV as a "Phone" and skip installing some necessary libraries, while the bottom two lines allow the device to register correctly with the Play Store and prevents the issue a lot of us were having with updates to Google Play breaking things.

    ~$ adb connect "YOUR IP" 
    ~$ adb shell
    [email protected]:/ $ exit

    If you get to the "FireTV" terminal prompt great, now type "exit" and proceed to the next set of commands. If you dont get to the "FireTV" terminal you need to double check you have ADB debugging enabled and your device is in fact connected to the appropriate network.

    ~$ adb shell
    [email protected]:/ $ cp /system/build.prop /sdcard/default.prop
    [email protected]:/ $ su
    [email protected]:/ # mount -o rw,remount /system
    [email protected]:/ # sed -i 's|ro.build.version.number=.*|ro.build.version.number=987654321|' /system/build.prop
    [email protected]:/ # sed -i 's|ro.build.characteristics=.*|ro.build.characteristics=tv|' /system/build.prop
    [email protected]:/ # ! grep -q "ro.com.google.clientidbase=android-xiaomi-tv" /system/build.prop && echo "ro.com.google.clientidbase=android-xiaomi-tv" >> /system/build.prop
    [email protected]:/ # ! grep -q "ro.com.google.gmsversion=5.1_r1_TV" /system/build.prop && echo "ro.com.google.gmsversion=5.1_r1_TV" >> /system/build.prop

    Manual Installation - (Part Two): Putting it all together - You should now have XposedInstaller.apk, XposedFramework.zip, HDXPosed-1.3.apk, SuperSU.zip, PlayFire.tar.gz, Busybox.apk or Busybox.zip TV-Stock.zip and TV-Stock.zip.md5 and a modified build.prop ready to go. Next you need to move all these files onto your device, and I am going to use the root of /sdcard/ and the /sdcard/PlayFire/ directory as defaults. You can use something else, but you will need to modify the following commands.

    Get your device up and running and load all the files you have downloaded into the root of your /sdcard/ partition. Once everything is on the root of your /sdcard/ run the following commands, and note that everything on a single line should be copy/pasted as one command.

    If running these commands from TWRP recovery, everything will already work as TWRP comes with busybox. If running this connected to adb on a running FireTV system you must install busybox prior to running these commands. Install the ZIP through TWRP then boot into the system or use the APK to install busybox into your /system partition.

    ~$ adb connect "YOUR IP" 
    ~$ adb shell
    [email protected]:/ $ pm install /sdcard/XposedInstaller_3.1.1.apk
    [email protected]:/ $ pm install /sdcard/HDXPosed-1.3.apk
    [email protected]:/ $ tar -xzvf /sdcard/PlayFire_v2.tar.gz
    [email protected]:/ $ su
    [email protected]:/ # mount -o rw,remount /system
    [email protected]:/ # cp /sdcard/PlayFire/tv_core_hardware.xml /system/etc/permissions/tv_core_hardware.xml && chmod 644 
    /system/etc/permissions/tv_core_hardware.xml && chown root:root /system/etc/permissions/tv_core_hardware.xml
    [email protected]:/ # cp /sdcard/PlayFire/whitelist.json /system/etc/whitelist.json && chmod 644 /system/etc/whitelist.json && chown root:root /system/etc/whitelist.json
    [email protected]:/ # tar -xzvpf /sdcard/PlayFire/XposedEdge-DataConfig.tar.gz -C / && (chown -R system:system /data/app/com.jozein.xedge-1 && chown -R root:root /data/data/com.jozein.xedge)
    [email protected]:/ # mkdir /system/priv-app/TvSettings && chmod 755 /system/priv-app/TvSettings && cp /sdcard/PlayFire/PlayFire-TvSettings.apk /system/priv-app/TvSettings/TvSettings.apk && chmod 644 /system/priv-app/TvSettings/TvSettings.apk && chown root:root /system/priv-app/TvSettings/TvSettings.apk
    [email protected]:/ # mkdir /system/app/NoTouchAuthDelegate && chmod 755 /system/app/NoTouchAuthDelegate && cp /sdcard/PlayFire/TV-NoTouchGsf.apk /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chmod 644 /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chown root:root /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
    [email protected]:/ # mv /sdcard/PlayFire/gapps-config.txt /sdcard/gapps-config.txt

    The next command is OPTIONAL, but it disables the Wifi-Direct broadcast "Fire-DIRECT-####" which I found useless and very annoying

    [email protected]:/ # cp /sdcard/PlayFire/android.hardware.wifi.direct.xml /system/etc/permissions/android.hardware.wifi.direct.xml && chmod 644 /system/etc/permissions/android.hardware.wifi.direct.xml && chown root:root /system/etc/permissions/android.hardware.wifi.direct.xml

    Manual Installation - (Step Three): The Final Piece of the Puzzle - So the MAIN things that had been messing up installing TV-Stock GApps on FireTV or anything else for that matter is A) No one was editing the /system/etc/permissions files appropriately and B) that the OpenGApps TV-Stock installer includes a broken copy of NoTouchAuth which wont allow you to register with Google Play Services. In one of the above commands we installed a copy of NoTouchAuth I pulled from a Official AndroidTV box (so it actually works) and once you have completed the next steps and reboot, you will be able to log into Google Play without issue. Also at this point we have replaced the stock system build.prop with the modified one to allow a proper TV-Stock installation, and allow for proper authentication with Google Play Services, installed the modified copy of peleg's TvSettings.apk (ATV Settings Widget/Menu) which now does not require signature spoofing due to my removal of the "com.android.shared.uid" value from the Android Manifest, disabled Wifi-Direct broadcasting, and installed XposedInstaller.apk + HDXPosed.apk, along with the ESSENTIAL Xposed Module "Xposed Edge" which is what will allow us to remap Buttons / Keycodes & provides the Running App List + Task Switcher + an unbelievable amount of other useful features and ability to customize just about anything.

    So now that all that has been done the last step is to reboot into TWRP recovery (however that is done on your device) and install the final ZIP files of updated SuperSU v2.82, Xposed Framework v87, and finally OpenGApps TV-Stock itself.

    EDIT: Due to issues with OpenGApps TV-Stock overwriting NoTouchAuth during installation, you must run the following AFTER finishing the TV-Stock installation to avoid the "spinning circle of doom" issue, which will prevent Google Play login. After running the commands below REBOOT and you should be able to login to Google Play without further problems.

    [email protected]:/ $ su
    [email protected]:/ # mount -o rw,remount /system
    [email protected]:/ # rm  /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
    [email protected]:/ # cp /sdcard/PlayFire/TV-NoTouchGsf.apk /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk
    [email protected]:/ # chmod 644 /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk && chown root:root /system/app/NoTouchAuthDelegate/NoTouchAuthDelegate.apk

    • Updater Script: Completed-as-of v4_LazyLeanback
      I am currently in the process of investigating whether it may be possible to write an "Updater Script" that functions as the OpenGApps Updater scripts do, which would allow users to seamlessly flash the latest rbox prerooted ROM releases while keeping all these MOD changes in tact through the upgrade process. I have just starting looking into this, so have no estimate for when or if It might be completed.
    • Update.zip Flashable Installer: Completed-as-of v4_LazyLeanback
      I MAY also attempt to investigate the possibility of creating an "all-in-one" Update.zip package which would be flashed through TWRP and preform as many of the steps of this MOD as possible. In any case DO NOT THINK THIS WILL BE A "FULL" CUSTOM ROM, It will only be exactly what is currently discussed in this thread, It will not at any time include the rbox ROM, OpenGApps installers or any other modules not currently already included within my "PlayFire.tar.gz" archive. I have not even started looking into the first steps of how this may or may not be possible, just something I have in the back of my mind as a possible continuation of this MOD and my learning process. Do NOT ask me when this might be completed, as I have not even begun the most basic of firsts steps, again just something I may consider trying to do at a later date. If you want this MOD installed anytime soon, your going to need to follow current procedure outlined in this guide for the time being.
    • Custom Compiled OpenGApps TV-Stock Installers: Again, this is something I MAY attempt to do at a MUCH LATER DATE, and only AFTER I have created both the Updater Script and the Update.zip package. As there are numerous issues with the OpenGApps built TV-Stock I may try to build the installer from source myself and resolve as many issues as they relate to the FireTV as possible. Again, do NOT ask me when this will be ready, as I honestly have no clue, but again is something I am considering if there is enough interest shown and/or more serious problems with the current OpenGApps TV-Stock installers become apparent.
    This looks amazing! Since the FireTV Stick 2nd Gen can't be rooted on any firmware, it would never work on it, right?

    Never say never. If the FireTV-Stick 2nd Gen ever gets rooted this should absolutely be possible on that device (assuming @rbox continues his amazing work of providing a TWRP environment to install ZIPs), but even if RBox decides not to continue supporting newer FireTV Devices it may be possible through something like @Chainfire's FlashFire, but that is theoretical at this point obviously.

    Also I may or may not still have a trick or two up my sleeve for the FireTV community, but that's definitely not ready for the limelight just yet (or even confirmed working, just a theory at this point) so i'd keep checking around here and AFTVNews to see if your 2nd Gen Stick is still unrootable :cool:
    Is it necessary to wipe the FTV to a clean state before doing this?

    I've only got about 615MB free according to to the system status report.

    Speaking of which, will this mod make it possible to mount an external storage to the /data partition as we were able to do with the jmandawg scripting or Link2SD methods, back in the old days with FireOS 3?


    If you KNOW WHAT YOU'RE DOING, and you ABSOLUTELY MAKE SURE TO REINSTALL RBOX's ROM BEFORE YOU REBOOT AFTER WIPING SYSTEM then Yes I very highly recommend starting off from a fresh reset. However this MOD mainly effects things inside the /system partition of your device, not the /data/ partition which is what you are saying only has a limited amount of space left in it, so it should install just fine as long as you have not messed around with things in /system.

    As for external storage enhancements, it's possible, but I have never really looked into it. Ill try to find out and let you know.
    The crash happens if you try to pair another remote or Bluetooth. As soon as you click to add a device or remote, I get the logcat output I posted about Bluetooth. I think the pairing screen for both remotes and Bluetooth use the same activity since some third party remotes and input devices use Bluetooth. Once it crashes, it takes you back to the generic settings screen (not the specific screen for controllers and Bluetooth devices). It never displays a list of devices at all.

    Please run the following and see if maybe this can help you diagnose the problem, and please let me know what happens.
    The Amazon Bluetooth Debug menu should let you see some more detailed info on what your FireTV is seeing with controller pairing.

    am start com.amazon.bluetoothinternals/.ui.eight_seven.BTStatusActivity

    I am guessing this will not include USB right. Like we where able to do on FireOS 3. Combining a fast enough external HDD/USB Flash drive to internal for game/app installs ? Or am I reading to much into the "/data/local/ --> /system/priv-app" parts. Any chance of getting this option as a stand alone for us that are keeping the FireOS UI for now?

    Actually Yes bind mounts should allow me to recreate this type of setup on FireOS5. I've PM'd you to get some more details on exactly what you'd like to see done with this kind of configuration and will create a new thread if successful at reviving this and enough interest is shown.

    I was originally on with working FireStarter on my old Gen1 Stick and intended to just update it it to the latest ROM. Then playing around I realized I hadn't got the Leanback Keyboard and when I change over to it, it just reverts back to FireIME (noticed someone else with the same issue, not looked at the fix yet)

    Did notice though, that as its spoofed as a MiBox (I think I saw), PlayStore Web doesn't list it as I already have a MiBox on the account (just a note really to the rare few people that have one). This is really just to say thanks for the time and effort you've put in to the mod and the continual updates. Ill be doing this to all my Fire devices at some point (used Gen1 Stick as a test) :)

    Thanks Dude! Always nice to see another painless success story, and the round about way you preformed the MOD steps is basically how I always do it myself as well.

    Please run the following from a ROOT SHELL to fix the Leanback Keyboard issue, i've been running into the same problem myself on the latest r2 builds not sure why, but the following fixes it pretty easily anyway. As for your Mi Box spoofing issue, damn did not expect that to pop up, but think you might be a pretty rare case on that one, if you want you can try to edit the Mi Box spoofing in build.prop to a Sony AndroidTV if you want to see a separate device in your Play Account, but obviously I have not tested this but don't think it should cause issues.
    Sony AndroidTV build.prop device spoof: android-sony-tv

    Leanback Keyboard Fix (Which is incorporated into my in-progress v5 Installer):
    (pm disable com.amazon.tv.ime ; sleep 1 ; am start com.android.tv.settings/.system.KeyboardActivity ; sleep 5 ; pm enable com.amazon.tv.ime)

    I have Bluetooth crashes when i look for device, firetv remote says offline. Same issues on both FireTV 2 (sloane) Prerooted Stock Images and

    Bluetooth crash (from Leanback TvSettings) is a known issue, still trying to work that one out, but BT pairing should work from the Amazon Settings Menu (at least it does for me on a FireTV-v1). Also if you ran the v4 scripts you need to re-enable Wifi Direct on FireTV-v2, please see post #140 for more info on how to do this. I have significantly changed the way the new v5 scripts i'm working on deal with this, but until I release the new version you need to manually correct this problem.

    I followed the guide and got everything installed on my Fire TV 2 running r2 and everything works great with the exception of not being able to use my remote, as others have reported. Just curious but is there any progress with getting it to work again? I love it and want to use it but my wife doesn't like using the USB keyboard remote I have so I had to remove the MOD until the remote works again. Thanks for all of your hard work!

    Thanks, and yes you need to re-enable Wifi Direct on the FireTV-v2 to get your remote working again...my bad on that, thought others had confirmed disabling wifi direct did not cause issues on your device, but that was incorrect and wifi direct needs to be enabled for the v2 remote to work.

    Thanks for the reply and I will have to try that. Just wondering though, why was it important to include that in the mod?

    Is not "important", but is something that I personally found annoying with the Fire-DIRECT-#### broadcast, and which no one else ever seemed to figure out how to disable. At least on v1 devices the remote works via Bluetooth so disabling Wifi Direct did not cause any problems, but apparently the v2 remotes use Wifi Direct to communicate with the FireTV.

    The android.hardware.wifi.direct.xml is why the remote is not working. Delete the that file when you extract or from the script. Remote and accessories would crash until I added android.hardware.bluetooth.xml. Hopefully the op can add that on his next release. Aft keyboard wouldn't work, but lean back keyboard would. If it's saying incorrect password it might have fixed one problem, but added another

    DO NOT DELETE android.hardware.wifi.direct.xml, you need to edit this file and remove the #'s i added in commenting out the three lines. This issue is dealt with very differently in my v5 scripts, but Im still making sure everything works 100% before I release the new version to prevent any issues like this from popping up in the future. In total the new scripts are closer to 1000 lines of code (from around 100 for the v4 scripts) so it's taking a while to fully code and test everything i've added to the MOD for the new release.

    What device do you have and what do you mean you needed to "add" android.hardware.bluetooth.xml? Does the FireTV-v2 not already include this file? If that's the case I was entirely unaware of this and will absolutely add that file into my newest release, just never knew that was even an issue until now.