Android 11 Developer Preview 2 adds App-Preferred Frame Rate support, Resume on Reboot, more
Although the spread of the COVID-19 disease caused by SARS-CoV-2 has slowed down the global economy, many tech companies have transitioned their employees to work from home (WFH). Google is one such company, and today, they acknowledged the difficulties facing many of us around the world. Today, the company announced a new Developer Preview of the next major Android OS: Android 11. Android 11 Developer Preview 2, like the first Developer Preview, is still intended only for developers, and the list of changes mentioned in the blog post focus on new APIs and platform behavior changes that developers will have to adapt to. Here’s what’s new.
New Android 11 API Changes
- 5G state API: In Android 11 Developer Preview 2, developers can check if the user is on a 5G New Radio (NR) or Non-Standalone (NSA) network. If you aren’t familiar, 5G on NSA networks means the 5G network is piggybacking off of existing 4G infrastructure, whereas with 5G on NR networks, the network is independent. 5G on NR will generally be much faster, though its current availability is very limited. You can check for this status to change how your app behaves under the inferior or superior network connection.
- Hinge angle for foldables: Foldable devices like the upcoming Microsoft Surface Duo, the Motorola Razr, the Samsung Galaxy Fold/Z Flip, and the Huawei Mate X/Xs usually have more than just two states. Most of the time, they’re either folded or fully unfolded, but occasionally, users will place them at an angle. Android 11 Developer Preview 2 has added support for a hinge angle sensor that lets apps query the hinge angle either directly or through an AndroidX library.
- Call screening service improvements: Call screening apps can now report a call rejection reason to inform users why the service rejected an incoming call. In addition, call screening apps can also see if an incoming call was from a number that’s in the user’s contacts, provided, of course, that the call screening app has permission to read contacts. Finally, call screening apps can now customize a post call screen dialog, that’s provided by the system, to let users perform actions like mark the call as spam or add the number to their contacts.
- Updates to Neural Networks API: Google has added a “computationally efficient version” of a swish activation function (warning: PDF link) that allows for “faster training time and higher accuracy across a wide variety of tasks.” Another addition is the Control ops “enabling more advanced machine learning models that support branching and loops.” Lastly, Google has added “new execution controls” to minimize latency for common use cases.
Privacy and Security
- In Android 11, apps that want to access the camera or microphone data from a foreground service must declare the manifest attribute foregroundServiceType.
- Scoped storage has been updated in this new preview release. Now developers can migrate files “from the legacy model to the new scoped storage model.” Also added is “better management of cached files.”
Polish and quality
- Synchronized IME transitions: New APIs have been added to allow developers to synchronize their app’s content with the input method editor, or IME, and system bars as they animate. This allows for you to create IME transitions that are much more fluid than before. The new insets animation listener allows one to create “frame-perfect transitions” as it notifies apps of per-frame changes to insets. The new WindowInsetsAnimationController API lets apps take control of the IME and system bar transitions, on the other hand. In the example shown to the bottom right, the app is using the WindowInsetsAnimationController API to control the IME transition upon overscrolling the app’s UI.
- App-preferred refresh rate: There are now dozens of Android devices with high refresh rate displays, such as 90Hz, 120Hz, or 144Hz. In Android 11, apps and games can now set their preferred frame rate for their own windows. The system will use the app’s preferred frame rate to choose the display refresh rate when running the app.
- Resume on reboot: As we highlighted before, Android 11 improves the experience of overnight OTA updates. After a reboot, apps can access the Credential Encrypted (CE) storage without the user unlocking the device. Thus, apps can resume normal functionality after an OTA when the user isn’t around to unlock the phone.
- Camera support in Android Emulator: The Android Emulator in Android Studio now supports front and rear emulated cameras. The back camera supports HW Level 3 in Camera2 API, while the front camera supports the FULL level with logical camera support.
There will be one more Developer Preview in April followed by 2 beta releases. The stable Android 11 release will be made available sometime in Q3 of 2020, if all goes to plan.
To install Android 11 Developer Preview 2 on a Pixel device, you must have a Pixel 2, Pixel 2 XL, Pixel 3, Pixel 3 XL, Pixel 3a, Pixel 3a XL, Pixel 4, or Pixel 4 XL. You can either manually flash the preview build or you can use the Android Flash Tool to do it for you. If you don’t own a Pixel device, you may be able to install the latest Developer Preview through the Generic System Image (GSI) on Project Treble-compatible devices, which includes devices that launched with Android 9 Pie or later. Your mileage may vary, though. Lastly, you can boot up the latest build in the Android Emulator in Android Studio. Each of these methods provides you a way to test your apps in the new environment. Be sure to thoroughly test your app because Google will eventually make targeting Android 11 a requirement for your apps’ inclusion into the Google Play Store.
Try out the latest version and give Google feedback if you encounter any problems.