Posted by Dave Burke, VP of Engineering
Final month we shared the first preview of Android 12, an early have a look at the subsequent model of Android. Immediately we’re bringing you the subsequent milestone construct on this 12 months’s launch, with extra new options and adjustments so that you can strive along with your apps. Our program of early previews is pushed by our core philosophy of openness and collaboration with you, our neighborhood. 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 present 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 in the present day’s launch embody new rounded corners APIs, improved picture-in-picture APIs, higher companion gadget administration, simpler results like blur and coloration filter, app overlay controls, and extra.
There’s loads to take a look at in Developer Preview 2 – learn on for just a few highlights and visit the Android 12 developer site for particulars and downloads for Pixel. For these already working Developer Preview 1 or 1.1, we’re additionally providing an over-the-air (OTA) replace to in the present day’s launch.
Let us know what you think, and thanks to everybody who has shared such nice suggestions to this point.
Belief and security
We’re persevering with to give attention to giving customers extra transparency and management whereas conserving their gadgets and information safe. In in the present day’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 provides apps a strategy to get customers’ consideration for necessary actions by displaying an overlay on high of the lively app. These home windows can interrupt the consumer, 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 might 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 ought to be hidden when your app’s window is seen. You may select to do that when displaying delicate screens, akin 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 gadget lockscreen. Now you can configure notification actions in order that when triggered from the lockscreen, they are going to at all times generate an authentication problem. This extends the notification visibility controls already obtainable via 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 must 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 straight for the checksum of an put in app. You’ll be able to select from a number of digest algorithms akin to SHA256, SHA512, Merkle Root, and others. To request a checksum, name PackageManager.requestChecksums() with an app’s package deal title, 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 supplied by the installer app (akin to Google Play) or computed by the platform. Outcomes are filtered primarily based on package visibility tips, so that you’ll must declare the packages of curiosity in your manifest. This new API supplies a less complicated, extra environment friendly strategy to receive checksums and offers you the steadiness of a typical, public API that’s optimized for velocity 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 consumer expertise instruments
We’re working to present you extra instruments that can assist you ship a elegant expertise and higher efficiency for customers. Listed below are a number of the updates in in the present day’s launch.
Assist for Rounded corners – Many fashionable gadgets use screens with rounded corners, giving them a clear fashionable look, but additionally introducing some additional issues for app builders. To ship a terrific UX on these gadgets, builders must account for the rounded corners and regulate any close by UI parts 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 main points for a nook, together with its radius, centerpoint, and different information. You’ll be able to name Display.getRoundedCorner() to get absolutely the particulars for every rounded nook. You may as well name WindowInsets.getRoundedCorner() to get the nook particulars relative to your app’s bounds. With these, you possibly can handle the place of UI parts 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 straight transitions the app to PIP mode on up-to-home, as an alternative 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. 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 dimension. Extra here.
Holding companion gadget apps awake – For apps that handle companion gadgets like smartwatches and health trackers, it may be a problem to ensure the app is working and linked every time an related companion gadget 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 every time the related companion gadget is close by. The system retains the service sure every time the gadget is close by, and notifies the service when the gadget goes out and in of vary or is turned off, to let the app clear up state as wanted. Apps may 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 must know the standard bandwidth obtainable to every consumer so you possibly can 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 kind, and sign stage, for all customers on the gadget. 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, coloration filters and different results – In Android 12, we’re making it simpler to use frequent graphics results to your Views and rendering hierarchies. You should use RenderEffect to use blurs, coloration filters, and extra to any RenderNode. You’ll be able to mix these results as chain results (which compose an internal and outer impact so as) or mix them. You may as well 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 information, course of the picture, create a brand new Bitmap, and set it again into the ImageView. RenderEffect leverages the prevailing rendering pipeline to attenuate extra calculation.
Give these a try to let use know what you suppose! Extra here.
You may as well create a frosted glass impact on your window background utilizing a brand new Window.setBackgroundBlurRadius() API. With this you possibly can set a radius to regulate the density and scope and the platform applies the blur to the background content material throughout the bounds of your app’s window solely. You may as well 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…
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 present you extra time, and we’ve up to date our instruments and processes that can assist you prepare sooner.
With Developer Preview 2, we’re properly into the discharge and persevering with to enhance general stability, so now’s the time to strive the brand new options and adjustments and provides us your suggestions. We’re particularly in search of 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 great time to start out your compatibility testing and establish any work you’ll must do. We suggest doing the work early, so you possibly can launch a suitable replace by Android 12 Beta 1. There’s no want to vary your app’s targetSdkVersion right now, however we do suggest utilizing the behavior change toggles to get a preliminary concept 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 might be finalized. At that time, you possibly can wind up your closing compatibility testing and launch a completely suitable 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 the whole lot you could strive the Android 12 options, check your apps, and provides us feedback. You may get began in the present day 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 gadget or utilizing the Android Emulator. In the event you’ve already put in a preview construct to your Pixel gadget, you’ll mechanically get future updates over-the-air for all later previews and Betas. Extra particulars on the right way to get Android 12 are here.
You may as well check your apps on Android TV utilizing in the present day’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.