Danielle Roberts | 639a586 | 2016-07-14 16:29:17 -0700 | [diff] [blame] | 1 | page.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> |
| 28 | In Android 7.0, users can have multiple apps simultaneously displayed on their |
| 29 | device screen with the new platform feature, multi-window. In addition to the |
| 30 | default implementation of multi-window, Android Nougat supports a few varieties |
| 31 | of 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 |
| 36 | provides two activity panes for users to place apps. |
| 37 | <li><strong>Freeform</strong> allows users to dynamically resize the activity |
| 38 | panes and have more than two apps visible on their screen. |
| 39 | <li><strong>Picture-in-picture (PIP)</strong> allows Android devices to continue |
| 40 | playing video content in a small window while the user interacts with other |
| 41 | applications.</li> |
| 42 | </ul> |
| 43 | |
| 44 | <p> |
| 45 | To implement the multi-window feature, device manufacturers set a flag in the |
| 46 | config file on their devices to enable or disable multi-window support. |
| 47 | </p> |
| 48 | |
| 49 | <h2 id="implementation">Implementation</h2> |
| 50 | <p> |
| 51 | Multi-window support is enabled by default in Android N. To disable it, set |
| 52 | the <code>config_supportsMultiWindow</code> flag to false in the <a |
| 53 | href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml">config.xml</a> |
| 54 | file. |
| 55 | </p> |
| 56 | <p> |
| 57 | For devices that declare <code>ActivityManager.isLowRam()</code>, multi-window |
| 58 | is disabled regardless of the value of <code>config_supportsMultiWindow</code> |
| 59 | flag. |
| 60 | </p> |
| 61 | <h3 id="split-screen">Split-screen</h3> |
| 62 | <p> |
| 63 | The default multi-window experience is split-screen mode, where the System UI is |
| 64 | divided directly down the middle of the device in portrait or landscape. Users |
| 65 | can resize the window by dragging the dividing line side-to-side or |
| 66 | top-to-bottom, depending on the device orientation. |
| 67 | </p> |
| 68 | <p> |
| 69 | Then device manufacturers can choose if they want to enable freeform or PIP. |
| 70 | </p> |
| 71 | <h3 id="freeform">Freeform</h3> |
| 72 | <p> |
| 73 | After enabling standard multi-window mode with the flag |
| 74 | <code>config_supportsMultiWindow</code>, device manufacturers can optionally |
| 75 | allow freeform windowing. This mode is most useful for manufacturers of larger |
| 76 | devices, like tablets. |
| 77 | </p> |
| 78 | <p> |
| 79 | To support freeform mode, enable the |
| 80 | PackageManager#FEATURE_FREEFORM_WINDOW_MANAGEMENT system feature in <a |
| 81 | href="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> |
| 82 | and set <code>config_freeformWindowManagement</code> to true in <a |
| 83 | href="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> |
| 92 | After enabling standard multi-window mode with the flag |
| 93 | <code>config_supportsMultiWindow</code>, device manufacturers can support <a |
| 94 | href="http://developer.android.com/preview/features/picture-in-picture.html">picture-in-picture</a> |
| 95 | to allow users to continue watching video while browsing other activities. |
| 96 | While this features is primarily targeted at Android Television devices, other |
| 97 | device form factors may support this feature. |
| 98 | </p> |
| 99 | <p> |
| 100 | To support PIP, enable the PackageManager#FEATURE_PICTURE_IN_PICTURE system |
| 101 | feature in <a |
| 102 | href="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> |
| 106 | Support all standard System UIs according to <a |
| 107 | href="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> |
| 111 | To support multi-window mode for preloaded apps, consult the <a |
| 112 | href="http://developer.android.com/preview/features/multi-window.html">developer |
| 113 | preview documentation</a>. |
| 114 | </p> |
| 115 | <h2 id="validation">Validation</h2> |
| 116 | <p> |
| 117 | To validate their implementation of multi-window, device manufacturers should |
| 118 | run <a |
| 119 | href="https://android.googlesource.com/platform/cts/+/master/hostsidetests/services/activitymanager/src/android/server/cts">CTS |
| 120 | tests</a> and follow the <a |
| 121 | href="http://developer.android.com/preview/features/multi-window.html#testing">testing |
| 122 | instructions for multi-window</a>. |
| 123 | </p> |