Author / Dave Burke, vice president of Engineering
Last month, we releasedThe first preview of Android 12Let developers experience a new version of Android first. Now we bring you the next milestone version of this year’s release plan: developer preview 2, which contains more new features and changes. You are welcome to experience it through your own application. With open collaboration as the core concept, our early preview program aims to work hand in hand with the developer community. Your valuable opinions will help us build a better Android platform for developers and users. Please continue to provide us with feedback!
In Android 12, we are committed to making the operating system smarter, easier to use, more powerful, and always focus on privacy and security. We will also provide you with new tools to help you create a better experience for users, whether they are using mobile phones, laptops, tablets, TVs or cars. Today’s content includes new rounded corner API, improved picture in picture API, better supporting equipment management, easier to use special effects such as blur and color filter, application coverage control, etc.
Developer preview 2 has a lot to experience, this article will introduce the highlights in detail! To learn more about this preview and get information about downloading and installing to pixel devices, please visitAndroid 12 developer website. For users who have installed developer Preview 1 or 1.1, we will also provide OTA updates today.
Don’t forgetTell us what you thinkThank you again for your valuable feedback.
Trust and security
We are still focused on providing users with more transparency and control, while ensuring the security of devices and data. In today’s preview, we have added some new features for your application to test.
Application coverage control-Android’s system warning dialog allows an app to overlay a layer on top of other active apps to help the app remind users to pay attention to important operations. However, because these windows will interrupt the user’s operation, the application needs toRequest permissionTo display the content. In Android 12, you can control whether these overlay layers are allowed to be displayed on your own content. stayDeclare new permissionsAfter that, your application can callWindow#setHideOverlayWindows()）To indicate that you should hide all of your applications when their windows are visibleTYPE_APPLICATION_OVERLAYWindow. You can do this in sensitive interfaces such as transaction confirmation process. Please visitOfficial documentsLearn more.
Security of extended lock screen notification operation-Android 12 adds more fine-grained privacy and security controls to control the notification when the device locks the screen. Now, you canConfigure notification actions）To always generate an authentication challenge when the lock screen triggers a notification operation. This function is an extension of the existing notification APINotification visibilityExtension of control. For example, this feature allows an instant messaging app to request authentication before deleting a message or marking it as read. Please visitOfficial documentsLearn more.
Access application summary-For applications that need to confirm the integrity of application packages installed on Android devices, we introduce a new API, which allows you to directly query the platform for the checksum of an installed application. You can choose from sha256, SHA512, Merkle root and other summary algorithms. When requesting a checksum, the name of the applied package and the requiredCheck sum type, the trusted installer certificate, and the listener that receives the checksumsPackageManager.requestChecksums()）That’s it. Based on the parameters, the platform will return the checksums pre calculated by the installation program (such as Google play) or directly calculated by the platform. The returned results will be based onPackage visibilityCriteria, so you need to declare the packages you want to view in the manifest. This new API allows you to obtain checksums in a simpler and more efficient way. It not only has the stability of the standard public API, but also has been optimized to be faster and safer. In order to support backward compatibility, we are developing the corresponding jetpack library, which can bring this function to API 15 and above. We will bring you more details in this respect in the future. Please look forward to it. Learn more aboutPrivacy and security changes。
Better user experience tools
We are committed to providing you with more tools to help you create a better experience and get better performance. Here are some of the updates in developer preview 2.
Support fillet-Many modern devices use rounded screen design, which highlights the simple and fashionable style, but also brings some additional problems for application developers. To provide excellent user experience on these devices, developers need to take these fillets into consideration and adjust the interface elements near the fillets to prevent the occurrence of cutting.
To solve this problem, we introduce a new API, which is convenient for you to query the fillet and its details.RoundedCornerInformation such as fillet radius and center point is provided. You canDisplay.getRoundedCorner()）To get detailed information about each fillet. You can also callWindowInsets.getRoundedCorner()）To get information such as the fillet position based on your application boundary. In this way, you can flexibly adjust the position of interface elements and content according to your needs. Please visitOfficial documentsLearn more.
Improvement of picture in picture (PIP)-For users who use gesture navigation, we improve the way to transition to picture in picture (PIP) mode when the application swipes up to the home screen. If an app is enabledAutomatic pip）The system will now transition the application to PIP mode when the user swipes up to the home screen, instead of waiting for the animation to finish. This makes the transition smoother and improves perceptual performance. We also improve the size adjustment of PIP window for non video content. The app is now availableEnable seamless sizing）To enable the system to adjust the size of PIP activity as needed. Android 12 also supports hiding PIP windows by dragging them to the left or right edge of the screen. In addition, to make the PIP window easier to manipulate, we update the click behavior: now a single click can display the control, and two clicks can switch the size of the PIP window. Please visitOfficial documentsLearn more.
Keep the application of supporting equipment awake-For the application of smart watch and fitness tracker, it is a difficult problem how to ensure that the associated devices keep running and connected when they are nearby. In order to solve this problem more easily, we provideExtended device manager(companion device manager) brings new challengesCompanionDeviceService API. Through this service, the system can wake up the application when the associated equipment is nearby. When the device is nearby, the system will ensure that the service is in the wake-up state, and when the device enters and leaves the connection range or is shut down, the system will notify the service, so that the application can clean up the state as needed. The app can also use the newMatching equipment configuration）To simplify the registration process by binding related permissions to a single authorization. Please visitOfficial documentsLearn more.
Improved bandwidth estimation-Some developers need to know the available bandwidth of users in order to customize the experience. We have improved the bandwidth estimation function and enhanced the existing bandwidth estimation functionBandwidth estimation APIFor all users on the device, the data throughput of each operator or Wi Fi SSID, network type and signal strength can be estimated. The new estimation method is more simple and accurate than most other methods. You are welcome to try it out and give feedback.
Easy to use blur, color filter and other special effects-In Android 12, you can more easily apply common graphic effects to views and rendering structures. You can useRenderEffectSpecial effects such as blur and color filter are applied to any imageRenderNode. You can combine these effects into a chain of effects (that is, internal and external effects) or mix them. You can also callView.setRenderEffect(RenderEffect)）Apply the effects directly to the view (because it is based on rendernode).
view.setRenderEffect(RenderEffect.createBlurEffect(radiusX, radiusY, SHADER_TILE_MODE))
Use rendeereffect to blur the view
With this function, you are in fuzzyImageViewIt is not necessary to acquire bitmap data, process images and create new onesBitmapAnd then set it back to ImageView. Rendeereffect uses the existing rendering pipeline to minimize the extra computation.
Please try the above functions and share your experience with us! Please visitOfficial documentsLearn more about rendering effects.
You can also use the newWindow.setBackgroundBlurRadius()）API creates a fog glass effect for the window background. This API can set the blur radius to adjust the density and range of the fog surface. The platform will only blur the background content within the border of your application window. You can also useblurBehindRadiusTo blur all the contents behind the window, so as to create a depth effect for the floating window.
A dialog window in which the background and the contents behind the window are blurred
When we launch the new platform version, we will give priority to the compatibility of the application to make the system update experience faster and smoother. In Android 12, most application-oriented changes are optional, giving you more time to adjust and adapt. We’ve also updated tools and processes to help you get ready faster.
The launch of developer preview 2 means that we have done a lot of work in the release phase and are continuously improving the overall stability. Now you can experience new features and changes and give us feedback. We look forward to your feedback on the use of API, andPlatform changeThe impact on the application. Please visitFeedback page, share your thoughts or report problems with us.
Now you can also start to enterLine compatibility testAnd determine what needs to be done next. We suggest that developers complete this work ahead of time in order to release compatible updates when Android 12 beta 1 is launched. At present, we don’t need to change the targetsdkversion of the app, but we recommend to use itBehavior change switchTo have a preliminary understanding of the impact of Android 12’s optional changes on the application.
We will arrive in August 2021Platform stability milestoneBy then, all application-oriented system behaviors, SDK / NDK APIs and non SDK lists will be finalized. At that time, you can complete the final compatibility test and release fully compatible applications, SDKs or development libraries. The release schedule is as follows:https://developer.android.google.cn/preview/overview
Application compatibility switch in delta developer options
Experience Android 12 now
Whether you want to experience the features of Android 12, test applications orSubmit feedbackYou can start with this developer preview. Just image the device to the systemDownload and swipe in Pixel 3 / 3 XL、Pixel 3a / 3a XL、Pixel 4 / 4 XL、Pixel 4a / 4a 5GorPixel 5Device, or use the Android emulator, you can start using it immediately. If you have installed the preview in your pixel device, you will automatically get all subsequent preview and beta updates via Ota. Please visitOfficial documentsLearn more.
For complete information on this release, please visitAndroid 12 developer website。