[Fire HD 8 and HD 10 General] DragonFire1024:
So I am back at it again. This time a different approach. I have been trying to come up with a way to make an android device, or amazon tablet into a chromecast/screen mirroring receiver. There are plenty of ways to do this, via HDMI cable and an adapter. But I want to go further. What if you could trick the casting system into thinking your tablet is actually a television? Then you could cast and receive almost any stream on your tablet no matter where you are. On rooted and unlocked stock fireOS, at least on 5.4.1.0, if you install 'Chromecast built-in' (as its currently called. Was formerly Google cast receiver and chromcast media shell) as a system app, it works. Well half of it works. I can't get anything to connect on either end, but the functionality is there. Now here's the kicker. In the android system aka framework-res, in integers, there's a configuration (screen shot below). This configuration allows you to set a value to define what your device is. From source:

framework-res/res/values/integers
Control the default UI mode type to use when there is no other type override happening.

One of the following values (See Configuration.java):
1 UI_MODE_TYPE_NORMAL
4 UI_MODE_TYPE_TELEVISION
5 UI_MODE_TYPE_APPLIANCE
6 UI_MODE_TYPE_WATCH

Any other values will have surprising consequences. -->

<integer name="config_defaultUiModeType">1</integer>

There's just one problem with this. I uninstalled the APK and I forget which version I installed and tested. So now I have to start all the way from beginning and go through each one until I find that exact one. The only interface that should work on it is the settings option. And you need a pretty good activity launcher in order to get to that setting. The one I use and have use for quite some time next to the actual activity launcher is 'activity manager.'

MY PLAN: install an xposed module or the likes to mask and or change device defaults like Mac addresses and product identifiers to a known television manufacturer. Changing the MAC address is probably going to be your best bet in this case. Secondly install the 'Chromecast built-in' APK as a system application. It's also possible you may need to extract a library files from the APK and install those into the system as well. Third, modify the framework to set the value for the user interface to be a television. In theory, though it isn't really all that a great of one, in the end you may have a very weird tablet or one that thinks it's a TV and pretty badass. It would also be a fully Chromecast enabled device for both screencasting or receiving. Which also means the potential for said device to be a fully integrated Google home device as well. And last, there are some pretty good apps that with root access, can change the 'user agent' so it also appears that you're using an actual desktop web browser. In theory that should allow you to receive cast sessions through the Chrome browser on your tablet. Let your imagination run wild from that point on . I have known about this integer and configuration for quite some time, but I have never had a reason nor have I felt compelled enough to try something that likely won't work and screw something up real bad. Back before we had an unlocked device it would take upwards of two hours to finally be fully rooted and recovered. That is from the time it takes you to start installing the firmware until the final process of installing your root applications is done. To be honest I have no idea what the consequences or lack thereof possibly, there would be on the OS, if any. Anyways this is just a potentially cool little development that could go a really long ways, or down in flames. Though I have only tested this to the extent of getting the apk to work on stock fire OS, this configuration exists in every version of Android on every device not just Amazon tablets. So this could potentially work on many others if it works at all.

There is also the potential to integrate this into customized firmware or even into a custom ROM. If I can track down to working APK, firmware can be rebuilt with all the fixes using superr's tool, built into a flashable firmware package or OTA package and installed as a new ROM.