Android 12 developer preview - Features and APIs Overview


 

The Android 12 Developer Preview program is running from February 2021 until the final public release to AOSP and OEMs, planned for August timeframe.

update was made regarding an important tool that helps you create great user experiences more easily: Jetpack Compose, toolkit for building native UI. 

Some of the key features from android 12 developer preview are:

Privacy

Security In Android 12 they are continuing to focus on giving users more transparency and control while keeping their devices and data secure and added new controls over identifiers that can be used for tracking, safer defaults for app components, and more. These changes may affect your apps, so they recommend testing as soon as possible. 

Modern SameSite cookie behaviors in WebView -

 In line with changes to Chrome and other browsers, WebView includes new SameSite cookie behaviors to provide additional security and privacy and give users more transparency and control over how cookies can be used across sites.

Restricted Netlink MAC - 

They are helping developers migrate to privacy-protecting resettable identifiers. In a multi-release effort to ease migration of device-scoped Netlink MAC, in Android 11 they have restricted access to it based on API level 30, and in Android 12 they are applying the restriction for all apps - regardless of targetSDK level. 

Safer exporting of components -

To prevent apps from inadvertently exporting activities, services, and receivers, they are changing the default handling of the android:exported attribute to be more explicit. With this change, components that declare one or more intent filters must now explicitly declare an android:exported attribute. You should inspect your components in the manifest in order to avoid installation errors related to this change. 

Safer handling of Intents -

To make handling PendingIntents more secure, Android 12 requires apps to explicitly declare a mutability flag, either FLAG_MUTABLE or the new FLAG_IMMUTABLE, for each PendingIntent.

Better user experience tools

Compatible media transcoding - 

With the prevalence of HEVC hardware encoders on mobile devices, camera apps are increasingly capturing in HEVC format, which offers significant improvements in quality and compression over older codecs. Most apps should support HEVC, but for apps that can’t, they’re introducing compatible media transcoding.

With this feature, an app that doesn’t support HEVC can have the platform automatically transcode the file into AVC, a format that is widely compatible. The transcoding process takes time, depending on the video and hardware properties of the device. As an example, a one minute 1080p video at 30fps takes around 9 seconds to transcode on a Pixel 4. You can opt-in to use the transcoding service by just declaring the media formats that your apps don't support. For developers, they strongly recommend that your apps support HEVC, and if that’s not possible, enable compatible media transcoding. The feature will be active on all devices using HEVC format for video capture. 

AVIF image support - 

To give you higher image quality with more efficient compression, Android 12 introduces platform support for AV1 Image File Format (AVIF). AVIF is a container format for images and sequences of images encoded using AV1. Like other modern image formats, AVIF takes advantage of the intra-frame encoded content from video compression. This dramatically improves image quality for the same file size when compared to older image formats, such as JPEG.

Foreground service optimizations - 

Foreground services are an important way for apps to manage certain types of user-facing tasks, but when overused they can affect performance and even lead to app kills. To ensure a better experience for users, they will be blocking foreground service starts from the background for apps that are targeting the new platform. To make it easier to transition away from this pattern, they’re introducing a new expedited job in JobScheduler that gets elevated process priority, network access, and runs immediately regardless of potheyr constraints like Battery Saver or Doze. For back-compatibility, they’ve also built expedited jobs into the latest release of Jetpack WorkManager library. Also, to reduce distraction for users, they’re now delaying the display of some foreground service notifications by up to 10 seconds. This gives short-lived tasks a chance to complete before their notifications are shown. 

Rich content insertion - 

Users love images, videos and other expressive content, but inserting and moving this content in apps is not always easy. To make it simple for your apps to receive rich content, they’re introducing a new unified API that lets you accept content from any source: clipboard, keyboard, or drag and drop. You can attach a new interface, OnReceiveContentListener, to UI components and get a callback when content is inserted through any mechanism. This callback becomes the single place for your code to handle insertion of all content, from plain and styled text to markup, images, videos, audio files, and more. For back-compatibility, they’ve added the unified API to AndroidX.

Audio-coupled haptic effect -

 In Android 12 apps can provide audio-coupled haptic feedback through the phone's vibrator. The vibration strength and frequency are derived from an audio session, allowing you to create more immersive game and audio experiences. For example, a video calling app could use custom ringtones to identify the caller through haptic feedback, or you could simulate rough terrain in a racing game. 

Multi-channel audio - 

Android 12 includes several enhancements for audio with spatial information. It adds support for MPEG-H playback in passthrough and offload mode, and the audio mixers, resamples and effects have been optimized for up to 24 channels (the previous maximum was 8).

Immersive mode API improvements for gesture navigation -

 They’ve simplified immersive mode so that gesture navigation is easier and more consistent, for example when watching a video, reading a book, or playing a game. They’re still protecting apps from accidental gestures when in full-screen experiences related to gaming, but in all other full-screen or immersive experiences (e.g. video view, reading, photo gallery), for apps targeting the new platform, they’re changing the default to allow users to navigate their phone with one swipe. 

Notification UI updates - 

This feature is refreshing notification designs to make them more modern, easier to use, and more functional. They are also optimizing transitions and animations across the system to make them more smooth. 

Faster, more responsive notifications - 

When users tap a notification, they expect to jump immediately into the app - the faster the better. To meet that expectation, developers should make sure that notification taps trigger Activity starts directly, rather than using “trampolines” - an intermediary broadcast receiver or service - to start the Activity. Notification trampolines can cause significant delays and affect the user experience. To keep notifications responsive, Android 12 will block notification trampolines by preventing them from launching their target Activities, and they are asking developers to migrate away from this pattern. The change applies only to apps targeting the new platform, but for all apps it will display a toast to make trampolines visible to you and to users. 

Improved Binder IPC calls - 

As part of our work on performance, they put a focus on reducing system variability. They’ve taken a look at latency and workload distribution, and made optimizations that reduce the median experience from the tail end, or 99% percentile use case. In doing so, they’ve targeted improvements to system binder calls adding lighttheyight caching strategies and focusing on removing lock contention to improve latency distribution. This has yielded roughly a 2x performance increase on Binder calls overall, with significant improvements in specific calls, for example a 47x improvement in refContentProvider(), 15x in releaseWakeLock(), and 7.9x in JobScheduler.schedule().

App compatibility

They’re working to make updates faster and smoother by prioritizing app compatibility as they roll out new platform versions. In Android 12 they’ve made most app-facing changes opt-in to give you more time, and they’ve updated our tools and processes to help you get ready sooner. They’ve also added new functionality to Google Play system updates to give your apps a better environment on Android 12 devices.

Easier testing and debugging of changes - 

To make it easier for you to test the opt-in changes that can affect your app, they’ve made many of them toggleable. With the toggles you can force-enable or disable the changes individually from Developer options or adb. 

Comments

Popular posts from this blog

Ktor for Mobile Developers: Is it Easy to Learn Server Side Coding? Part-1

Ktor for Mobile Developers: Is it Easy to Learn Server Side Coding? Part-2