UI and UX improvements
The new preview introduces a bunch of UI improvements, like the DisplayCutout feature. It allows the programmers to find non-functional areas on the screen and handle them properly. From now on, you will be able to locate an area, determine its shape, and decompose your app's UI elements to lay out the content around it. For easier management of the elements around dead areas, the Preview introduces a new layout parameter - layoutInDisplayCutoutMode with a set of attributes. The preview also provides a new developer feature that allows you to simulate the cutout areas on your device or emulator. This feature is provided to improve applications running on devices with screen design similar to the notch from iPhone X.
The second thing related to UI improvements is a set of notification enhancements. Developers now have new tools to improve notifications related to messaging. You can identify participants of the conversation better thanks to the Notification.Person class. P also introduces support of images, smart replays, and retrieving message drafts from the notification input. Also, the new preview provides new tools for managing notification channels. The main changes are included in the NotificationManager.Policy for the Do not disturb mode.
The third feature related to UI is a new class called AnimatedImageDrawable. The class is responsible for rendering animated images based on the GIF and WebP formats. AnimatedImageDrawable uses RenderThread to animate the images, so it should not affect the performance of your app's UI. It also uses a worker thread for decoding images to keep all tasks away from the UI thread. The new API also introduces a new approach for decoding images such as Drawables and Bitmaps. This new approach was introduced in the tool called ImageDecoder, which should replace classes like BitmapFactory or ImageDecoder. Apart from typical features, like creating images, decoding or resizing, you can now crop images or use complicated effects like rounding corners, or set a circle mask - even for animated drawables.
New media features
Android P also adds new features and tools which make handling media inside apps much better. The first feature is MediaPlayer2 for displaying video and audio. Thanks to the DataSourceDesc, MediaPlayer2 supports playlists. Android P also introduces a new HDR profile - High Dynamic Range (HDR) VP9 Profile 2. This new profile allows apps to deliver HDR-enabled movies. From now on you can also use media metrics from the AudioTrack, AudioRecord and MediaDrm classes.
Android P introduces multi-camera support as well. It means that developers can now access streams from two cameras simultaneously. It is possible thanks to a camera device which is a logical representation of the two or more physical cameras. You can also reduce delays during initial capture, and surface sharing thanks to the SessionConfiguration class. Android P also introduces support for external cameras (via USB).
RTT API and indoor navigation
The most interesting update that has been introduced in the latest Android developer preview is the RTT API - it allows users to navigate inside buildings. Android P supports new 802.11mc Wi-Fi standard , aka Wi-Fi RTT (Round Trip Time). Thanks the standard we are now able to navigate inside buildings. Navigation is estimated using the delays of the packets between the nearest access point that supports RTT Wi-Fi and the Android P device. Thanks to this technology, you can get navigation that is accurate up to 1 metre. Android P provides dedicated RTT APIs that allow you to use indoor navigation in your app. This feature looks really promising, especially when combined with AR. Unfortunately, because of the low adoption of 802.11mc, we need to wait until this feature becomes more popular.
In every new Android release, the most important issues are security updates. Android P introduces a few features that allow developers to increase security. The first of the described ones is a unified fingerprint authentication dialog represented by the class called FingerprintDialog. You can now use a dialog with a unified look that improves the user’s experience and gains the user’s trust. Taking advantage of this requires you to show a ConfirmationDialog, which was designed to display a short statement to the user. You can display this dialog to the user to confirm a sensitive action (e.g. a payment transaction) and get a hash-based cryptographic signature of the statement. The signature is, for sure, produced using the KeyStore API and the Trusted Execution Environment.
New implementation of hardware-backed keystore
Android P introduces a completely new implementation of the Keymaster HAL module, which is responsible for providing hardware-backed functions for Android Keystore. The new implementation of the Keymaster HAL is called StrongBox Keymaster, and it improves the most crucial features related to Android cryptography. Strongbox Keymaster is a module that allows the implementation of a dedicated CPU, key storage, and a random number generator.
The new implementation of the Keymaster introduces a set of cryptographic standards to meet the requirements of the low-power StrongBox. The set contains the following algorithms with their corresponding key lengths:
- RSA - 2048
- AES - 128 and 256
- ECDSA - P-256
- HMAC-SHA256 - 8B - 64B, inclusive
- Triple DES - 168
Secure key wrapper
Android P provides us with a new wrapper for secret keys. It offers additional security features that can protect encryption keys from plaintext handling in the memory. Now, you can import keys into the keystore in which they will be wrapped into a safe ASN.1 format as an additional protection.
The last of the most interesting security features is client-side encrypted backup. You can now use app data backup with additional encryption on the client side based on the user’s password.
Android P is coming
These are only some of the most interesting features of the first preview of Android P. If you are looking for more information, check out the Google Developers Preview page. You can now download Android P for your emulators, or download the image of the new OS for you Pixel. If you want to know how to get the new Android, read here. The new features of Android 9 look promising, but so far we have to settle for the preview version. The official presentation of Android P will take place during the Google I/O 2018 conference between May 8 and 10.