Google Releases Android P Developer Preview

Google has released the first developer preview of Android P, the next iteration of the company’s mobile operating system scheduled to be released this year. Developer previews are meant to disclose low-level changes to the OS and APIs, and allow for application developers to test and give feedback on new features before they are frozen in the final release.

Android P follows last year’s Android (O)reo 8.0. The first developer preview introduces several key features planned for the P release:

Indoor Positioning with WiFi RTT

Android P introduces public APIs for 802.11mc, or ‘Round-Trip-Time’. RTT enables devices to measure the time between a smartphone sending a data-packet and ACK to the access point and back. Having 3 or more APs in distance means the device can triangulate its relative position and enable finer-grained indoor location positioning.

There is a hardware prerequisite as both the smartphone’s WiFi chipset as well as the APs need to support the 802.11mc standard with fine-grained timing capabilities.

Notches For Everybody

Having seen an explosion of vendors following Apple iPhone X’s notch, Google has seen the need from vendors to introduce OS level support for display cutouts. The biggest change in behaviour from previous Android variants to Android P is that the new default behaviour for the OS is to adapt to the notch height and use that section solely for the notification bar, which in general should mean that the notification bar in most implementations will get thicker. For applications that want to use the full screen and include content in the ears of the cutout, they will have to implement the new DisplayCutout APIs.

In general this is a good move on Google’s side as it effectively avoids compatibility issues between applications and device notches by simply ignoring the notches, with the burden of notch integration falling onto application developers. We saw several phones at Mobile World Congress this year implementing a notch, although running very early software that was not optimized for it.

New Notification Styles and Quick Settings

Android P changes the quick settings UI into a more rounded and less industrial look, with the introduction of circled icon backgrounds for the quick setting buttons. The notification section is also no longer separated by an accentuated different background colour, but simply a divider forming the quick settings and notification area into two sections. It’s odd to see Google move to ever more white UI designs as we have more and more OLED devices released.

A new MessagingStyle notification type allows messaging applications to show more context within a chat conversation such as the last several messages, as well as the ability for applications to show ‘rich’ content such as images and stickers.

Multi-Camera Support

P now includes support for multiple concurrent streams from devices which have more than one camera sensor. The API exposes the relative differences between the two camera sensors so that an application is able to correctly do processing. Google is being very liberal in terms of what’s actually possible here, and the onus of creating use-cases will fall onto developers. I’m wondering how such use-cases will be accelerated as processing on the live camera streams will require a lot of power, especially for video-use.

An interesting addition is that now OIS adjustments will now be exposed via the API, and will show a precise timestamp of each adjustment as well as a coordinate map. This will provide detail for each pixel on the direction and offset of each adjustment, which should allow for some interesting use-cases if applications make use of it.

New Image Decoding Handling in Applications

Android’s handling of decoding images onto drawables was relatively inefficient, as simply drawing a JPEG onto the screen involved decoding it onto a bitmap and then drawing it on a canvas. The problem here was the transformation onto a bitmap vastly bloats application memory size. The new ImageDecoder class allows for resources to be directly decoded into graphics memory which makes it a lot more efficient and avoids a whole copy of the image buffer.

The new ImageDecoder also allows for support for much easier resizing and post-processing handling, and now also introduces support for animated image formats such as GIFs and WebP with animation fully handled by the API and separate from the application UI thread.

New VP9 HDR support, Google Promoting HEIF Image Compression?

As part of support of new media formats, HDR VP9 Profile 2 is now supported, which allows HDR playback from YouTube and other applications that support it.

The biggest surprise here is the announcement of Google’s adoption and endorsement of HEIF, which follows Apple’s adoption late last year. HEIF is based off HEIC, which itself is simply still images encoded through the same mechanisms as the HEVC video codec. With both Apple and Google now endorsing the new codec for mobile, and Google endorsing for backends to serve HEIF images, we might (Many standards have tried before) finally a shift away from the 25 year old JPEG standard.

JobScheduler Now Aware of Network Conditions

The new JobScheduler is now able to poll the network status provided by the carrier and differentiates between congested and unmetered networks. Applications can now declare their estimated data size for a workload, for example: an app fetching images should know how big an image is. Applications fetching news stories also can estimate roughly how big that would be – while other jobs such as email fetching can vary highly and should not declare any data size. The goal here is ultimately better network traffic management and large data traffic jobs should be delayed when on un-congested or unmetered networks (such as WiFi).

NN API 1.1

The Neural Networks API introduced in Android 8.1 has been updated to support new NN operations for developers to make use of. The Pixel 2 devices will now for the first time be able to make use of the Qualcomm Hexagon DSP for acceleration of 8-bit quantized models using the NN API.

Additions to the Android core

Focus on Security

A user-facing change in regards to the UI is the standardization of the fingerprint system dialog. The new API allows apps for a unified way to call for fingerprint reading, and adapts the dialog and prompt based on the device’s fingerprint sensor location. Google recommends developers switch to the new method as soon as possible.

Android P now gives developers the ability to use a Protected Confirmation API, which should be used for approval of short statements such as sensitive transactions or making payments.

If the user accepts the statement, your app receives a cryptographic signature that’s protected by a keyed-hash message authentication code (HMAC). The signature is produced by the trusted execution environment (TEE), which protects the display of the confirmation dialog as well as user input. The signature indicates, with very high confidence, that the user has seen the statement and has agreed to it.

Hard API Requirement for Apps by November 2018

The biggest shift that we’ll see this year from Google is that the Play Store will not accept new applications (August 2018) and updates to existing applications (November 2018) that do not target the newest API levels. This effectively will mean for the first time a new hard requirement for developers to shift to new APIs. The reasoning for Google here is two-way, first this ensures security related updates will be included into applications, and secondly, it ensures 64-bit packages for the future. This hard API requirement will be incremented every year starting with Android P.

The Play store, from August 2019 on, will require all new apps and updates to include 64-bit variants. I think the goal here for Google is the preparation of the whole ecosystem towards a shift where we’ll see AArch64 only CPUs which should bring with them performance, efficiency, and cost benefits.

Available for Pixel Phones Now

The Android P preview is the first preview that is solely available for Pixel smartphones and no longer supports Nexus devices, marking an end of an era in a sense. Google has made available manually flashable system images for the Pixel, Pixel XL, Pixel 2 and Pixel 2 XL.

As in years before, the roadmap for Android P looks similar with several previews planned. The first two milestones include early testing and development before we’ll see APIs being finalised in DP3 in June, with two further release candidates working towards a Q3 final release.

Original Article