1page.title=Supporting Multi-Window 2@jd:body 3 4<!-- 5 Copyright 2016 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27<p> 28In Android 7.0, users can have multiple apps simultaneously displayed on their 29device screen with the new platform feature, multi-window. In addition to the 30default implementation of multi-window, Android 7.0 supports a few varieties 31of multi-window: split-screen, free-form, and picture-in-picture. 32</p> 33 34<ul> 35<li><strong>Split-screen</strong> is the base implementation of multi-window and 36provides two activity panes for users to place apps. 37<li><strong>Freeform</strong> allows users to dynamically resize the activity 38panes and have more than two apps visible on their screen. 39<li><strong>Picture-in-picture (PIP)</strong> allows Android devices to continue 40playing video content in a small window while the user interacts with other 41applications.</li> 42</ul> 43 44<p> 45To implement the multi-window feature, device manufacturers set a flag in the 46config file on their devices to enable or disable multi-window support. 47</p> 48 49<h2 id="implementation">Implementation</h2> 50<p> 51Multi-window support is enabled by default in Android 7.0. To disable it, set 52the <code>config_supportsMultiWindow</code> flag to false in the <a 53href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml">config.xml</a> 54file. 55</p> 56<p> 57For devices that declare <code>ActivityManager.isLowRam()</code>, multi-window 58is disabled regardless of the value of <code>config_supportsMultiWindow</code> 59flag. 60</p> 61<h3 id="split-screen">Split-screen</h3> 62<p> 63The default multi-window experience is split-screen mode, where the System UI is 64divided directly down the middle of the device in portrait or landscape. Users 65can resize the window by dragging the dividing line side-to-side or 66top-to-bottom, depending on the device orientation. 67</p> 68<p> 69Then device manufacturers can choose if they want to enable freeform or PIP. 70</p> 71<h3 id="freeform">Freeform</h3> 72<p> 73After enabling standard multi-window mode with the flag 74<code>config_supportsMultiWindow</code>, device manufacturers can optionally 75allow freeform windowing. This mode is most useful for manufacturers of larger 76devices, like tablets. 77</p> 78<p> 79To support freeform mode, enable the 80PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT system feature in <a 81href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/content/pm/PackageManager.java">/android/frameworks/base/core/java/android/content/pm/PackageManager.java</a> 82and set <code>config_freeformWindowManagement</code> to true in <a 83href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml">config.xml</a>. 84</p> 85 86<pre> 87<bool name="config_freeformWindowManagement">true</bool> 88</pre> 89 90<h3 id="picture-in-picture">Picture-in-picture</h3> 91<p> 92After enabling standard multi-window mode with the flag 93<code>config_supportsMultiWindow</code>, device manufacturers can support <a 94href="http://developer.android.com/preview/features/picture-in-picture.html">picture-in-picture</a> 95to allow users to continue watching video while browsing other activities. 96While this features is primarily targeted at Android Television devices, other 97device form factors may support this feature. 98</p> 99<p> 100To support PIP, enable the PackageManager#FEATURE_PICTURE_IN_PICTURE system 101feature in <a 102href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/content/pm/PackageManager.java">/android/frameworks/base/core/java/android/content/pm/PackageManager.java</a>. 103</p> 104<h3 id="system-ui">System UI</h3> 105<p> 106Support all standard System UIs according to <a 107href="http://developer.android.com/preview/features/multi-window.html#testing">http://developer.android.com/preview/features/multi-window.html#testing</a> 108</p> 109<h3 id="applications">Applications</h3> 110<p> 111To support multi-window mode for preloaded apps, consult the <a 112href="http://developer.android.com/preview/features/multi-window.html">developer 113preview documentation</a>. 114</p> 115<h2 id="validation">Validation</h2> 116<p> 117To validate their implementation of multi-window, device manufacturers should 118run <a 119href="https://android.googlesource.com/platform/cts/+/master/hostsidetests/services/activitymanager/src/android/server/cts">CTS 120tests</a> and follow the <a 121href="http://developer.android.com/preview/features/multi-window.html#testing">testing 122instructions for multi-window</a>. 123</p> 124