DAN GALPIN: Android P Developer Preview 2
is here, providing a significantly updated
snapshot of what the next release of Android
is ultimately going to bring to developers.
Slices allow you to surface rich templated UI
from your app in places like Google Search and Assistant.
They can be interactive as well, with support for actions,
toggles, sliders, and more.
Slices are part of Jetpack, which
means they are backwards compatible and fully
updateable, including new template types.
App actions are closely related to slices.
Slices essentially provide a UI for embedded app
functionality, while actions are a new way for your app
to provide a list of intends to expose functionality
within Google Assistant, with possibilities such as watching
a video, reading a book, hailing a ride, and more.
Android is adding notification animations
to allow for seamless transitions from notification
to app.
You don't have to do anything to take advantage of this feature.
But it will be so much better if you
make your app start quickly, particularly when
cold starting.
Typing a reply from within a notification is great,
but not having to type at all is even better.
Smart replies allow you to present
quick choices that can be acted upon right in the notification.
Text measurement is expensive, which
is why the new, pre-computed text
API can offload a large chunk of this work to a worker thread.
Pre-computed text does require more memory per glyph.
But in many cases, this trade off will be well worth it.
Android is also adding a new magnifier widget
designed for improved text selection and cursor
manipulation.
By default, classes that extend TextView automatically
support the magnifier.
But you can use the magnifier API
to attach it to any custom view, which opens it up
to a variety of uses.
There are new API to make your app more accessible.
Accessibility pane titles allow accessibility services
to determine when specific sections of the screen
have updated, which is particularly
helpful for supporting fragment transitions.
You can specify a title for a pane, such as the content
area of a fragment, with the Android colon
accessibilityPaneTitle attribute,
or change it at runtime with setAccessibilityPaneTitle.
Similarly, you can now identify TextViews
as being headers, which allows TalkBack
to navigate between them.
Previously, the attribute for Focusable
could be used either to optimize your app, or keyboard
accessibility, or for TalkBack accessibility.
We have now added isScreenReaderFocusable,
so you can make sure that your app navigates optimally
for both keyboards and screen readers.
In display cutouts, we've made a few minor API changes
since the first preview.
Namely, layout in display cutout mode
always has become short edges to reflect that P only supports
cutouts on the short edges.
Since the API supports cutouts on both edges
simultaneously now, you get a list
of all cutout boundingRects instead of a single bounds.
We now have a theme attribute to tell
Android to lay out your activity in the cutout area.
This attribute will also be available on some Android O
devices that have cutouts.
So it's a backwards compatible way
to declare that your app can utilize the cutout area.
Also, the developer options now support
emulation of more cutout types, such as corner
and top-bottom duel cutout.
Android is continuing to invest to improve
battery life and system health.
App standby buckets puts running apps
into groups with different restrictions
based upon usage patterns.
Apps will change buckets over time.
And apps not in the active bucket
will have additional restrictions
around jobs, alarms, network, and high priority Firebase
Cloud messages.
As a developer, you can test how your app
operates under each of four defined buckets
using ADB commands.
Check out the documentation on app standby buckets
for details.
From our work on Android Vitals, Android
can detect battery draining app behaviors.
Within battery settings, Android will
flag the list of these apps and let the user apply restrictions
to the app's background activities.
You can manually apply background restrictions via ADB
to test how your app behaves and performs.
You can use activity manager, isBackgroundRestricted,
to determine at runtime if background restrictions have
been applied.
Biometric prompt was added to Developer Preview 2,
replacing the fingerprint dialog from DP 1.
In addition to supporting fingerprints,
including in display sensors, it supports face and iris
authentication, providing a system-wide consistent
experience.
There is a single use biometrics permission
that covers all device supported biometrics.
Fingerprint manager and the corresponding used fingerprint
permission are deprecated.
So please switch to biometric prompt as soon as possible.
We've added strongbox as a new key store backend,
providing API support for devices
that provide key storage and tamper resistant hardware
with isolated CPU, RAM, and flash.
You can set whether your key should
be protected by a strongbox security chip
in your keygen parameter spec.
Autofill has added an API that allows it to work
well inside of recycler view.
getNextAutofillId is used to manage views
whose content is recycled.
It returns an ID that is unique in the activity, which
you can associate with every item in your adapter
as they are initially viewed.
You can then call setAutofillId on each view as it is re-used.
In the first preview, we displayed a toast warning
when an app used a non SDK interface
that we plan to restrict.
But in the second preview, we are
enforcing these restrictions, which
means it will get exceptions thrown or nulls
returned instead of a warning.
If the non SDK interface is required for your app
to function and there aren't SDK alternatives,
please file an issue with us immediately.
Also, StrictMode now supports a warning
when it detects reflective usage of APIs that
aren't part of the public Android SDK,
even if they still work in the preview.
So you can plan for the future and eliminate non SDK API use.
The preview includes Vulkan 1.1, a substantial update
to the industry standard cross-platform graphics
and compute API.
And here are some highlights.
Multi-view is great for VR, allowing efficient generation
of left and right eye views.
External memory and YCBCR formats
enable processing of video and camera images,
while a collection of additional shader capabilities
improve compatibility, with shaders
written in HLSL and Open CLC.
Thanks to the support of device manufacturers and the work
we did in Oreo with Project Treble
to enable faster system upgrades,
you can test the preview on more devices
than ever before, including devices from manufacturers
such as Xiaomi, Sony, Essential, Vivo, Oppo, Nokia, and others.
Also, Developer Preview 2 is available through Android beta
on Pixel and Pixel 2 series devices so consumers
can try it out as well.
As always, your feedback is critical.
So please let us know what you think.
The sooner we hear from you, the more of your feedback
we can integrate.
Look in the video description for details
on how to report issues, and enjoy Developer Preview 2.
[MUSIC PLAYING]