Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do We Identify If an Android Device Is Running Official Android 7.0+ Freeform Multi-Window Mode?

Tags:

android

Back when Android 7.0 was announced, they said that there was a freeform multi-window mode option, roughly analogous to how traditional windowed desktop OSes work (multiple overlapping resizeable windows):

Manufacturers of larger devices can choose to enable freeform mode, in which the user can freely resize each activity. If the manufacturer enables this feature, the device offers freeform mode in addition to split-screen mode.

However, they did not provide any official environment for this mode.

I know of at least two Android 7.0+ environments that today have what amounts to a freeform multi-window mode:

  • Some Chrome OS devices (e.g., Acer Chromebook C738T)
  • Samsung DeX, when operating in DeX mode (not screen-mirroring mode)

Both offer multiple overlapping resizeable windows. However, their behavior is not the same. DeX, for example, offers a "rotate" title bar option for windows hosting activities that are not advertised as being resizeable, which flips the window from portrait to landscape orientation. The Chrome OS freeform multi-window implementation lacks this.

An unofficial way of getting official freeform multi-window mode on an Android 7.0+ device (e.g., a Nexus 9) is via adb shell settings put global enable_freeform_support 1. However, when I run settings get global enable_freeform_support on either the Chrome OS or the DeX environments, I get back null, suggesting that this setting is not set.

The problem is that both Android-on-Chrome-OS and DeX are sufficiently "weird" in their own right that both might well have implemented their own semi-proprietary freeform multi-window mode on top of Android 7.0. After all, Android-on-Chrome-OS had that with their original Android 6.0-based distribution, and Samsung offered split-screen multi-window modes on some of their devices prior to Android 7.0.

So, is there a definitive way to tell whether or not a given Android environment that sports a freeform multi-window UI is using the official Android 7.0+ freeform multi-window implementation versus something else?

like image 649
CommonsWare Avatar asked Jun 19 '17 13:06

CommonsWare


1 Answers

SystemUI uses the following to determine if freeform multi-window mode is available:

mHasFreeformWorkspaceSupport =
    mPm.hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT) ||
            Settings.Global.getInt(context.getContentResolver(),
                    DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 0) != 0;

See: https://github.com/android/platform_frameworks_base/blob/nougat-release/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java#L213-216


DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT is hidden, so you would need to replace that with "enable_freeform_support":

boolean hasFreeFormWorkspaceSupport =
    getPackageManager().hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT) ||
        Settings.Global.getInt(getContentResolver(), "enable_freeform_support", 0) != 0;

I don't have Android-on-Chrome-OS or DeX to test this on, however, this is how SystemUI is checking if freeform multi-window support is enabled. Perhaps you could decompile the settings or systemui app from DeX or Chrome and check if they have made changes here.

like image 55
Jared Rummler Avatar answered Sep 17 '22 18:09

Jared Rummler