Multi-window mode: an additional competitive advantage for Android applications


Anyone who has worked in multi-window mode on an Android device can attest that it is very convenient in certain situations. A simple example: reading an e-book with an electronic dictionary. Especially on a smartphone or tablet with a fairly large screen. If a user has to choose between two applications that are similar in almost every way, but differ in their support for simultaneous work with multiple windows, it is not surprising that he will choose the one that provides such support.

In this article you will learn about multi-window mode in Android, and how to use this feature when building your own applications.

Review

Simultaneous work with multiple windows in Android is an interesting feature that can make your application stand out from many others and give it an additional competitive advantage. Many OEMs and ODMs, such as Samsung, Ramos and Huawei, are customizing the basic Android system. In particular, they are introducing support for multi-window mode. They do this in order to increase the attractiveness of their smartphones and tablets, to distinguish them from the bulk of devices that do not support such a function.


Scenarios for using multi-window mode

How to activate multi-window mode in Android?


Hidden in Android 6.0 is an experimental option that allows you to use multi-window mode.
Activating it is relatively difficult, but if done correctly, there should be no difficulties with this. Unlike a similar function on Samsung smartphones, it works with all applications. In order for the multi-window option to appear on Android 6.0, you just need to edit the build.prop file, indicating in it that you are using the userdebug build, not the user one. This can be done using a computer and custom recovery, and if the device has root access, using a regular text editor.

First way

1. Install a custom recovery (for example, TWRP) on your device. To do this, download and install ADB from the Android SDK. Then download the recovery image for your device, rename it twrp.img and place the ADB folder.

2. Connect your smartphone to your computer with a USB cable, open the command line and run three commands:

adb reboot bootloader fastboot flash recovery twrp.img fastboot reboot

3. Turn off your smartphone and enter recovery by pressing a certain key combination (usually the power button and the volume up and down buttons).

4. In recovery, select the Mounts section and put a cross next to System.

5. Connect the smartphone to the computer with a cable and enter the following command on the computer at the command line:

adb pull /system/build.prop

6. The build.prop file will be downloaded to your computer. Open it in Notepad and replace the line "ro.build.type=user" with "ro.build.type=userdebug"


7. Download the build.prop file back to your smartphone by entering the command on the command line:

adb push build.prop /system/

8. Specify three more commands that are needed to prevent third-party applications from modifying build.prop:

adb shell cd system chmod 644 build.prop

9. Restart your smartphone and activate multi-window in the developer settings.

Second way

On rooted smartphones, editing the build.prop file is much easier. This can be done with a special Build Prop Editor application or using a text editor built into a file manager like Root Explorer or X-Plore. The file is located at /system/build.prop, and in it you need to replace the line “ro.build.type=user” with “ro.build.type=userdebug”.

How to activate multi-window?

1. Open system settings, go to “About device” and tap on the Android build number several times.

2. A section for developers will appear in the settings. Go into it - you will see a switch that allows you to activate multi-windows.

3. Open the multitasking screen by long pressing the home page button (or virtual button). You'll see a new icon in the app page thumbnails. After clicking on it, the system will offer to choose the location of the application: on half, one-quarter of the screen or on the entire screen. When several applications are open, the proportions of their windows can be changed.

Google will likely make this Android feature available to all users in the future. Do you think smartphones and tablets need it or is it completely useless?

Preliminary information

In June 2012, Cornerstone
, the first open-source platform for organizing multitasking on Android. In August 2012, Samsung released the first device that supports multi-window mode. From 2013 to the present day, one can observe the explosive growth of solutions to support simultaneous work with multiple windows in Android.

In May 2015, Android M Developer Preview was released (today, in July, Preview 2 is already available). The official release of Android M (6.0) is expected in the fall of 2015. Among other innovations, Android M Preview 2 is notable for its support for multi-window mode.

Development of solutions to support multitasking in Android
There are two approaches to working with multiple windows: using floating and docked windows. Among the main features of working in multi-window modes are opening and closing windows (open/close), changing their size (resize) and relative position (swap). By opening or closing a window, we, accordingly, enable or disable multi-window mode. The resizing feature allows you to adjust the size of windows. Rearranging windows is an action that allows you to change their places.


Multi-window modes

In 2013, many solutions designed to work with multiple windows appeared on the market. They have been developed by OEMs, ODMs, independent software vendors, and the open source community. In the table below you can find a comparison of various technologies for organizing multi-window work in the Android environment.

ProductCornerstoneStandoutXposedTieto
DescriptionFramework for organizing multitasking work in Android OSAn open source library that can be used to create applications with floating windowsMulti-window application that supports docked windowsThe project aims to create a work environment reminiscent of working on a desktop PC
Supports opening, closing windows, resizing, expanding to full screenYesYesYesYes
Window stylePinnedfloatingPinnedFixed and floating
Code modificationAt the Android platform levelAt the application levelAt the Android platform levelAt the Android platform level
Application supportAll applications are supported; however, SurfaceView dynamic configuration is not available.Some supporting applications. For example, a calculator. Compatibility and stability of the solution needs to be improved.Supports all applications.
Android versionAndroid 4.1. – Android 4.4. Android 4.1. – Android 4.4. Android 4.4.Android 4.4
Official siteCryCryCryCry

Software architecture

The Android platform code can be modified to support additional features.
The Android OS architecture consists of several layers. In the case of Android 4.2 and Android 4.3, the launcher and other applications are placed in one stack at startup, called the “main stack”. As you know, multi-window mode requires more stacks to accommodate multiple windows. As a result, you need to modify the ActivityManagerService system class by adding an interface to it for creating and managing a stack. To modify the platform class WIndowManagerService, which allows you to manage graphical views of applications, you need to modify the InputManager. This is necessary so that it can redirect touch events to the appropriate windows.

With the release of Android 4.4 and Android 5.0, the approach to stack management has changed significantly. The shell and other applications can run on different stacks. Support for multiple stacks and the ability to manage them have been added to the system. The figure below shows the differences in working with the stack in different versions of Android.


Comparison of working with a stack in Android 4.3 and Android 4.4

Now let's focus on Android 5 (Lollipop). Android OS uses callback mechanisms to execute Activity interface functions. However, the control function is implemented at the platform level. So now we'll look at two important classes: ActivityManagerService and WindowManagerService.


Lollipop platform software structure

How to enable multi-window interface in Android 7.0 without root and adb

Even from the first beta versions, the public became aware that Google was implementing a multi-window operating system in the Android 7.0 Nougat operating system. This is what happened, but for some reason the developers decided to hide this function for now. But it can be activated and you don’t even need root or other complicated tools. How to activate such a computer interface in Android 7.0 - read on Trashbox.

Telegram channel of the creator of Trashbox about technology

Telegram channel of the creator of Trashbox about technology

First of all, let's note what multi-window mode actually is in Android 7.0 Nougat. In the regular mobile version, which is available out of the box, the multi-window interface only allows you to split the screen into two parts to work with two applications at the same time. Hidden mode allows you to work with applications in the style of a full-fledged OS for computers: there can be several windows on the screen, between which you can freely switch, and you can also resize them. Thus, pure Android 7.0 can be turned into something like Remix OS or even Windows.

How to enable Android 7.0 Nougat multi-window interface:

  1. Enable developer tools in the settings menu: go to Settings → About phone/tablet. There, find the “Build number” item. Tap on it until the message “You are now a developer” appears.
  2. Return to the general settings menu and go to the new “Developer Options” item. There, find the item “Force activities to be resizable” and activate it.
  3. Reboot your device.
  4. Install the Taskbar application:
    Taskbar 6.2 Android 5.0 and higher
  5. Launch the Taskbar app and activate its Start-style menu from Windows.
  6. Return to the desktop, clear the list of recent applications and from the Taskbar menu start launching new programs - they are already running in desktop mode.

Here's how it works on the Google Pixel C tablet:

Thus, you can turn an ordinary Android tablet into a working machine with a full-fledged desktop interface that is optimized for control using a mouse and keyboard.

Activity Management in Lollipop

Since the ability to work in multi-window mode depends on the stack, the following shows how you can create a stack and how you can run an Activity on that stack. In Lollipop, the following functions have been added to the IactivityManager.java interface:

New features of the IactivityManager.java interfaceDescription
public void moveTaskToStack(int taskId, int stackId, boolean toTop)Move a task to another stack
public void resizeStack(int stackBoxId, Rect bounds)Change stack size
public void setFocusedStack(int stackId)Set focus to the selected task
Public Boolean isInHomeStack(int taskId)Find out if a task is on HomeStack

Once started, the SystemServer process calls activity manager services and windows management services. In order to observe this process, we can add commands to throw a runtime exception (RuntimeException) at the appropriate places.


The process of creating a stack in Lollipop

Now let's see how to launch an Activity on the stack:


Launching an Activity on a Stack

In Lollipop, the following commands were added to the ADB (Android Debug Bridge) utility:

ADB commandFunctionDescription
Adb shell am stack startLaunches a new Activity on using IntentIn Kitkat 4.4, ADB commands contain: adb shell am stack create In Lollipop 5.0: adb shell am stack create deletion
Adb shell am stack movetaskMoves from the current stack up or down the stackUsage: adb shell am stack movetask task_id stackid true/false Note: This works in Kitkat, but not in Lollipop
Adb shell am stack resizeChanges the stack size and position toUsage: adb shell am stack resize task_id weight

Window management in Lollipop

WindowManagerService is the central part of the window management system. Its functionality includes dispatching input events, controlling the location of objects on the screen and the surfaces on which graphic elements are displayed.


Role of WindowsManagerService in Android Graphics Architecture

Multi-window problems

When working in multi-window mode, you can resize windows. There are examples when the size of the window displaying game animation cannot be changed. The main reason for this is that the Android SurfaceFlinger subsystem cannot dynamically change the size of the output image.


Games using SurfaceFlinger cannot dynamically resize the window

Another problem is that some applications do not display correctly in multi-window mode. In the picture below you can see that the calculator is not displayed correctly in multi-window mode. It's all about the application's layout, which is not designed for such conditions of use.

Calculator with a layout that is not designed to work in multi-window mode

Selecting Compatible Applications

To find out which apps you can use in split screen mode, you need to go to the recently used apps panel. You can call it by pressing the “square” icon on the navigation key bar. In some models where there are no function keys, this action is replaced by swiping across the screen.

Having reached this menu, you may notice that some programs have icons to the right of their names that look like 2 small rectangles located one above the other. This means that the program is ready to work in split screen mode.


As you can see, Chrome supports the split-screen function, but the Netflix application does not want to share the workspace with anyone

Multi-window support in Android M

Android M Developer Preview 2 can be run on Nexus 5, 6, 9 and Nexus Player.
If you don’t have such a device, or you don’t want to install an OS on it that is in Preview status, you can get acquainted with Android M using the emulator in Android Studio. In particular, we are now interested in standard tools for working in multi-window mode. In order to see this mode in action, just create a new virtual device using the AVD Manager tool, choosing one of those available with the Level MNC API as the system image. In our case, it was the x86_64 image. Next, you need to launch the emulator, go to the Developer settings section and enable the Multi-window mode option there. If you can't find such an option, take a look at this guide

Now comes the fun part. To begin with, you can launch several applications, everything will be as usual. But if you click on the button for calling up the list of recently opened applications, a new icon will appear in the title bars of the window thumbnails. By default, this is a frame indicating that the application is running in full screen mode. If you click on this icon, a window layout selection menu will appear.

Menu for selecting the layout of windows in multi-window mode.
Then everything is quite clear. Select the desired layout and enjoy the multi-window mode:

Multi-window mode in Android M
It is not yet known whether working with multiple windows will be available in the official release of Android M. However, for example, the system calculator feels good in this mode. As a result, we have good reason to believe that the day is not far off when adapting applications for multi-window mode will turn from a competitive advantage into an urgent necessity.

If you want to equip your applications designed for earlier versions of Android with support for multiple windows, it's time to turn to the third-party solutions discussed above. For example, to Cornerstone.

How to remove the second screen on Android

The easiest way to quit multitasking screen use is to restart the gadget. Most devices, however, allow you to do things more logically - close, minimize, or move each of the open windows with a special tab on top.

If you entered multi-window mode using a separately installed application, simply turn it off.

If we are talking about the “Picture in Picture” function for Android Oreo (8.0), the small screen with video in its upper right corner will show a cross. You just need to click on it.

Example: Cornerstone

Onskreen created Cornerstone, the first multi-window framework on Android. It is designed for devices with large screens and tablets. The source code can be downloaded on Github. It supports Android versions 4.1 and 4.2. Cornerstone has not yet been released for later versions of this OS. However, you can analyze the source code for Android 4.2 in order to find out the technical details of the system.


Cornerstone Modifications in Android Jelly Bean

Results

Many mobile devices running Android OS use Intel® processors. How can developers improve the user experience of their apps? How to make applications more competitive? These questions lead us to continually improve products on Intel Architecture (IA) devices. Multi-window support is a good example of a useful feature that gives applications a competitive advantage. This is convenient; multi-window mode gives the user the opportunity to perform several tasks simultaneously. For example, watch a video and write a review to your friends about what you watch. For example, play a game and read its reviews. Today, multiple devices support multi-window mode. For example, these are the Ramos i12, Teclast x98 and Cube i7 tablets, which runs Remix OS.


Multi-window mode on IA devices

Use multi-window in Android Nougat or Oreo

In version 7.0 of its operating system, Google introduced multi-window access for the first time, making it available to everyone. Obviously, this feature remains available with Android 8.0 Oreo and can be activated as follows:

  1. Open the app you want to view at the top of the screen.
  2. Press and hold the multitasking key for a few seconds.
  3. You can now navigate through your open apps and select a second app to view.

Note that if the second app is not one of your recently opened apps or ones that you can open, simply press the Home key after this step and you can launch the second app as usual.

It will take some practice before you understand which apps support this feature, as the app developer may block this feature, as seen with Instagram.

Rating
( 2 ratings, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]