Android Developers Blog
The latest Android and Google Play news for app and game developers.
🔍
Platform Android Studio Google Play Jetpack Kotlin Docs News

21 abril 2021

Android 12 Developer Preview 3


Link copied to clipboard

Posted by Dave Burke, VP of Engineering

Android 12 logo

Google I/O 2021 is just a few weeks away and we’re looking forward to sharing all of the latest news in Android with you soon! To take us one step closer, today we’re sharing Developer Preview 3, the next milestone release of Android 12, for your testing and feedback.

In Android 12 we’re continuing to focus on making the OS smarter, easier to use, and better performing, with privacy and security at the core. We’re also working to give you new tools for building great experiences for users on phones, laptops, tablets, TVs, or cars. Some things to check out in today’s release include a new app launch experience, new video and camera capabilities to help you get more out of underlying hardware support, and a new permission for exact alarms to help users save battery.

Read on for more highlights and visit the Android 12 developer site for details and downloads for Pixel. If you’re already running a Developer Preview 2 build, watch for an over-the-air (OTA) update coming to you soon! As always, let us know what you think, and thanks for all of the feedback you’ve shared so far.

Better user experience tools

Today’s release includes new tools to help you deliver a polished experience and better performance for users. Here are some of the updates.

Improved app launch experience - In Android 12 we’re making app startup a more consistent and delightful experience. We’ve added a new app launch animation for all apps from the point of launch, a splash screen showing the app icon, and a transition to the app itself. The new experience brings standard design elements to every app launch, but we’ve also made it customizable so apps can maintain their unique branding. For example, you can use new splashscreen APIs and resources to manage the splash screen window’s background color; you can replace the static launcher icon with a custom icon or an animation; you can set light mode or dark mode; and you can control the timing to reveal the app in the exit animation.

There’s nothing you need to do to take advantage of the new experience - it’s enabled by default for all apps. We recommend testing your app with the new experience soon, especially if you’re already using a splash screen. To customize the experience, check out the new APIs and let us know what you think. More here.

New call notification template - Incoming and ongoing calls are important to users and they need to be easy to see and manage. In Android 12 we’re improving call notifications to give them more visibility and scannability, and improve their consistency with other notification components. If your app handles calls - such as a dialer app or chat app with video calling - you’ll want to try our new CallStyle template. You can use the template to create notifications for incoming, outgoing, and screened calls. Each type supports multiple actions, including default actions and custom actions that are specific to your app. You can also attach a large avatar image, provide text, and set button color hints. The OS gives CallStyle notifications high visibility, such as bringing them to the top of the notifications shade. More here.

New permission for exact alarms - Alarms are an important way for apps to schedule work. In most cases, apps should use inexact alarms, which have the advantage of being battery-friendly. Android manages these alarms to minimize wakeups and battery impacts, such as through Doze and App Standby. For cases where you need alarms with precise timing - for example alarm clocks and timers - you can use exact alarms instead. These are convenient and reliable, but they can also cause battery drain, especially when overused. So in Android 12, we’re making some changes to give users more control.

Apps targeting Android 12 that want to use exact alarms will now need to request a new permission, SCHEDULE_EXACT_ALARM. It’s a normal permission, so once you’ve declared it in your manifest, you’ll be automatically granted it at first startup. However, we’re also giving users visibility over the apps that have this permission and letting them grant and revoke it from Special App Access Permissions in Settings. If your app requires exact alarms, make sure you handle cases where it no longer has the permission. We’ve added a new API, canScheduleExactAlarms(), to let you check the permission status for your app. In general, we recommend migrating your apps away from uses of exact alarms wherever possible. More here.

Improved web linking - In Android 12 we’re making some changes to help users get to their content faster and more seamlessly. First, we’ve changed the default handling of links that aren’t verified through Android App Links or manually approved for links by the user. Now the OS will directly open them in the default browser, rather than showing a chooser dialog. To make it easier for users to approve your app for links, we’ve added a new Intent that takes them to “Open by default” in Settings. If you want to ensure that only your app can handle links from your domain, you can use App Links. We’ve added new adb commands to help you configure and test your links. More here.

Rich haptic experiences - We’re expanding the tools we offer for creating informative haptic feedback for UI events, immersive and delightful effects for gaming, and attentional haptics for productivity. We’ve added expressive effects like low tick that take advantage of the broader frequency bandwidth of the latest actuators. Game developers can now access multiple, different actuators independently in game controllers to deliver the same effect synchronously or different haptic effects on multiple actuators. For developers, we recommend using the constants and primitives as building blocks for rich haptic effects - constants to enhance UI events and haptic composer to sequence primitives for more complex effects. You can try these APIs to the fullest on Pixel 4 devices today, and we’re continuing to work with our device-maker partners to bring the latest in haptics support to users across the ecosystem.

Video encoding improvements - Android 12 standardizes the set of keys for controlling the range of the video Quantization Parameters (QP), allowing developers to avoid vendor-specific code. The new keys are available in the MediaFormat API and also in the NDK Media library. Video encoders must specify a minimum video quality threshold to ensure that users don't experience extremely low quality when videos are complex.

Camera2 vendor extensions - Many of our device manufacturer partners have built custom camera effects—such as bokeh, HDR, night mode, and others—that they want apps to use to create differentiated experiences on their devices. We’ve already supported these custom effects through a set of vendor extensions in our CameraX library, and now in Android 12 we’re exposing the vendor extensions directly in the platform as well. This helps apps that have complex Camera2 implementations to take advantage of the extensions without having to make significant changes to legacy code. The extension APIs expose exactly the same set of effects as in CameraX, and those are already supported on many different devices, so you can use them right out of the box. More here.

Quad bayer camera sensor support - Many Android devices today ship with ultra high-resolution camera sensors, typically with Quad / Nona Bayer patterns, and these offer great flexibility in terms of image quality and low-light performance. In Android 12, we’re introducing new platform APIs that let third-party apps take full advantage of these versatile sensors. The new APIs support the unique behavior of these sensors and take into account that they might support different stream configurations and combinations when operating in full resolution or ‘maximum resolution’ mode vs ‘default’ mode.

Faster machine learning - In Android 12, we invested in key areas so that developers can make the most of ML accelerators and always get the best possible performance through the Neural Networks API. In terms of performance improvements - we have more than halved inference call overhead by introducing improvements such as padding, sync fences and reusable execution objects. We’ve also made ML accelerator drivers updatable outside of platform releases, through Google Play services. This will make it easier for developers to take advantage of the latest drivers on any compatible device, and make sure that ML performance improvements and bug fixes reach users faster than ever before.

Standardizing GPU compute - We are deprecating the RenderScript APIs in favor of cross-platform GPU compute solutions such as Vulkan and OpenGL. We want you to have confidence that your high-performance workloads will run on GPU hardware, and many devices are already shipping with only CPU support for RenderScript. The existing APIs will continue to work for the time-being, and we've open-sourced a library for RenderScript intrinsics such as blur that uses the highly-optimized intrinsics platform code. Samples and a migration guide for using Vulkan to implement image processing are also available. More here.

Better debugging for native crashes - You've told us that debugging NDK-related crashes can be challenging. We’re making this easier in Android 12 by giving you more actionable diagnostics. In the platform, we use crash dump files called tombstones to debug our native crashes, and they contain the information required to diagnose a variety of issues; this includes unwinding through ART, integrating with fdsan, and recording all the stacks involved in a GWP-ASan, HWASan, or MTE crash. Now we’re giving your app access to its tombstone files through the App Exit Reasons API. When your app uses `ApplicationExitInfo` with `REASON_CRASH_NATIVE`, you can now call `getTraceInputStream()` to get the tombstone data as a protocol buffer.

More-flexible backup configurations - Android’s backup service lets users restore or migrate their data to a new device effortlessly. Apps are central to the experience, enabling users to easily transfer app data and continue where they left off. The backup service supports both cloud backups to Google Drive and device-to-device transfers, and developers can take advantage of these with minimal changes in their apps. For apps targeting Android 12, we’re improving the service to give you more flexibility and control. We’ve updated the XML configuration format so you can now set different rules for cloud backups and device-to-device transfers. With this, for example, you could exclude a large file from cloud backups but include it in device-to-device transfers. You can also set encryption requirements separately for backups or transfers. Last, if you’d like to opt-out of Auto Backup for device-to-device transfers, please use the new configuration format instead of the allowBackup manifest attribute. More here.

You can read more about all of the Android 12 features and behavior changes here.

App compatibility

We’re working to make updates faster and smoother by prioritizing app compatibility as we roll out new platform versions. In Android 12, we’ve made most app-facing changes opt-in to give you more time, and we’ve updated our tools and processes to help you get ready sooner.

With Developer Preview 3, we’re moving closer to our first Beta release as we continue to improve stability. Now is the time to try the new features and changes and let us know how these work with your apps. Please visit the feedback page to share your thoughts with us or report issues.

With the first Beta coming soon, it’s time to start your compatibility testing to make sure your app is ready. We recommend releasing a compatible update over the next few weeks. There’s no need to change your app’s targetSdkVersion at this time, although you can use the behavior change toggles to get a preliminary idea of how your app might be affected by opt-in changes in Android 12.

As we reach Platform Stability in August 2021, all of the app-facing system behaviors, SDK/NDK APIs, and non-SDK lists will be finalized. At that point, you can finish up your final compatibility testing and release a fully compatible version of your app, SDK, or library. More on the timeline for developers is here.

App compatibility toggles in Developer Options.

Get started with Android 12

Today’s Developer Preview has everything you need to try the Android 12 features, test your apps, and give us feedback. You can get started today by flashing a device system image to a Pixel 3 / 3 XL, Pixel 3a / 3a XL, Pixel 4 / 4 XL, Pixel 4a / 4a 5G, or Pixel 5 device or using the Android Emulator. If you’ve already installed a preview build to your Pixel device, you’ll automatically get this update and future Beta updates over-the-air. More details on how to get Android 12 are here.

For complete information, visit the Android 12 developer site.