diff --git a/docs/html/preview/behavior-changes.jd b/docs/html/preview/behavior-changes.jd index 643fe551d5ed9..6be7f5d1726f8 100644 --- a/docs/html/preview/behavior-changes.jd +++ b/docs/html/preview/behavior-changes.jd @@ -11,28 +11,29 @@ page.image=images/cards/card-n-changes_2x.png

In this document

-
    -
  1. Battery Performance +
      +
    1. Performance Improvements
      1. Doze
      2. Background Optimizations
    2. -
    3. Permissions Changes
    4. -
    5. Accessibility Improvements +
    6. Permissions Changes
    7. +
    8. Accessibility Improvements
        -
      1. Screen Zoom
      2. -
      3. Vision Settings in Setup Wizard
      4. +
      5. Screen Zoom
      6. +
      7. Vision Settings in Setup Wizard
    9. -
    10. Platform Migration toward OpenJDK 8
    11. -
    12. NDK Apps Linking to Platform Libraries
    13. +
    14. Platform Migration toward OpenJDK 8
    15. +
    16. NDK Apps Linking to Platform Libraries
    17. +
    18. Android for Work

    See Also

    1. - M Developer Preview API Overview
    2. + N Developer Preview API Overview
    @@ -52,13 +53,14 @@ page.image=images/cards/card-n-changes_2x.png

    -

    Battery Performance

    +

    Performance Improvements

    The Preview contains system behavior changes aimed at improving the battery - life of devices. These changes can impact the availability of system - resources and system notifications to your app. You should review these - changes and evaluate how your app may need to adjust to them. + life of devices, RAM usage, and app performance. These changes can impact the + availability of system resources and system notifications to your app. You + should review these changes and evaluate how your app may need to adjust to + them.

    Doze

    @@ -72,7 +74,9 @@ page.image=images/cards/card-n-changes_2x.png stationary, for example, when a handset is traveling in a user’s pocket.

    - + +

    Figure 1. Illustration of how Doze applies a first level of system activity restrictions to improve battery life. @@ -81,34 +85,37 @@ page.image=images/cards/card-n-changes_2x.png

    When a device is on battery power, and the screen has been off for a certain time, the device enters Doze and applies the first subset of restrictions: It - shuts off app network access, and defers jobs and syncs. After some more time - elapses, the system applies the rest of the Doze restrictions to {@link - android.os.PowerManager.WakeLock}, {@link android.app.AlarmManager} alarms, - GPS, and Wi-Fi scans.. Regardless of whether some or all Doze restrictions - are being applied, the system wakes the device for brief maintenance windows, - during which applications are allowed network access and can execute any - deferred jobs/syncs. + shuts off app network access, and defers jobs and syncs. If the device is + stationary for a certain time after entering Doze, the system applies the + rest of the Doze restrictions to {@link android.os.PowerManager.WakeLock}, + {@link android.app.AlarmManager} alarms, GPS, and Wi-Fi scans.. Regardless of + whether some or all Doze restrictions are being applied, the system wakes the + device for brief maintenance windows, during which applications are allowed + network access and can execute any deferred jobs/syncs.

    - +

    - Figure 1. Illustration of how Doze applies a second level of - system activity restrictions to further improve battery life. + Figure 2. Illustration of how Doze applies a second level of + system activity restrictions after the device is stationary for a certain time.

    Note that activating the screen on or plugging in the device exits Doze and removes these processing restrictions. The additional behavior does not affect recommendations and best practices in adapting your app to the prior - version of Doze introduced in Android 6.0 (API level 23). You should still + version of Doze introduced in Android 6.0 (API level 23), as discussed in + + Optimizing for Doze and App Standby. You should still follow those recommendations, such as using Google Cloud Messaging (GCM) to - send and receive messages, and start planning updates for the additional Doze - behavior. + send and receive messages, and start planning updates to accomodate the + additional Doze behavior.

    -

    Background Optimizations

    +

    Project Svelte: Background Optimizations

    The Preview removes three implicit broadcasts in order to help optimize both @@ -150,7 +157,8 @@ page.image=images/cards/card-n-changes_2x.png

  2. Apps cannot send or receive {@code NEW_PICTURE} or {@code NEW_VIDEO} - broadcasts. + broadcasts. This optimization affects all apps, not only those + targeting the Preview.
  3. @@ -178,7 +186,7 @@ page.image=images/cards/card-n-changes_2x.png

    -

    Permissions Changes

    +

    Permissions Changes

    The Preview includes changes to permissions that may affect your app, @@ -216,7 +224,7 @@ page.image=images/cards/card-n-changes_2x.png -

    Accessibility Improvements

    +

    Accessibility Improvements

    This Preview includes changes intended to improve the usability of the @@ -227,7 +235,7 @@ page.image=images/cards/card-n-changes_2x.png

    -

    Screen Zoom

    +

    Screen Zoom

    The Preview enables users to set Display sizewhich magnifies @@ -238,13 +246,22 @@ page.image=images/cards/card-n-changes_2x.png sw320dp, which is the width of a Nexus 4, a common medium-sized phone.

    +
    - +
    + +
    +
    + +
    + +

    - Figure 1. The screen on the right shows the effect of + Figure 3. The screen on the right shows the effect of increasing the Display size of a device running an N Preview system image.

    +

    When the device density changes, the system notifies running apps in the following ways: @@ -276,7 +293,7 @@ page.image=images/cards/card-n-changes_2x.png

    -

    Vision Settings in Setup Wizard

    +

    Vision Settings in Setup Wizard

    The Preview includes Vision Settings on the Welcome screen, where users can @@ -337,60 +354,22 @@ java.lang.NoSuchFieldException: No field array in class Ljava/util/ArrayList; -

    Android for Work

    +

    NDK Apps Linking to Platform Libraries

    +

    - The Preview contains changes for apps that target Android for Work, including - changes to certificate installation, password resetting, secondary user - management, and access to device identifiers. If you are building apps for - Android for Work environments, you should review these changes and modify - your app accordingly. + The Preview includes namespace changes to prevent loading of non-public APIs. + If you use the NDK, you should only be using public APIs from the Android + platform. Using non-public APIs in the next official release of Android + can cause your app to crash.

    - - - -

    NDK Apps Linking to Platform Libraries

    -

    - In the Preview, an application built with the NDK and targeting the N Preview - API cannot link against the platform libraries shipped with the NDK. This - change affects both the dlopen(3) and DT_NEEDED entries in your {@code .so} - files. + In order to alert you to use of non-public APIs, apps running on a Preview + device generate an error in logcat output when an app calls a non-public API. + This error is also displayed on the device screen as a message to help + raise awareness of this situation. You should review your app code to + remove use of non-public platform APIs and thoroughly test your apps using + a preview device or emulator.

    @@ -402,6 +381,12 @@ java.lang.NoSuchFieldException: No field array in class Ljava/util/ArrayList; your APK contains all the .so files you intended to link against.

    +

    + Caution: Some third-party libraries may link to non-public + APIs. If your app uses these libraries, your app may crash when running + on the next official release of Android. +

    +

    Apps should not depend on or use native libraries that are not included in the NDK, because they may change, or be removed from one Android release to @@ -457,3 +442,49 @@ JavaVM::AttachCurrentThread from <jni.h>. {@code libcrypto.so} from BoringSSL or OpenSSL in your app. + +

    Android for Work

    +

    + The Preview contains changes for apps that target Android for Work, including + changes to certificate installation, password resetting, secondary user + management, and access to device identifiers. If you are building apps for + Android for Work environments, you should review these changes and modify + your app accordingly. +

    + + diff --git a/docs/html/preview/images/doze-diagram-1.png b/docs/html/preview/images/doze-diagram-1.png new file mode 100644 index 0000000000000..08144479f5592 Binary files /dev/null and b/docs/html/preview/images/doze-diagram-1.png differ diff --git a/docs/html/preview/images/doze-diagram-2.png b/docs/html/preview/images/doze-diagram-2.png new file mode 100644 index 0000000000000..c20c6cb2e3235 Binary files /dev/null and b/docs/html/preview/images/doze-diagram-2.png differ diff --git a/docs/html/preview/images/screen-zoom-1.png b/docs/html/preview/images/screen-zoom-1.png new file mode 100644 index 0000000000000..f62d04e2a1865 Binary files /dev/null and b/docs/html/preview/images/screen-zoom-1.png differ diff --git a/docs/html/preview/images/screen-zoom-2.png b/docs/html/preview/images/screen-zoom-2.png new file mode 100644 index 0000000000000..172b5b3dc3b2d Binary files /dev/null and b/docs/html/preview/images/screen-zoom-2.png differ