diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml index 43e27f42949b2..81f81375957b3 100644 --- a/docs/html/_redirects.yaml +++ b/docs/html/_redirects.yaml @@ -1,11 +1,6 @@ # For information about this file's format, see # https://developers.google.com/internal/publishing/redirects redirects: - -# Redirects from (removed) N Preview documentation -- from: /preview/features/afw.html - to: https://developers.google.com/android/work/overview - - from: /about/versions/index.html to: /about/index.html - from: /about/versions/api-levels.html @@ -1207,6 +1202,11 @@ redirects: - from: /r/studio-ui/menu-start.html to: /training/index.html?utm_medium=android-studio +# Redirects from (removed) N Preview documentation +- from: /preview/features/afw.html + to: https://developers.google.com/android/work/overview +- from: /preview/features/multi-window.html + to: /guide/topics/ui/multi-window.html - from: /preview/features/icu4j-framework.html to: /guide/topics/resources/icu4j-framework.html - from: /preview/features/key-attestation.html @@ -1226,4 +1226,4 @@ redirects: - from: /preview/features/multilingual-support.html to: /guide/topics/resources/multilingual-support.html - from: /preview/j8-jack.html - to: /guide/platform/j8-jack.html \ No newline at end of file + to: /guide/platform/j8-jack.html diff --git a/docs/html/guide/_book.yaml b/docs/html/guide/_book.yaml index 9d5c3e1247dc6..20ee4838fab59 100644 --- a/docs/html/guide/_book.yaml +++ b/docs/html/guide/_book.yaml @@ -235,6 +235,8 @@ toc: path: /guide/topics/search/adding-custom-suggestions.html - title: Searchable Configuration path: /guide/topics/search/searchable-config.html + - title: Multi-Window Support + path: /guide/topics/ui/multi-window.html - title: Drag and Drop path: /guide/topics/ui/drag-drop.html - title: Accessibility diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd index 5ced295daa8a5..6deb14b658110 100644 --- a/docs/html/guide/topics/manifest/activity-element.jd +++ b/docs/html/guide/topics/manifest/activity-element.jd @@ -35,6 +35,7 @@ parent.link=manifest-intro.html android:permission="string" android:process="string" android:relinquishTaskIdentity=["true" | "false"] + android:resizeableActivity=["true" | "false"] android:screenOrientation=["unspecified" | "behind" | "landscape" | "portrait" | "reverseLandscape" | "reversePortrait" | @@ -43,6 +44,7 @@ parent.link=manifest-intro.html "sensor" | "fullSensor" | "nosensor" | "user" | "fullUser" | "locked"] android:stateNotNeeded=["true" | "false"] + android:supportsPictureInPicture=["true" | "false"] android:taskAffinity="string" android:theme="resource or theme" android:uiOptions=["none" | "splitActionBarWhenNarrow"] @@ -794,9 +796,39 @@ to "{@code false}". The default value is "{@code false}". and icons in the overview screen.
+resizeableActivity
+ Specifies whether the app supports multi-window display. You
+ can set this attribute in either the <activity> or
+ <application>
+ element.
+
+ If you set this attribute to true, the user can launch the activity in + split-screen and freeform modes. If you set the attribute to false, the + activity does not support multi-window mode. If this value is false, and the + user attempts to launch the activity in multi-window mode, the activity takes + over the full screen. +
+ ++ If your app targets API level 24 or higher, but you do not specify a value + for this attribute, the attribute's value defaults to true. +
+ ++ This attribute was added in API level 24. +
+The value can be any one of the following strings:
@@ -921,6 +953,19 @@ home screen uses this setting to make sure that it does not get removed if it crashes for some reason.supportsPictureInPicture
+ Specifies whether the activity supports Picture-in-Picture
+ display. The system ignores this attribute if android:resizeableActivity is false.
+
This attribute was added in API level 24.
+resizeableActivity
+ Specifies whether the app supports multi-window display. You
+ can set this attribute in either the
+ <activity> or <application> element.
+
+ If you set this attribute to true, the user can launch the activity in + split-screen and freeform modes. If you set the attribute to false, the + activity does not support multi-window mode. If this value is false, and the + user attempts to launch the activity in multi-window mode, the activity takes + over the full screen. +
+ ++ If your app targets API level 24 or higher, but you do not specify a value + for this attribute, the attribute's value defaults to true. +
+ ++ This attribute was added in API level 24. +
+- Android N adds support for displaying more than one app at the + Android 7.0 adds support for displaying more than one app at the same time. On handheld devices, two apps can run side-by-side or one-above-the-other in split-screen mode. On TV devices, apps can use picture-in-picture mode to continue video playback while users @@ -36,7 +38,7 @@ page.keywords="multi-window", "android N", "split screen", "free-form"
- If you build your app with the N Preview SDK, you can configure how your app + If your app targets Android 7.0 (API level 24) or higher, you can configure how your app handles multi-window display. For example, you can specify your activity's minimum allowable dimensions. You can also disable multi-window display for your app, ensuring that the system only shows your app in full-screen @@ -46,20 +48,20 @@ page.keywords="multi-window", "android N", "split screen", "free-form"
- Android N allows several apps to share the screen at once. For + Android 7.0 allows several apps to share the screen at once. For example, a user could split the screen, viewing a web page on the left side while composing an email on the right side. The user experience depends on the device:
Figure 1. Two apps running side-by-side in split-screen mode. @@ -100,9 +102,7 @@ page.keywords="multi-window", "android N", "split screen", "free-form"
Users can drag and drop data from one activity to another while the activities are sharing - the screen. (Previously, users could only drag and drop data within a single - activity.) -
+ the screen.- If your app targets Android N, you can configure how and + If your app targets API level 24 or higher, you can configure how and whether your app's activities support multi-window display. You can set attributes in your manifest to control both size and layout. A root activity's attribute settings apply to all activities @@ -173,8 +173,8 @@ page.keywords="multi-window", "android N", "split screen", "free-form"
- Note: If you build a multi-orientation app with a version of the - SDK lower than Android N, and the user uses the app in + Note: If you build a multi-orientation app that targets API + level 23 or lower, and the user uses the app in multi-window mode, the system forcibly resizes the app. The system presents a dialog box warning the user that the app may behave unexpectedly. The system does not resize fixed-orientation apps; if @@ -183,10 +183,13 @@ page.keywords="multi-window", "android N", "split screen", "free-form"
- Set this attribute in your manifest's <activity> or
- <application> node to enable or disable multi-window
- display:
+ Set this attribute in your manifest's <activity>
+ or <application>
+ element to enable or disable multi-window display:
@@ -202,16 +205,19 @@ android:resizeableActivity=["true" | "false"]- If your app targets Android N, but you do not specify a value + If your app targets API level 24, but you do not specify a value for this attribute, the attribute's value defaults to true.
android:supportsPictureInPicture
- Set this attribute in your manifest's
<activity>node to - indicate whether the activity supports picture-in-picture display. This - attribute is ignored ifandroid:resizeableActivityis false. + Set this attribute in your manifest's<activity>+ node to indicate whether the activity supports Picture-in-Picture + display. This attribute is ignored ifandroid:resizeableActivity+ is false.@@ -221,7 +227,7 @@ android:supportsPictureInPicture=["true" | "false"]Layout attributes
- With Android N, the
@@ -283,8 +289,8 @@ android:supportsPictureInPicture=["true" | "false"]<layout>manifest element + With Android 7.0, the<layout>manifest element supports several attributes that affect how an activity behaves in multi-window mode:Running Your App in Multi-Window Mode
- Android N offers new functionality to support apps that can run - in multi-window mode. + Beginning with Android 7.0, the system offers functionality to support apps + that can run in multi-window mode.
Disabled features in multi-window mode
@@ -309,15 +315,13 @@ android:supportsPictureInPicture=["true" | "false"]Multi-window change notification and querying
- The following new methods have been added to the {@link android.app.Activity} - class to support multi-window display. For details on each method, see the - N Preview SDK - Reference. + {@link android.app.Activity} offers the following methods to support + multi-window display.
Activity.isInMultiWindowMode()
+ {@link android.app.Activity#isInMultiWindowMode isInMultiWindowMode()}
Activity.isInPictureInPictureMode()
+ {@link android.app.Activity#isInPictureInPictureMode
+ isInPictureInPictureMode()}
Note: Picture-in-picture mode is a special case of
multi-window mode. If myActivity.isInPictureInPictureMode()
@@ -340,7 +346,8 @@ android:supportsPictureInPicture=["true" | "false"]
Activity.onMultiWindowModeChanged()
+ {@link android.app.Activity#onMultiWindowModeChanged
+ onMultiWindowModeChanged()}
Activity.onPictureInPictureModeChanged()
+ {@link android.app.Activity#onPictureInPictureModeChanged
+ onPictureInPictureModeChanged()}
- There are also {@link android.app.Fragment} versions of each of these
- methods, for example Fragment.isInMultiWindowMode().
+ The {@link android.app.Fragment} class exposes versions of many of these
+ methods, for example {@link android.app.Fragment#onMultiWindowModeChanged
+ Fragment.onMultiWindowModeChanged()}.
- To put an activity in picture-in-picture mode, call the new method
- Activity.enterPictureInPictureMode(). This method has no effect if
- the device does not support picture-in-picture mode. For more information,
- see the Picture-in-Picture documentation.
+ To put an activity in picture-in-picture mode, call {@link
+ android.app.Activity#enterPictureInPictureMode
+ Activity.enterPictureInPictureMode()}. This method has no effect if the
+ device does not support picture-in-picture mode. For more information, see
+ the Picture-in-Picture
+ documentation.
When you launch a new activity, you can hint to the system that the new
activity should be displayed adjacent to the current one, if possible. To do
- this, use the flag
- Intent.FLAG_ACTIVITY_LAUNCH_TO_ADJACENT. Passing
+ this, use the intent flag
+ {@link android.content.Intent#FLAG_ACTIVITY_LAUNCH_ADJACENT}. Passing
this flag requests the following behavior:
If a device is in freeform mode and you are launching a new activity, you can
specify the new activity's dimensions and screen location by calling
- ActivityOptions.setLaunchBounds(). This method has no effect if
+ {@link android.app.ActivityOptions#setLaunchBounds
+ ActivityOptions.setLaunchBounds()}. This method has no effect if
the device is not in multi-window mode.
Users can drag and drop data from one activity to another while the two activities are - sharing the screen. (Previously, users could only drag and drop data within a - single activity.) For this reason, you may want to add drag and drop + sharing the screen. (Prior to Android 7.0, users could only drag and drop data + within a single activity.) For this reason, you may want to add drag and drop functionality to your app if your app does not currently support it.
-
- The N Preview SDK extends the android.view
- package to support cross-app drag and drop. For details on the following
- classes and methods, see the N
- Preview SDK Reference.
-
android.view.DropPermissions
+ {@link android.view.DragAndDropPermissions}
View.startDragAndDrop()
+ {@link android.view.View#startDragAndDrop View.startDragAndDrop()}
View.DRAG_FLAG_GLOBAL. If you need to give URI permissions to
- the recipient activity, pass the new flags
- View.DRAG_FLAG_GLOBAL_URI_READ or
- View.DRAG_FLAG_GLOBAL_URI_WRITE, as appropriate.
+ Alias for {@link android.view.View#startDrag View.startDrag()}. To enable
+ cross-activity drag and drop, pass the flag {@link
+ android.view.View#DRAG_FLAG_GLOBAL}. If you need to give URI permissions to
+ the recipient activity, pass the flags {@link
+ android.view.View#DRAG_FLAG_GLOBAL_URI_READ} or {@link
+ android.view.View#DRAG_FLAG_GLOBAL_URI_WRITE}, as appropriate.
View.cancelDragAndDrop()
+ {@link android.view.View#cancelDragAndDrop View.cancelDragAndDrop()}
View.updateDragShadow()
+ {@link android.view.View#updateDragShadow View.updateDragShadow()}
Activity.requestDragAndDropPermissions()
+ {@link android.app.Activity#requestDragAndDropPermissions
+ Activity.requestDragAndDropPermissions()}
- Whether or not you update your app for Android N, you should + Whether or not your app targets API level 24 or higher, you should verify how it behaves in multi-window mode in case a user tries to launch it - in multiwindow mode on a device running Android N. + in multi-window mode on a device running Android 7.0 or higher.
- If you install Android N on a device, split-screen mode is - automatically supported. + If a device runs Android 7.0 or higher, it automatically supports split-screen + mode.
-- If you did not build your app with the N Preview SDK and the user attempts to use - the app in multi-window mode, the system forcibly resizes the app unless the app - declares a fixed orientation. + If your app targets API level 23 or lower and the user attempts to use + the app in multi-window mode, the system forcibly resizes the app unless the + app declares a fixed orientation.
If your app does not declare a fixed orientation, you should launch your app - on a device running Android N and attempt to put the app in + on a device running Android 7.0 or higher and attempt to put the app in split-screen mode. Verify that the user experience is acceptable when the app is forcibly resized.
@@ -519,7 +526,7 @@ android:supportsPictureInPicture=["true" | "false"]- If you built your app with the N Preview SDK and have not disabled + If your app targets API level 24 or higher and does not disable multi-window support, verify the following behavior under both split-screen and freeform modes.
@@ -593,7 +600,7 @@ android:supportsPictureInPicture=["true" | "false"]
If you disabled multi-window support by setting
android:resizableActivity="false", you should launch your app on
- a device running Android N and attempt to put the app in
+ a device running Android 7.0 or higher and attempt to put the app in
freeform and split-screen modes. Verify that when you do so, the app remains
in full-screen mode.
During normal app use, the foreground activity is sometimes obstructed by other -visual components that cause the activity to pause. For example, when a semi-transparent -activity opens (such as one in the style of a dialog), the previous activity pauses. As long as the -activity is still partially visible but currently not the activity in focus, it remains paused.
++ During normal app use, the app sometimes loses focus, causing the activity to + pause. For example, when apps run in multi-window mode, only one + of the apps has the focus at any time; the system pauses all other apps. Similarly, + when a semi-transparent activity opens (such as one in the style of a + dialog), the previous activity pauses. As long as the activity is still + partially visible but currently not the activity in focus, it remains paused. +
However, once the activity is fully-obstructed and not visible, it stops (which is discussed in the next lesson).
As your activity enters the paused state, the system calls the {@link android.app.Activity#onPause onPause()} method on your {@link android.app.Activity}, which allows -you to stop ongoing actions that should not continue while paused (such as a video) or persist +you to stop ongoing actions that should not continue while paused or persist any information that should be permanently saved in case the user continues to leave your app. If the user returns to your activity from the paused state, the system resumes it and calls the {@link android.app.Activity#onResume onResume()} method.
-Note: When your activity receives a call to {@link -android.app.Activity#onPause()}, it may be an indication that the activity will be paused for a -moment and the user may return focus to your activity. However, it's usually the first indication -that the user is leaving your activity.
++ Note: When the system calls your activity's {@link + android.app.Activity#onPause()} method, the system may be signaling that the + activity will be paused for a moment and the user may return focus to your + activity, or that the app is running in multi-window mode. However, this + method call may also be the first indication that the user is leaving your + activity. +
Figure 1. When a semi-transparent activity obscures @@ -67,7 +76,11 @@ the user is leaving the activity and it will soon enter the Stopped state. You the {@link android.app.Activity#onPause()} callback to: