6. GDG Location
WindowInsets
// get WindowInsets object from listener
view.setOnApplyWindowInsetsListener { view, insets ->
// See if the IME is visible
val imeVisible = insets.isVisible((WindowInsets.Type.ime()))
}
7. GDG Location
WindowInsets
// get WindowInsets object from listener
view.setOnApplyWindowInsetsListener { view, insets ->
// See if the IME is visible
val imeVisible = insets.isVisible((WindowInsets.Type.ime()))
if (imeVisible) {
val imeInsets = insets.getInsets(WindowInsets.Type.ime())
// ...
}
}
8. GDG Location
IME Animations
● Synchronize keyboard animations
with app content changes
○ Listen for changes
■ AND/OR
○ Drive keyboard animation
directly
15. GDG Location
Conversations
// Create and post shortcut
val person = Person.Builder().build()
val shortcutInfo = ShortcutInfoCompat.Builder(this, "sampleShortcut").
setPerson(person).
setLongLived(true).
// ...
build()
16. GDG Location
Conversations
// Create and post shortcut
val person = Person.Builder().build()
val shortcutInfo = ShortcutInfoCompat.Builder(this, "sampleShortcut").
setPerson(person).
setLongLived(true).
// ...
build()
ShortcutManagerCompat.pushDynamicShortcut(shortcutInfo)
17. GDG Location
Conversations
// Create and post shortcut
val person = Person.Builder().build()
val shortcutInfo = ShortcutInfoCompat.Builder(this, "sampleShortcut").
setPerson(person).
setLongLived(true).
// ...
build()
ShortcutManagerCompat.pushDynamicShortcut(shortcutInfo)
// Create notification with shortcut
val style = NotificationCompat.MessagingStyle(person).
addMessage(...).
// ...
18. GDG Location
Conversations
// Create and post shortcut
val person = Person.Builder().build()
val shortcutInfo = ShortcutInfoCompat.Builder(this, "sampleShortcut").
setPerson(person).
setLongLived(true).
// ...
build()
ShortcutManagerCompat.pushDynamicShortcut(shortcutInfo)
// Create notification with shortcut
val style = NotificationCompat.MessagingStyle(person).
addMessage(...).
// ...
NotificationCompat.Builder(this, "foo").
setShortcutId(shortcutInfo.id).
// ...
build()
20. GDG Location
Bubbles
● Notifications that can also show as bubbles
● Android 10: Developer option
○ Android 11: They’re here!
● Better than System Alert Window!
● Created with Notification API
○ with more metadata
○ and dedicated activity
31. GDG Location
Crash Reasons Querying
// Returns List of ApplicationExitInfo
val reasonsList = activityManager.getHistoricalProcessExitReasons(
packageName, pid /* 0 for all matches */, max /* 0 for all */)
32. GDG Location
Crash Reasons Querying
// Returns List of ApplicationExitInfo
val reasonsList = activityManager.getHistoricalProcessExitReasons(
packageName, pid /* 0 for all matches */, max /* 0 for all */)
for (info in reasonsList) {
// Log/store/upload info.reason
// REASON_LOW_MEMORY, REASON_CRASH, REASON_ANR, etc.
}
33. GDG Location
● Android 10: HWASan
○ Memory issue debugging
● GWP-ASan
○ Catches memory issues (for native apps)
○ On user devices in the field
○ Low overhead (runtime and memory)
○ Reports uploaded to Play dashboard
GWP-ASan
37. GDG Location
ADB Incremental
● Faster installs via command-line
● For huge APKs (think: games)
● Up to 10x faster
adb
adb incremental
playable
Avg time (in seconds)
68.8 s
0.29 s
Unity Megacity demo
3.5 GB, Pixel 4, USB 3.0
adb incremental
fully installed
7.6 s
Source: Google data
39. GDG Location
Behavior Changes
● Most changes limited to targetSdk R
● Test changes with behavior toggles
○ Command-line
○ New Developer Options panel
41. GDG Location
For More Information
Launch videos
11 Weeks of Android
Android 11 Meetups
Now in Android
goo.gle/android11
d.android.com/11weeksofandroid
d.android.com/android11/meetups
d.android.com/series/now-in-android