Hey, everybody, my name is Dan Sandler.
I'm a software engineer on the Android System UI team,
and I'm here to tell you about the new stuff
in the system UI in Android 11.
First, how are you doing?
We hope you're well. It's good to see you,
although I can't actually see you, but it's nice to imagine.
We're okay, thanks for asking.
The team has been keeping busy.
I avoided giving myself bangs, so you're welcome.
We've got lots of bugs in the Android 11 Beta for you.
Sorry, we've fixed lots of bugs in the Android 11 Beta for you.
But we saved some time for features,
and I do want to talk about a few of them
just real briefly for you today.
We're going to talk about conversations, bubbles,
device controls, and the media player.
Alright, let's talk about conversations.
We know from our user research and our own personal experience
that notifications to and from real people are the most important to us,
they bring us the most joy,
they are also often the most urgent requiring prompt response.
Our user research team had a really great talk about this
a couple of years ago at Google I/O,
so I encourage you to go back and check that out--
a lot of those conclusions are definitely still valid today.
What we've done in Android 11
is added a dedicated persistent space for these notifications
so you can quickly see and respond to them, so let's take a look at that.
First, I'm going to show you Android 10 you got here on the left.
It's not bad, but could it be better?
We have some conversations that are interspersed
with lesser urgent notifications.
We have multiple chats from one app
compressed into a very small space in the grouping system.
It's hard to spot any particular sender's name or chatroom name,
and those avatars are really small and kind of off to the side.
Here we have Android 11.
The first thing you're going to notice is we've got a nice separate section
just for conversations
with a big section header to actually explain what that's for.
The next thing you might see is an unread message indicator.
We had that in Notifications before, but now it's nice and big
so that you can see if there's a chatroom that maybe got a little bit away from you.
It's much easier now, as you look up and down the shade,
to see the names of people in chat rooms that these conversations pertain to.
The primary action, the expand affordance is much easier to see and get to,
and of course, once you expand the notification
you can do in-line replies, predicted replies,
or launch through into the app.
And then, finally, we made those avatars bigger
and moved them all to the same spot, with the same margins.
It looks great.
The user can also long-press any conversation and mark it as important.
That will make it appear first in the list and break through Do Not Disturb.
That's a feature that notifications had already.
We made sure it looks really good and works really well
with the conversation space as well.
So, as a developer, what you're asking at this point is,
"What do I need to do to get my chat app into the conversation space?"
Alright, get a pen, there's a lot here, are you ready?
Step one, use MessagingStyle.
Step two, add a shortcut ID.
Yeah, that's it, just two... almost.
Alright, finally, a code slide.
Let's take a look at how we do this.
First, you want to create the
This is something you were already doing if you were using MessagingStyle,
since it's required for that API.
And second, you want to create a shortcut and register it with a ShortcutManager.
This might be something that you're already doing
if you have Launcher shortcuts or sharing shortcuts,
but now you're going to do that for your notifications as well.
There are a couple of new parts that I want to draw your attention to.
First, the fact that you're marking the shortcut as
meaning the system can hold on to it and use it in other spaces.
And secondly, attach that
Then finally, with your
you get to put it all together.
Make sure you include that shortcut ID,
and everything is going to work just great.
Alright, let's talk about bubbles.
You may remember bubbles from Android 10
when we showed it off as a developer preview feature.
Well, it has graduated from a developer preview
to a full user feature as part of our conversation system.
The user can grab a conversation that they're actively engaging with,
pull it out into a bubble that floats on top of the phone display,
as a part of a multitasking feature.
To do this, you're going to use the
which we introduced, again, last year in Android 10.
But the new thing here
is that you're going to add that same shortcut ID
that you put together for the conversation space.
The bubble is automatically going to pull the icon out of that shortcut ID.
Make sure it's an adaptive icon as well
so that it fills the whole shape of the bubble.
And then make sure, as before,
when you put the
that that
because this is a multi-window feature,
and that window is going to show up at a different size than the display,
so it needs to be prepared to be resizable.
In the coming weeks, we're going to have a talk entirely dedicated
to all things, conversations, bubbles, and notifications in Android 11,
so look for that coming soon.
Okay, let's talk about device controls.
This is really fun.
In Android 11, we've created a new dedicated persistent space
for your home and Internet of Things controls
so that you can quickly find and use them at any time.
We've redesigned the power menu for this.
It places your device controls
just a button-press away or a long button-press away.
As a user, you can choose the set of controls you use most.
Those will show up here in the Power menu,
and you can actually switch between different providers from different apps
that provide IoT and home controls.
To do this, we've introduced a brand new API
the android.service.controls API suite for device control providers.
It's one of our first Java 9 Reactive Streams APIs,
so grab your favorite flow implementation,
and let's get started.
Your implementation of the ControlsProviderService
has a few key APIs that it will need to implement.
The first one is to
so Publisher in Reactive Streams
means that's a thing that's going to be able to generate
new instances of the object as they change.
In this case, the Publisher is going to list all of the controls objects
that you know about as a provider
that the user might want to choose from.
There's a similar API that you'll also need to implement
that is just
This is what the system UI is going to use
when it knows which are the controls the user really wants to engage with
and just wants to ask you for updates about those three,
or four, or five or twenty.
And finally, your ControlsProviderService
wants to know when the user has clicked on a control,
and that's what performControlAction is for.
You're going to know what control was clicked on,
what kind of action it was,
if it was a click or a drag, something like that.
And then you're going to get a Consumer object
to which you can pass a status of
letting it know that you heard the response
and have actually made the change in the real world
that the user has asked for.
Okay, here's an example of one of those Control objects
that your publishers are going to push.
It's a simple object representing a light bulb.
There are a few pieces.
There is a
to long-press on the control and get back into your app
to be able to control all the things inside your app's context.
There's also a Template,
that tells the system UI how to actually draw that control.
And then, finally, wrap it all up together in a Control Builder
that hold some state,
that you then put into the publisher and send a system UI.
This is a more complicated example.
It's a description of a thermostat.
There's actually quite a lot going on there.
I'm not going to read through all the code here.
But this and a lot of other device types are supported by the system.
Go ahead and check the API documentation
with the 11 Beta.
Okay, finally let's talk about the media player.
This is mostly an end-user feature,
but there's a few APIs in here too to be aware of.
First of all, in Android Lollipop, we introduced the MediaStyle notification
so that apps didn't have to keep using remote views
for their media playback.
And most of you are using MediaStyle by now... most of you.
Android 11 creates a dedicated persistence space
for all of these media players
so that the user can quickly control and even resume content.
Are you seeing a pattern here?
Yes, we have a lot of dedicated persistent spaces in Android 11
for the stuff that we know users use a lot and need to be able to get access to.
So media controls now live in the Quick Settings panel
for easy access,
no matter what app is in front or which notifications you've received.
And yes, they even show up on the lock screen.
And we've even added an output picker right there in the media player...
you're welcome!
So I did say there was a little bit of API.
If you, as a media player app, implement MediaBrowserService,
your card can actually be resumed.
That means the system UI will hang on to it
and let the user go back and pick up that podcast
or that two-hour-long synthwave set
hours after they have paused it or possibly even after a reboot,
even after that media session is destroyed.
Okay, that's all I've got.
Go get the Android 11 Beta, try out those APIs,
report those bugs, we really need those reports,
and thank you for watching.
This was fun... for me.
Hopefully, for you too.
Still miss Chet and Romain.