<CarlosDev/>

Current

Android 7.0 Nougat: two apps on one screen

API 24, August 2016. Split-screen multi-window, Doze in a moving pocket, file-based encryption with Direct Boot, and apps that stop trusting user-added CAs by default.

Published
Reading
16 min
Write-up
Stable
Series
Part 6 of 19 · Android, version by version
Android 7.0 Nougat banner, with the version logo.
In this record12 sections

Android 7.0 Nougat is the release that put two apps on one phone screen. Users got split-screen multi-window, replies typed straight into a notification, and Doze that also works while the phone moves in a pocket. Developers got file-based encryption with Direct Boot, a declarative network security config, and a crash for apps that still share file:// URIs.

The Android 7.0 home screen: a Google search bar at the top, a pink and purple wallpaper with a mountain silhouette, app icons for Google, Create, Play and Play Store, and a dock with Phone, Messages, the app drawer, Chrome and Camera above the back, home and recents buttons
The Android 7.0 home screen with the default Nougat wallpaper. Wikimedia Commons · Apache License 2.0

At a glance

VersionAndroid 7.0
API level24
NameNougat, public
Build.VERSION_CODESN
Final APIs and SDK15 June 2016
ReleaseNexus rollout began 22 August 2016
Launch deviceLG V20, the first new phone to ship with Nougat
Google Play target-API deadlineNone. Play’s target-API rule started in 2018, at API 26

Google declared the N APIs final on 15 June 2016 and told developers they could publish updates that compile against, and optionally target, API 24. On 22 August Dave Burke announced the rollout “starting with Nexus devices”: over several weeks to the Nexus 6, 5X, 6P, 9, Nexus Player, Pixel C and General Mobile 4G (Android One). The source went to AOSP the same day, and Ars Technica published its review.

The first developer preview came out on 9 March 2016. Burke called it “early… really early”, and the new Android Beta Program delivered it over the air to the same Nexus devices and the Pixel C. Its five developer previews, from March to July, follow this overview as parts, from Developer Preview 1 to Developer Preview 5. At launch he also moved Nougat to “a new regular maintenance schedule over the coming quarters”. Phones built on Qualcomm’s Snapdragon 800 and 801, which powered most flagships from late 2013 to late 2014, were left out: Ars Technica found an official Nougat update for them “very difficult if not completely impossible”.

What it brought

  • Multi-window. Two apps run side by side or one above the other on phones and tablets. Ars Technica describes the gesture: long-press the Recents button, then pick the second app. Android TV got picture-in-picture, and users can drag and drop content between the two apps.
  • Notifications. Direct Reply puts a text field inside the notification. Bundled notifications group several alerts from one app. MessagingStyle lays out conversations. A long press on a notification opens its controls.
  • Doze on the go. Doze, added in Android 6.0 Marshmallow, now works in two levels. The first applies whenever the screen is off and the phone is unplugged, even in a pocket.
stationary for a while screen on or plugged in screen on or plugged in Screen off, unplugged First level: no network, jobs and syncs deferred Second level: wake locks, alarms, GPS and Wi-Fi scans held too Back to normal
  • Profile-guided JIT/AOT. ART gained a JIT compiler that profiles the hot methods of each app. It compiles them ahead of time only when the device is idle and charging. Google says large apps that took minutes to optimize on 6.0 now install “in just a matter of seconds”.
  • Vulkan. The low-overhead 3D API is in the NDK, on hardware that supports it. The CDD makes every device ship a libvulkan.so; one without Vulkan reports zero devices from vkEnumeratePhysicalDevices.
  • Data Saver. A user switch that blocks background data on metered networks. Apps read it with ConnectivityManager.getRestrictBackgroundStatus() and watch for ACTION_RESTRICT_BACKGROUND_CHANGED.
  • Quick Settings tile API. Apps add tiles through TileService and the Tile class. Users can rearrange the tiles.
  • Display size. Users scale the whole interface, not only the text, down to a minimum width of sw320dp.
  • OpenJDK and Java 8. The core java.* libraries now come from OpenJDK instead of Apache Harmony. AOSP’s libcore at android-7.0.0_r1 has an ojluni tree that 6.0.1 lacks. With the Jack toolchain, lambdas work back to Gingerbread; default and static interface methods and streams need API 24.
  • Emoji. Nougat supports Unicode 9, 72 new emoji by Ars Technica’s count, and is the first version with skin tone modifiers. Apps check that a glyph exists with Paint.hasGlyph() before inserting it; keyboards should offer the skin tones.
  • Smaller additions. Multi-locale settings with LocaleList, a subset of ICU4J under android.icu, number blocking (BlockedNumberContract), call screening (CallScreeningService), OpenGL ES 3.2, VR mode, the keyboard shortcuts helper, custom pointer icons, the Frame Metrics API, and Chrome as the WebView provider.

Security and privacy

  • File-based encryption. Files are encrypted one by one instead of as a single block device, which isolates each user and profile better. The 7.0 CDD says devices “SHOULD” meet the encryption requirement with FBE.
  • Direct Boot. Built on FBE. After a reboot the phone reaches the lock screen, and alarm clocks, messages and accessibility services marked android:directBootAware run before the user unlocks. They see only device-encrypted storage; credential-encrypted storage opens after unlock.
  • Strict Verified Boot. Android 7.0 strictly enforces Verified Boot, so a compromised device does not boot. It also corrects accidental data corruption.
  • Seamless updates. On select new devices, two copies of the system partitions (slots A and B) let an update install in the background. If the new slot fails to boot, the device falls back to the old one. Ars Technica notes it only works on devices that launch with 7.0 or later.
  • Media stack split. After Stagefright, mediaserver was broken up. Parsing in libstagefright runs in a mediacodec sandbox with very few permissions. Camera access lives only in cameraserver, and Bluetooth only in audioserver. Integer overflow checks cover the whole media stack.
  • Trusted CAs. Apps targeting API 24 trust only the system CA store. Certificates installed by the user or by a device admin are ignored unless the app opts in. Every compatible device ships the same AOSP CA set.
  • Network security config. An XML file, referenced by android:networkSecurityConfig, sets trust anchors per domain, cleartext rules, certificate pins, and debug-only overrides.
  • Smaller changes. APK Signature Scheme v2 signs the whole file and verifies faster. Key attestation proves a key lives in hardware. Seccomp became a CDD requirement, the kernel got read-only memory and restricted access to userspace, and library load order is randomized.

Permissions

No new dangerous permissions arrived. The changes are about files and scoped access.

  • Added. BIND_QUICK_SETTINGS_TILE, BIND_SCREENING_SERVICE, BIND_VR_LISTENER_SERVICE and BIND_CONDITION_PROVIDER_SERVICE. They guard services that the system binds to.
  • Removed. FLASHLIGHT left the SDK.
  • Scoped directory access. StorageVolume.createAccessIntent() asks for one folder, such as Pictures, instead of all of READ_EXTERNAL_STORAGE. The user allows or denies it in a dialog.
  • Private files. For apps targeting API 24, the private data directory is 0700. MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE throw a SecurityException. See the next section for what to do.
  • Blocked numbers. Only the default phone app, the default SMS app and carrier apps can read or write the blocked list.
  • Method tracing. Debug.startMethodTracing() writes to the app’s own directory on shared storage, so it no longer needs WRITE_EXTERNAL_STORAGE.
  • Backup. Android Backup now covers runtime permission grants, according to Google’s Nougat feature list.

What changed for your app

All apps on Android 7.0

ChangeWhat to do
Doze’s first level applies while the phone movesFollow the 6.0 Doze guidance; use Firebase Cloud Messaging for messages
Camera.ACTION_NEW_PICTURE and ACTION_NEW_VIDEO are goneWatch media with a JobScheduler job and JobInfo.Builder.addTriggerContentUri()
Private NDK libraries outside a short list fail to loadUse public NDK APIs or bundle your own copy
libcutils, libcrypto, libssl, libandroid_runtimeAllowed with a warning only if you target 23 or lower; bundle them now
Display size kills background apps targeting 23 or lowerRestore state cleanly when relaunched from Recents
RC4 cipher suites are disabledEnable TLS 1.2, AES-GCM and ECDHE on the server
Writing to a TCP socket on the main thread throwsMove network work off the main thread
Annotation visibility is enforcedAdd @Retention(RetentionPolicy.RUNTIME) to annotations read at runtime
Apps targeting 23 or lower in split-screenResizable apps are forced to resize with a warning; fixed-orientation apps stay full screen

Apps targeting API 24

ChangeWhat to do
file:// URIs leaving the app throw FileUriExposedExceptionShare a content:// URI from FileProvider with a temporary grant
CONNECTIVITY_ACTION no longer reaches manifest receiversRegister at runtime with registerReceiver(), or schedule the work with JobScheduler
User-added CAs are not trustedOpt in through a network security config, or use debug-overrides for a debugging proxy
Private directory is 0700; MODE_WORLD_* throwsShare files through FileProvider
DownloadManager.COLUMN_LOCAL_FILENAME throws SecurityExceptionOpen the download with ContentResolver.openFileDescriptor()
Private libraries on the temporary list fail tooBundle them or move to NDK APIs
Activities are resizable by defaultTest in split-screen, or set android:resizeableActivity="false"
The Crypto provider and SHA1PRNG are goneDerive keys with a real key derivation function
TransactionTooLargeException is rethrown as RuntimeExceptionKeep onSaveInstanceState() small
Default serialVersionUID changed for some classesDeclare serialVersionUID explicitly
file:// content:// from FileProvider Send a photo to another app Which URI? FileUriExposedException Intent with FLAG_GRANT_READ_URI_PERMISSION The other app reads it

What lasted

  • Multi-window grew: Android 8.0 brought picture-in-picture to phones, and Android 10 keeps every visible activity resumed, where 7.0 resumed only the one last touched.
  • Background limits tightened in Android 8.0. Apps targeting API 26 can no longer declare manifest receivers for most implicit broadcasts.
  • Network security config is still the place for trust rules. From Android 9, apps that target API 28 block cleartext traffic by default.
  • File-based encryption became mandatory for devices launching with Android 10. It could not be combined with adoptable storage on 7.0 to 8.1.
  • A/B updates got streaming in Android 8.0, and Virtual A/B replaced the original layout in Android 10.
  • Jack did not last either. In March 2017 Google deprecated it and moved Java 8 language support into the standard javac and dx tools.
  • Scoped directory access did not last. createAccessIntent() was deprecated in API 29 and returns RESULT_CANCELED on Android 10.

Worth knowing

  • The N constant in AOSP carries the comment N is for ¯\_(ツ)_/¯.
  • Inside Google, N was “New York Cheesecake”, Android Police reported in March 2016. AOSP history at the 7.0 tag shows the initials in branch names such as nyc-dev and nyc-release.
  • Google asked the public for names on android.com under #NameAndroidN, with entries closing on 8 June 2016. It was a call for suggestions, not a vote. Google kept the final choice and revealed Nougat on 30 June 2016.
  • The Easter egg is Android Neko, a cat collector. Tap “Android version” in Settings three times quickly, tap the logo five times, then long-press it. A toast shows a cat: a hidden Quick Settings tile is now enabled.
  • The tile fills a dish with Bits, Fish, Chicken or a Treat. A JobScheduler job then runs in 15, 30, 60 or 120 minutes, and a notification says “A cat is here.” Better food makes a new cat likelier than a returning one: 5% for Bits, 90% for a Treat.

Part 1 of 5

2 min

Android N Developer Preview 1: early on purpose

9 March 2016. The first Android N build shipped months earlier than usual, with multi-window, Direct Reply and bundled notifications, and the new Android Beta Program.

Read on its own: Android N Developer Preview 1: early on purpose

Google released the first Android N Developer Preview on 9 March 2016, two months before Google I/O, where earlier previews had debuted. Dave Burke gave the reason: an earlier build leaves more time for developer feedback and lets Google hand the final release to device makers in the summer.

Release date9 March 2016
BuildsNPC56P, NPC56R; updated later to NPC56W, NPC56X
DevicesNexus 6, 5X, 6P, 9, Nexus Player, Pixel C, General Mobile 4G (Android One), and the SDK emulator
StatusDevelopers only; not CTS approved, so apps that check for it (Android Pay) did not run

The same day Google opened the Android Beta Program at g.co/androidbeta. Enrolling a supported device installed the preview over the air and kept it updated, with no manual flashing.

What the first preview opened up

  • Multi-window. Apps targeting N set android:resizableActivity to run in split screen. A resize behaves like a rotation: the activity handles the configuration change or is recreated. TV apps get picture-in-picture with android:supportsPictureInPicture.
  • Notifications. The RemoteInput API from Android Wear now works on phones and tablets, so users reply from the shade. Notification.Builder.setGroup() bundles an app’s notifications.
  • Doze now also saves battery whenever the screen is off, not only when the device is still. JobScheduler can react to content provider changes.
  • Java 8. The Jack compiler brings lambdas to Android back to Gingerbread; default and static interface methods and streams need N.
  • JIT compiler. Google’s I/O post later named the new JIT compiler as a first-preview change: faster installs and less storage than compiling everything ahead of time.

Google’s release notes called the build unfit for daily use: slow at times, with worse battery life and some apps, Google’s included, not working.

Part 2 of 5

1 min

Android N Developer Preview 2: Vulkan arrives

13 April 2016. The second preview made Vulkan part of the platform, added launcher shortcuts and Unicode 9 emoji, and fixed bugs developers reported against the first.

Read on its own: Android N Developer Preview 2: Vulkan arrives

Developer Preview 2 came out on 13 April 2016, builds NPC91K and NPC91O, for the same devices as the first; the Nexus Player followed several days later. Devices in the Android Beta Program got it over the air. It still required Android Studio 2.1 and was still not meant for daily use.

What Developer Preview 2 added

  • Vulkan became part of the platform: a low-overhead 3D API that Google helped develop at Khronos. Google said some synthetic benchmarks reached up to 10 times the single-core draw-call throughput of OpenGL ES.
  • Launcher shortcuts. ShortcutManager.setDynamicShortcuts() and addDynamicShortcut() let an app publish intents into specific screens. This API did not survive: see Developer Preview 3 and 4.
  • Emoji. Unicode 9 glyphs, skin tones and a new human-looking design for people emoji. Apps check for a glyph with Paint.hasGlyph().
  • Multi-window gained a separate minimum height and minimum width for an activity, and several of its API names changed.

It also fixed bugs developers had filed against Preview 1, among them hidden Wi-Fi networks that would not connect (AOSP 203116), YouTube pausing when multi-window focus changed (203424) and Direct Reply closing an open activity (204411).

Part 3 of 5

1 min

Android N Developer Preview 3: beta quality

18 May 2016, at Google I/O. Google's first beta-quality N build, fit for a primary phone, added VR Mode and FrameMetrics and deferred launcher shortcuts.

Read on its own: Android N Developer Preview 3: beta quality

Google announced Developer Preview 3 at Google I/O on 18 May 2016 as “our first beta-quality candidate, available to test on your primary phone or tablet”. Build NPD35K was CTS approved on the Nexus 5X, 6, 6P and Pixel C, so apps that require it, such as Android Pay, worked. It reached every supported device plus the Sony Xperia Z3 (D6603 and D6653).

What Developer Preview 3 added

  • VR Mode: an exclusive CPU core for VR apps, head tracking, stereo notifications and low-latency graphics. Google measured motion-to-photon latency under 20 ms on a Nexus 6P.
  • Sustained performance mode: device hints for apps that run for a long time at a steady level. Testable only on the Nexus 6P in this preview.
  • FrameMetrics API: a listener that streams frame timing for the app’s window, so UI performance can be measured in production without USB.
  • Keyboard Shortcuts helper: Meta+/ lists system and app shortcuts.
  • Multiprocess WebView behind a developer option, running web content in a separate sandboxed process from WebView 51.

Behaviour changes in Developer Preview 3

  • Launcher shortcuts deferred. Google pulled the feature from N and said ShortcutManager would leave the public API in the next preview.
  • WebView, for apps targeting N: the JavaScript context resets on each new page load, and geolocation works only on secure (HTTPS) origins.
  • Data Saver: apps can open a system dialog that adds them to the Data Saver exemption list.
  • Number blocking by an unauthorized caller now throws SecurityException instead of UnsupportedOperationException.
  • Quick Settings tiles take their mode from the TileService.META_DATA_ACTIVE_TILE metadata instead of the return value of onTileAdded().

Part 4 of 5

1 min

Android N Developer Preview 4: final APIs

15 June 2016. API level 24 became final with the N SDK, apps could ship to Google Play, and launcher shortcuts left the public API.

Read on its own: Android N Developer Preview 4: final APIs

Developer Preview 4, build NPD56N, shipped on 15 June 2016 with the final Android N SDK. Every API was final and the API level was 24. From that day developers could publish apps compiled against, and optionally targeting, API 24 to the alpha, beta and production channels in Google Play. It needed Android Studio 2.1.2 or later, and Support Library 24.0.0 brought the multi-window, notification and Direct Boot APIs to older versions.

What Developer Preview 4 changed

  • Launcher shortcuts removed. As announced with Preview 3, the ShortcutManager APIs were gone from the public API.
  • Multi-window attributes renamed: android:minimalHeight and android:minimalWidth became android:minHeight and android:minWidth.
  • Bluetooth LE scanning: an app that starts and stops scans more than five times in 30 seconds is blocked, and long-running scans become opportunistic.
  • Locale resources are negotiated for each resource object, instead of the app starting with all its locale resources loaded.

CTS approval covered the Nexus 5X, 6, 6P and Pixel C. The preview reached every supported device, including the Sony Xperia Z3.

Part 5 of 5

1 min

Android N Developer Preview 5: near-final

18 July 2016. The last preview, now called Android 7.0 Nougat, shipped near-final system images so developers could finish testing before the August rollout.

Read on its own: Android N Developer Preview 5: near-final

Developer Preview 5, build NPD90G, came out on 18 July 2016, “the last milestone of this preview series”. It is the first preview Google’s blog announced under the name Android 7.0 Nougat. It added no APIs: those had been final since Preview 4. It brought near-final system images and an emulator for final testing, plus bug fixes in the system and preinstalled apps.

CTS approval now included the Nexus 9, besides the 5X, 6, 6P and Pixel C. Google’s release notes list the Nexus 5X, 6, 6P, 9, Nexus Player, Pixel C and General Mobile 4G; the Sony Xperia Z3, which had Previews 3 and 4, is not on the list. Google asked developers to test the Nougat behaviour changes (Doze on the go, background optimizations, screen zoom, permissions) and publish their API 24 updates. The public rollout began five weeks later, on 22 August.

Filed under

Citations

49

External references