How to Use HDMI Mode Switch for Fire TV running on Older Fire OS

HDMI Mode Switch is intended to add 4K UHD capabilities to an Amazon Fire TV Generation 2 when connected to a 4K UHD TV. There are two ways of upgrading the 1080p 60fps that this version of the Amazon Fire TV is capable of to match the newer technologies. Read on to find out exactly how to perform this change and enjoy 4K UHD with Amazon Fire TV Generation 2.

HDMI Mode Switch
1. Check on supported modes
Writing Display.getSupportedModes() shall bring you in return all the Display.Mode objects. The results you´ll see in your screen reflect the supported modes of both: Amazon Fire TV Generation 2 and the display to which it is attached. If your current TV or display has 4K UHD capabilities, then that option will be available in the list.

2. Current Modes
By writing Display.getMode() you will get current refresh rate and resolution.

3. Set Display Mode
With WindowManager.LayoutParams.preferredDisplayModeId applications use the Mode Switch. The Mode Switch to 4K UHD will be activated when the played content is compatible and demands so, otherwise will remain Full HD 1080p. When the 4K UHD activity ends, Mode Switch will engage again and go back to Full HD.

4. Notifications
Through the method onDisplayChanged(int displayId) you can get a notification of when the negotiation is complete for the Mode Switch.

Amazon 4K Extension Library
Since the APIs for the HDMI Mode Switch are not available on Android Lollipop systems SDK, a reflection is needed for their use. With this reason in mind, Amazon built the 4K Extension Library in the shape of a source code to provide a helper class and demonstrate how Android APIs are used.
1. Download Amazon 4K Extension Download the ZIP File from the Amazon 4K Extension Library.
  • Go to File->Open at Android Studio
    Display Mode Check Sample has to be selected.
    Click on the Run App Button Looks like a PLAY button of an audio or video player.