Illustration by Virginia Poltrack

Now in Android #25

Android 11 released, Jetpack DataStore, privacy changes, Android GPU Inspector, and podcast episodes

Chet Haase
Android Developers
Published in
5 min readSep 16, 2020

--

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.

NiA25 in Video and Podcast Form

This Now in Android is also offered in video and podcast form. It’s the same content, but with less reading required. The article version (keep reading!) is still the place to come for links to all of the content that’s covered.

Video

Podcast

Click on the link below, or just subscribe to the podcast in your favorite client app.

Android 11: It’s Here!

After months of preview and beta releases, we made it: Android 11 is officially launched, with the source code pushed to the Android Open Source Project (AOSP).

I’ve talked about the features in this release for developers and users already, but here are a few teasers and reminders:

  • UI improvements, including Conversations in the notifications panel, Bubbles, and synchronized IME animations.
  • Easy access to controls for connected devices and media.
  • Privacy enhancements like one-time and auto-reset permissions, scoped storage improvements, background location, and biometric strength APIs (with additions to the new Jetpack biometrics library for earlier releases).
  • Developer enhancements like the new exit reasons API, behavior toggling in the Developer Options panel, ADB incremental installation, and more Kotlin nullability annotations for platform APIs.

We’ve also made more strides in the Google Play system updates (originally called “mainline” for anyone like me that’s confused by naming changes), to provide support for more modules so that we can enable more frequent updates for core system functionality across the ecosystem.

If you want a longer list of the features to look forward to in this release, check out ’s blog on developer features as well as Dave Burke’s article on user features for the release.

Jetpack DataStore

Jetpack DataStore is a new library available we offer as an alternative to (and improvement upon) Shared Preferences. This new library, which uses Kotlin coroutines and Flow for easier asynchronous reads and writes, is the way forward. It’s only in alpha right now, but check it out to see how to migrate to it eventually.

There are two different APIs/approaches in DataStore. Preferences DataStore, which essentially takes the place of SharedPreferences completely, uses key-value pairs to store simple data, just like SharedPreferences. But Preferences DataStore is more powerful and robust than SharedPreferences, since it automatically handles proper asynchronous reads and writes (instead of SharedPreferences’ approach of synchronous writes… which you then have to figure out how to get off of the UI thread to accomplish).

The second API is Proto DataStore, which allows you to create a schema for richer, type-safe object data storage, backed by protobufs.

Start by checking out the DataStore article below. Then try out the Preferences codelab and Proto codelab to jump-start your learning, and download the library.

Articles & Videos

Adapting to Recent Android Privacy Changes

wrote an article to help developers understand and adapt to recent privacy changes. Each release brings a handful of changes in this area as we continue to provide better control and transparency for user data access, and Android 11 is no exception. While many of these changes are gated behind a targetSdk flag, you will want to understand and eventually migrate your code, so you might want to read this article to see what to do.

In particular, the article talks about:

  • Package access: Android 11 limits the visibility of packages on the device. That is, apps can no longer access information about other arbitrary apps on a user’s device. The article discusses the way this now works and also links to an implementation guide.
  • Incremental location permissions: Android 11 requires location access in foreground+background to be requested incrementally (first foreground, then background, which sends the user to Settings to grant the background location permission).
  • Foreground services for location, microphone, and camera access.
  • Non-resettable IDs: This change has evolved over several releases as we weaned developers off of non-resettable device identifiers. In Android 11, calls to getIccId() no longer return useful information, so you should find other means to get the information you need (hint: use resettable identifiers instead). For starters, read the guide we offer on Best practices for unique identifiers.

Android GPU inspector

Earlier this year, we announced a new profiling tool that you could use to help tune 3D graphics performance. However, it was only available in early preview form as we continued working on it.

Fast forward to… now, and Android GPU Inspector is available in “open beta” form, for everyone to use. (Read: It’s still beta, and the team is still working on it, but we’re now ready for more people to bang on it, try it out, and send us feedback.)

This tool is similar to other profiling tools we offer like Android Studio’s CPU profiler and the standalone systrace/perfetto tools, but it contains low-level info specific to GPUs that can help developers (especially those writing games and other performance-sensitive graphics apps) tune their 3D performance.

Android GPU Inspector depends on cooperation with device drivers, so device support is currently limited to Pixel 4 and Pixel 4 XL, but look for AGI to support more devices in the future.

You can download the tool here and learn more with the article and video below.

Podcast Episodes

ADB 148: [Constraint|Motion][Layout|Editor]

and I talked with and about MotionEditor, which went stable recently in Android Studio 4.0. But as long as we were talking about that tool, we also talked extensively about MotionLayout in general as well as ConstraintLayout and other design tools.

Talking with Apples

joined Peter-John Welcome on his podcast to talk about Jetpack Compose.

Now then…

That’s it for this time. So go find out about Android 11! Download the new Jetpack DataStore library! Learn about adapting to the latest privacy changes! Play with the Android GPU Inspector! Listen to the latest ADB and Talking with Apples podcasts! And come back here soon for the next update from the Android developer universe.

--

--

Chet Haase
Android Developers

Past: Android development Present: Student, comedy writer Future: ???