Posted by Dave Burke, VP of Engineering
Last month we shared the first preview of Android 12, an early have a look at the following model of Android. Today we’re bringing you the following 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 preserve 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 offer you new instruments for constructing nice experiences for customers, whether or not they’re utilizing telephones, laptops, tablets, TVs, or vehicles. Some issues to search for in in the present day’s launch embrace new rounded corners APIs, improved picture-in-picture APIs, higher companion system administration, simpler results like blur and colour filter, app overlay controls, and extra.
There’s loads 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 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 thus far.
Trust and security
We’re persevering with to deal with giving customers extra transparency and management whereas holding their units and knowledge safe. In in the present day’s launch, we’ve added some new options to take a look at and take a look at along with your apps.
App overlay controls – Android’s system alert window offers apps a strategy to get customers’ consideration for essential actions by exhibiting 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 may 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. More here.
Extended safety for lockscreen notification actions – Android 12 provides finer-grained privateness and safety controls for notifications displayed on the system lockscreen. You can now configure notification actions in order that when triggered from the lockscreen, they may all the time generate an authentication problem. This extends the notification visibility controls already obtainable by means of the notification APIs. For instance, this allows a messaging app to require authentication earlier than deleting a message or marking it as learn. More here.
Access to app digests – For apps that must validate the integrity of app packages put in on Android units, we’re introducing a brand new API that allows you to question the platform instantly for the checksum of an put in app. You can 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 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 (corresponding to Google Play) or computed by the platform. Results are filtered primarily based on package visibility tips, so that you’ll must declare the packages of curiosity in your manifest. This new API offers an easier, extra environment friendly strategy to receive checksums and provides you the steadiness of a normal, 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 can learn extra about these and different privateness and safety adjustments here.
Better person expertise instruments
We’re working to offer you extra instruments that will help you ship a elegant expertise and higher efficiency for customers. Here are a few of the updates in in the present day’s launch.
Support for Rounded corners – Many fashionable units use screens with rounded corners, giving them a clear fashionable look, but additionally introducing some additional issues for app builders. To ship an ideal UX on these units, builders must account for the rounded corners and regulate any close by UI parts to stop 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 can name Display.getRoundedCorner() to get absolutely the particulars for every rounded nook. You may also name WindowInsets.getRoundedCorner() to get the nook particulars relative to your app’s bounds. With these, you may handle the place of UI parts and content material as wanted. More here.
Picture in Picture (PIP) enhancements – for folks utilizing gesture nav, we’ve improved how apps transition to picture-in-picture (PIP) mode on swipe up-to-home. If an app permits 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 Activity when wanted. Android 12 additionally helps stashing the PiP window by dragging it to the left or proper fringe of the display. Also, 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. More here.
Keeping companion system apps awake – For apps that handle companion units like smartwatches and health trackers, it may be a problem to verify the app is working and related each time an related companion system is close by. To make this simpler, we’re extending the Companion Device Manager with a brand new CompanionDeviceService API. Apps that handle companion units can implement this service to let the system wake the app each time the related companion system is close by. The system retains the service sure each time the system is close by, and notifies the service when the system goes out and in of vary or is turned off, to let the app clear up state as wanted. Apps may also use a brand new companion device profile when connecting to a watch, which simplifies enrollment by bundling associated permissions right into a single grant. More here.
Bandwidth estimation enhancements – for builders who must know the everyday bandwidth obtainable to every person so you may tailor their expertise, we now present improved bandwidth estimation. We’ve enhanced the present bandwidth estimation APIs to allow you to retrieve an estimate of mixture throughput per provider or Wi-Fi SSID, community sort, and sign stage, for all customers on the system. The new estimation is more likely to be simpler and extra correct than most different estimation strategies, give it a attempt to tell us the way it works for you.
Easier 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 can use RenderEffect to use blurs, colour filters, and extra to any RenderNode. You can mix these results as chain results (which compose an internal and outer impact so as) or mix them. You may also 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 PictureView. RenderEffect leverages the present rendering pipeline to attenuate extra calculation.
Give these a attempt to let use know what you suppose! More here.
You may also create a frosted glass impact on your window background utilizing a brand new Window.setBackgroundBlurRadius() API. With this you may set a radius to manage the density and scope and the platform applies the blur to the background content material inside the bounds of your app’s window solely. You may also use blurBehindRadius to blur the entire 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 quicker 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 offer 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 nicely 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 on the lookout 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 time to begin your compatibility testing and determine any work you’ll must do. We suggest doing the work early, so you may launch a appropriate replace by Android 12 Beta 1. There’s no want to vary your app’s targetSdkVersion at the moment, 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, the entire app-facing system behaviors, SDK/NDK APIs, and non-SDK lists will probably be finalized. At that time, you may wind up your last compatibility testing and launch a completely appropriate model of your app, SDK, or library. More on the timeline for builders is here.
App compatibility toggles in Developer Options.
The Developer Preview has all the things that you must strive the Android 12 options, take a look at your apps, and provides us feedback. You can get began in the present day by flashing a device system image to a Pixel 3 / Three XL, Pixel 3a / 3a XL, Pixel 4 / Four XL, Pixel 4a / 4a 5G, or Pixel 5 system or utilizing the Android Emulator. If you’ve already put in a preview construct to your Pixel system, you’ll mechanically get future updates over-the-air for all later previews and Betas. More particulars on how you can get Android 12 are here.
You may also take a look at your apps on Android TV utilizing in the present day’s launch and take a look at the all-new Google TV expertise. Learn extra here and get began along with your ADT-3 developer kit.
For full info, visit the Android 12 developer site.