The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Device Catalog: Samsung DeX

In 2017, Samsung released the Galaxy S8 and S8+. They also released the Samsung DeX, a docking station for the S8/S8+ that not only provides power, an Ethernet jack, and USB ports, but it also has an HDMI port.

Samsung DeX, Front Top Showing Device Connector
Figure 1093: Samsung DeX, Front Top Showing Device Connector

Samsung DeX, Rear Showing Ports
Figure 1094: Samsung DeX, Rear Showing Ports

Moreover, not only can that HDMI port be used the way it is on many other Android devices (screen mirroring, Presentation, etc.), but also in a “DeX” mode that simulates a freeform multiwindow experience. In this mode, the touchscreen is turned off, and the user navigates the windows using a keyboard and mouse (USB or Bluetooth), as with a traditional desktop OS.

DeX Mode, Showing Freeform-Style Windows
Figure 1095: DeX Mode, Showing Freeform-Style Windows

On the whole, developers do not seem to be concerning themselves too much with DeX — for example, as of mid-June 2017, there was exactly one question on Stack Overflow related to DeX. That being said, the DeX is an interesting demonstration of where Android 7.0’s multi-window modes will head. Plus, it is yet another environment that puts keyboards and mice “front and center” for users and, by extension, app developers.

DeX Screen Modes

The user has two choices when docking their device in the DeX: screen mirroring mode and DeX mode.

Screen Mirroring

What Samsung describes as “screen mirroring” mode is pretty much what you would expect from an Android device connected to an HDMI display. By default, the contents of the touchscreen are mirrored on the HDMI display. And, if you use things like Presentation, you can display separate content on the HDMI display from what is shown on the touchscreen.

However, this mode may not be very popular, for one simple reason: the device is docked in the DeX in portrait mode. This means that the content shown on the HDMI device, by default, is in portrait mode. While you could lock your activity to landscape mode, so its Presentation appears in landscape, then the activity is in the wrong orientation on the touchscreen.

DeX Mode

More often than not, if people are bothering to put their devices in a DeX, it is to use Dex mode, with freeform-style windows.

This chapter refers to these windows as “freeform-style”, as while the S8 and S8+ shipped with Android 7.0, they do not appear to have the freeform setting enabled. Hence, Samsung “rolled their own” freeform multiwindow implementation, and the developer (and user) experience in DeX mode will differ somewhat from what “official” freeform multiwindow mode is like.

Activities that are not resizeable will appear in portrait mode by default:

Non-Resizeable Activity on DeX in Portrait
Figure 1096: Non-Resizeable Activity on DeX in Portrait

There is an icon in the title bar that allows the user to rotate the window to landscape:

Non-Resizeable Activity on DeX in Landscape
Figure 1097: Non-Resizeable Activity on DeX in Landscape

Activities that are resizeable — the <activity> or <application> explicitly has android:resizeableActivity="true" — can be resized by using a mouse and dragging the window edges, as with a traditional desktop operating system.

All windows, resizeable or not, can be minimized or maximized. Maximized windows will fill the screen.

Other App Impacts

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

For More Information

The preview of this section is [REDACTED].