Android 11

Ken Baldauf

Software Engineer @ Acorns

The Basics

  • Android 11 / API 30
  • Developer previews started in February
  • Initial beta launched on June 10th
  • Beta 2 launched on July 8th
    • Includes final APIs & behaviors
  • Beta available on Pixel 2, 3, 3a & 4
  • Production launch expected in early September
  • Dev Tools
  • New or Changing APIs
  • Interesting Features

Wireless Debugging

  • Previously needed to be initially setup with a USB cable
  • Now setup for deploying & debugging app is truly wireless
  • Computer & phone must be the same wifi network
  • Enable & pair via your phone's developer options menu
    • Pair using phone's ip address, port & pairing code
    • adb pair ipaddr:port
    • Coming Soon: pair with an Android Studio QR code

ADB Incremental Installation

  • Accelerates install process
    • Installs just enough of the APK to launch
    • Rest will be streamed in the background
  • adb install will use feature automatically
    • If on supported device using latest SDK platform tools
    • If not supported, will silently fallback to normal install
  • New APK Signature Scheme v4
    • Must be used to take advantage of incremental install
    • Generates a signature in a separate signature file
    • apk-name.apk.idsig
    • New file resides next to the normal APK file
  • Dev Tools
  • New or Changing APIs
  • Interesting Features

Scoped Storage

  • Apps only have access to their own directories
    • Plus select shared places (Downloads)
  • Meant to end abuse of external storage permissions
  • Enforce usage of Storage Access Framework APIs
    • For accessing folders not owned by app
  • First introduced in Android 10
    • Could be ignored using requestLegacyExternalStorage
  • Ending support for requestLegacyExternalStorage
  • Will introduce new all files access permission
    • Will include greater scrutiny from Google
    • Won't be ready till early 2021

Process Exit Reasons

  • Historical info related to app process terminations
    • Caused by ANRs, memory issues or other reasons
  • ActivityManager.getHistoricalProcessExitReasons(..)
  • ApplicationExitInfo.getTraceInputStream()
    • ​Stack track dump of app prior to termination
  • ActivityManager.setProcessStateSummary()
    • ​Save arbitrary process data for debugging crashes
    • ApplicationExitInfo.getProcessStateSummary()

Improved Data Access Auditing

  • Transparency into usage of private/protected data
  • Useful for monitoring own code or 3rd party SDKs
  • AppOpsManager.OnOpNotedCallback
    • Backtrack use of protected data protected by
    •  Determine code that triggered runtime permissions
  • createAttributionContext("Your Attribution Tag")

    • Special Context object

    • Applies an attribute tag to a subset of app's code

    • Attribute tag will show up in OnOpNotedCallback calls

Changes to Package Visibility

  • Previously apps could query for full list of installed apps
  • Now you'll only see a filtered list of installed apps
    • Implicit intents & most common uses continue to work
  • For broader list, specify apps you need to interact with
    •  Add a <queries> element in the AndroidManifest
    • Explicitly declare package names or intent filters

Changes to Package Visibility

<manifest>
  <queries>
    <!-- Specific apps you interact with, eg: -->
    <package android:name="com.example.store" />
    <package android:name="com.example.service" />
    
    <!--
         Specific intents you query for,
         eg: for a custom share UI
    -->
    <intent>
      <action android:name="android.intent.action.SEND" />
      <data android:mimeType="image/jpeg" />
    </intent>

  </queries>
  ...
</manifest>

Miscellaneous New APIs 

  • New MediaStore API: createTrashRequest
    • Apps can trash a file instead of deleting immediately
  • Improved support for curved & waterfall displays
    • New API similar to Android 9's cutout/notch API
  • Apps can now specify a preferred refresh rate
    • Used when running on variable refresh rate devices
  • Dev Tools

  • New or Changing APIs

  • Interesting Features

Non-dev Features

  • New "Block Store" similar to Apple's Keychain Services
    • Easier to re-login to all accounts on a new phone
  • General, system wide support for Bubble notifications
    • Similar to chat heads on Facebook Messenger & Google's phone app
  • Quick Access Device Controls
    • Control smart lights, thermostats & cameras from Android power menu
  • Adds native screen recorder
    • Was initially in Android 10, but removed due to bugs
    • Already exists on some Samsung & LG devices

Questions?

Android 11

By Kenneth Baldauf

Android 11

A look at the new features coming in Android 11

  • 505