Android 12 Developer Preview 2


Posted by Dave Burke, VP of Engineering

Android 12 logo

Final month we shared the first preview of Android 12, an early take a look at the following model of Android. Right now we’re bringing you the following milestone construct on this yr’s launch, with extra new options and adjustments so that you can attempt along with your apps. Our program of early previews is pushed by our core philosophy of openness and collaboration with you, our group. Your enter helps us make Android a greater platform for builders and customers, so maintain the suggestions coming!

In Android 12 we’re making the OS smarter, simpler to make use of, and higher performing, with privateness and safety on the core. We’re additionally working to provide you new instruments for constructing nice experiences for customers, whether or not they’re utilizing telephones, laptops, tablets, TVs, or automobiles. Some issues to search for in immediately’s launch embody new rounded corners APIs, improved picture-in-picture APIs, higher companion machine administration, simpler results like blur and colour filter, app overlay controls, and extra.

There’s lots to take a look at in Developer Preview 2 – learn on for a couple of highlights and visit the Android 12 developer site for particulars and downloads for Pixel. For these already operating Developer Preview 1 or 1.1, we’re additionally providing an over-the-air (OTA) replace to immediately’s launch.

Let us know what you think, and thanks to everybody who has shared such nice suggestions to date.

Belief and security

We’re persevering with to deal with giving customers extra transparency and management whereas conserving their gadgets and knowledge safe. In immediately’s launch, we’ve added some new options to take a look at and check along with your apps.

App overlay controls – Android’s system alert window offers apps a technique to get customers’ consideration for necessary actions by displaying an overlay on high of the lively app. These home windows can interrupt the person, although, so we already require apps to request permission earlier than displaying them. Now in Android 12 we’re supplying you with management over whether or not these overlays will be proven over your content material. After you’ve declared a new permission, your app can name Window#setHideOverlayWindows() to point that each one TYPE_APPLICATION_OVERLAY home windows needs to be hidden when your app’s window is seen. You may select to do that when displaying delicate screens, corresponding to transaction affirmation flows. Extra here.

Prolonged safety for lockscreen notification actions – Android 12 provides finer-grained privateness and safety controls for notifications displayed on the machine lockscreen. Now you can configure notification actions in order that when triggered from the lockscreen, they are going to all the time generate an authentication problem. This extends the notification visibility controls already accessible by way of the notification APIs. For instance, this allows a messaging app to require authentication earlier than deleting a message or marking it as learn. Extra here.

Entry to app digests – For apps that have to validate the integrity of app packages put in on Android gadgets, we’re introducing a brand new API that permits you to question the platform instantly for the checksum of an put in app. You’ll be able to select from a number of digest algorithms corresponding to SHA256, SHA512, Merkle Root, and others. To request a checksum, name PackageManager.requestChecksums() with an app’s bundle identify, the checksum types you want, the installer certs you belief, and a listener to obtain the checksums. The platform returns the matching checksums, both precomputed and offered by the installer app (corresponding to Google Play) or computed by the platform. Outcomes are filtered based mostly on package visibility pointers, so that you’ll have to declare the packages of curiosity in your manifest. This new API supplies an easier, extra environment friendly technique to acquire checksums and provides you the soundness of a typical, public API that’s optimized for pace and safety. For backward compatibility, we’re engaged on a Jetpack library that gives the identical performance again to API 15 – look ahead to extra particulars coming quickly.

You’ll be able to learn extra about these and different privateness and safety adjustments here.

Higher person expertise instruments

We’re working to provide you extra instruments that will help you ship a cultured expertise and higher efficiency for customers. Listed here are among the updates in immediately’s launch.

rounded corners

Assist for Rounded corners – Many fashionable gadgets use screens with rounded corners, giving them a clear fashionable look, but additionally introducing some further concerns for app builders. To ship an excellent UX on these gadgets, builders have to account for the rounded corners and alter any close by UI components to forestall them from being truncated.

To assist with this, we’re introducing new APIs to allow you to question for rounded corners and get their particulars. A RoundedCorner holds the small print for a nook, together with its radius, centerpoint, and different knowledge. You’ll be able to name Display.getRoundedCorner() to get absolutely the particulars for every rounded nook. It’s also possible to name WindowInsets.getRoundedCorner() to get the nook particulars relative to your app’s bounds. With these, you’ll be able to handle the place of UI components and content material as wanted. Extra here.

Image in Image (PIP) enhancements – for individuals utilizing gesture nav, we’ve improved how apps transition to picture-in-picture (PIP) mode on swipe up-to-home. If an app allows auto-PIP, the system now instantly transitions the app to PIP mode on up-to-home, as a substitute of ready for the up-to-home animation to finish. This makes the transition smoother and improves perceived efficiency. We’ve additionally improved PIP window resizing for non-video content material. Apps can now enable seamless resize to let the system resize the PIP Exercise when wanted. Android 12 additionally helps stashing the PiP window by dragging it to the left or proper fringe of the display screen. Additionally, to make PIP home windows simpler to govern, we’ve up to date the faucet behaviors. Single-tapping now shows controls, and double-tapping toggles the PIP window measurement. Extra here.

Conserving companion machine apps awake – For apps that handle companion gadgets like smartwatches and health trackers, it may be a problem to verify the app is operating and linked at any time when an related companion machine is close by. To make this simpler, we’re extending the Companion Device Manager with a brand new CompanionDeviceService API. Apps that handle companion gadgets can implement this service to let the system wake the app at any time when the related companion machine is close by. The system retains the service certain at any time when the machine is close by, and notifies the service when the machine goes out and in of vary or is turned off, to let the app clear up state as wanted. Apps also can use a brand new companion device profile when connecting to a watch, which simplifies enrollment by bundling associated permissions right into a single grant. Extra here.

Bandwidth estimation enhancements – for builders who have to know the everyday bandwidth accessible to every person so you’ll be able to tailor their expertise, we now present improved bandwidth estimation. We’ve enhanced the prevailing bandwidth estimation APIs to allow you to retrieve an estimate of combination throughput per provider or Wi-Fi SSID, community sort, and sign degree, for all customers on the machine. The brand new estimation is more likely to be simpler and extra correct than most different estimation strategies, give it a try to tell us the way it works for you.

Simpler blurs, colour filters and different results – In Android 12, we’re making it simpler to use widespread graphics results to your Views and rendering hierarchies. You should utilize RenderEffect to use blurs, colour filters, and extra to any RenderNode. You’ll be able to mix these results as chain results (which compose an inside and outer impact so as) or mix them. It’s also possible to apply results on to Views (leveraging the underlying RenderNode) by calling View.setRenderEffect(RenderEffect).

view.setRenderEffect(RenderEffect.createBlurEffect(radiusX, radiusY, SHADER_TILE_MODE))

Blurring a View with RenderEffect

This lets you blur the contents of an ImageView with out having to get the bitmap knowledge, course of the picture, create a brand new Bitmap, and set it again into the ImageView. RenderEffect leverages the prevailing rendering pipeline to reduce extra calculation.

Give these a try to let use know what you assume! Extra here.

It’s also possible to create a frosted glass impact in your window background utilizing a brand new Window.setBackgroundBlurRadius() API. With this you’ll be able to set a radius to manage the density and scope and the platform applies the blur to the background content material throughout the bounds of your app’s window solely. It’s also possible to use blurBehindRadius to blur all the content material behind the window to create a depth impact for a floating window.

A dialog window with background blur and blur behind…

App compatibility

We’re working to make updates sooner and smoother by prioritizing app compatibility as we roll out new platform variations. In Android 12, we’ve made most app-facing adjustments opt-in to provide you extra time, and we’ve up to date our instruments and processes that will help you prepare sooner.

With Developer Preview 2, we’re effectively into the discharge and persevering with to enhance total stability, so now’s the time to attempt the brand new options and adjustments and provides us your suggestions. We’re particularly searching for enter on our APIs, in addition to particulars on how the platform changes have an effect on your apps. Please go to the feedback page to share your ideas with us or report points.

It’s additionally a very good time to begin your compatibility testing and establish any work you’ll have to do. We advocate doing the work early, so you’ll be able to launch a appropriate replace by Android 12 Beta 1. There’s no want to alter your app’s targetSdkVersion right now, however we do advocate utilizing the behavior change toggles to get a preliminary thought of how your app is likely to be affected by opt-in adjustments in Android 12.

As we attain Platform Stability in August 2021, all the app-facing system behaviors, SDK/NDK APIs, and non-SDK lists will likely be finalized. At that time, you’ll be able to wind up your remaining compatibility testing and launch a completely appropriate model of your app, SDK, or library. Extra on the timeline for builders is here.

App compatibility toggles in Developer Choices.

The Developer Preview has all the things that you must attempt the Android 12 options, check your apps, and provides us feedback. You may get began immediately 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 machine or utilizing the Android Emulator. Should you’ve already put in a preview construct to your Pixel machine, you’ll routinely get future updates over-the-air for all later previews and Betas. Extra particulars on easy methods to get Android 12 are here.

It’s also possible to check your apps on Android TV utilizing immediately’s launch and take a look at the all-new Google TV expertise. Be taught extra here and get began along with your ADT-3 developer kit.

For full info, visit the Android 12 developer site.

Recent Articles

What we’re anticipating from Google I/O 2021

As a result of we’re nonetheless within the midst of COVID19, Google I/O goes digital this yr, — it was canceled final yr —...

Idea: How Apple may increase iPhone customization past widgets with iOS 15 – 9to5Mac

iOS 14 noticed the introduction of House Display widgets on the iPhone, and that alone was anticipated to trigger a tsunami of artistic customization...

#AndroidDevChallenge – It’s a wrap!

Posted by The Jetpack Compose Workforce From pleasant doggos to artistic countdowns and storming climate apps, the 2000 submissions to the #AndroidDevChallenge blew our...

Related Stories

Stay on op - Ge the daily news in your inbox