What's new in Android
Hi, welcome to “What's new in Android.
” I'm Chet Haase from the Android Developer Relations Team.
So the question is, what is new in Android? Well, for one thing, the venue is new.
Normally, I get this once a year.
I'm a Google I/O.
I have a couple of co-speakers.
I miss my co-speakers here.
I also miss the venue, that beautiful stage.
But the talk is essentially the same.
I'm going to talk aboutthree things here, essentially, today.
One is what's new in the release.
We're going to talkabout features in Android 11 that are worth knowingabout for developers.
We're also going to talkabout things we're doing in non-platform things, like the toolsand the unbundled libraries.
And, almost most importantly, I'm going to talk about some of the resourcesthat you should check out to get more informationon all the stuff that I'm talking about and much, much more.
So, let's get going.
Let's start with UI because, I don't know, I kind of like this area a lot.
I worked in this a lot.
It's an interesting area;it's the visual stuff, right? A couple of things going onin UI that are interesting.
One is window insets.
This is a capability for yearsin Android, in the platform, putting information on other thingsthat are on the screen that are going to affect the insetswhere your content needs to be located in order to live in the same space.
Well, the keyboard is animated, and therefore, the screen space is smaller, your app needs to react to it.
But now we're providingmore information traditionally, you just get some geometry information about insets without really knowing what and how and who and why.
Now, we deprecated most of the methods in the Window Insets class, and instead, we added somethat are type-specific, in particular, window-type specific.
Now you can say, “Where is that keyboard? Or where is the navigationor status bar? Or what are the insetsfor this particular window? Very interesting, very possible to create richer experiences this way.
I'll get back to that one.
This is the way it works.
You basically implement a listener, and then inside that listener, you get the insets information, and with that insets, you can query, “Hey, is that keyboard visible?” Stunning new capabilitythat you never had before.
You can find outif the keyboard is visible.
Or you can actually getthe specific insets for the keyboard or any of the other windows– window types that are handledin the insets API.
So why do we enable that? One of the reasons, besides we needed to, was IME Animations is, by far, my favorite feature in the Android 11 release.
The ability to actually synchronize the content in your application with the animation of the keyboard.
So as the keyboard comes on, wouldn't it be nice if you knewwhen it was coming, how fast it was coming, and your application could smoothlytransition with it? Now you can in a couple of different ways.
You can listen for changes in a keyboard, so you can find out as it's animating where it is, how big it is, all of that insets informationdirectly frame by frame by frame, and you can synchronize with it, or you can even drivethe animation directly.
So if you look at the following example, on the left-hand side, you can see we're clickingin a field there, and that makes the keyboard animate, sort of pop into place, and normally, it would snap into place, and then the applicationwould snap to suit.
But you can see it's actuallysmoothly animating with the keyboard because it's gettingthose animation events along the way.
On the right-hand side, we're actually physically scrollingthe content in the application.
We're swiping that thing up, and as we do, the keyboard swipes up with it because we're driving the animationdirectly and manually in the application code directly.
So here's the way you do that.
If you want to listenfor animation changes and react to the automatic animationin the keyboard, you can set a callback listener, and then get that information as each step of the animation progresses and do the appropriate thingwith your content.
If, instead, you want to drivethe animation directly, then you can callthis control window insets method and drive it.
So you drive it for a particular window.
Here, we are driving itfor the IME for the keyboard.
We're giving it a duration -1, which means run forever, because basically, we're going to drive itstep by step by step based on where that gesture ison the screen.
You can give it motion interpolation.
You can handle cancellationif you need to.
And you can also get lifecycle eventsfor the animation.
So complete controlover the animation experience, and a completely synchronousand seamless transition experience for the user– much better.
So a couple of different places to gofor more information on this.
One is the sample that we sawscreenshots of is posted there.
So go to that URL to check that out.
The other one is ADB podcastrecently that we had, episode 138, we talked to engineerson the Window Manager Team who told us both how to use those APIsto get effective animations, as well as how stuff works under the hood, which is always interesting.
Conversations are about people, or people are about conversations.
A lot of the changesin the system UI area in Android 11 are around the concept of people, the people in our life, and ways that we can stay in touchwith those people more easily.
And one of those waysis through conversations.
In your application, you can post information through the already existingnotification system, such that we can bucket this information in a separate place in the UIdedicated to conversations.
So this is a top priority thing.
Chances are you probably caremore deeply about people than you do about, let's say, an update to an app, right? So why not put thosein their own place there and then allow people to actually change information about each of those conversations.
Let's say, for that last conversation, we see there with the school boards, well, maybe I care deeplyabout the information there, so I want to give you more informationabout how the system should notify me, and I also want to change the priority.
This is really important, so let's pop thatto the top priority queue, which changes the orderingin the conversations category for the notification.
So to create conversations, we're going to usethe existing notification mechanism with a little bit more information to create a person object, and we create a shortcut info.
It needs to be long-lived because the user should be ableto get back to that conversation, even if the application doesn't happento be running anymore.
And then, we're goingto pushDynamicShortcut with all of that information.
Then we are going to use MessagingStyle and create and push a notification, just like we normally would, except with a little bit more information.
Another thing that's enabledvery related is bubbles.
So you can see over thereon the top left of the screenshot, you got this bubble of information.
User taps on that bubbleand up pops this mini activity.
So you get directly into the conversation that was happening earlierin the application, but it's actually happeningin the UI on top of everything else.
So it's a really easy way for usersto access this information about people from whereverthey happen to be on the phone, instead of having to navigate, click, click, click, to get back to that conversation in some deep link in your application.
So bubbles were actually enabled already.
They were in Android 10, but they were enabledas a developer option.
So we were working on Android 10.
It didn't get quite to the finish line, so we put it inside developer optionsso developers could start playing with it, but in Android 11, it's enabledas a fully released feature.
So please use it.
In particular, please use itinstead of the System Alert Window.
That was the preferred wayfor applications to do this kind of UI before.
Basically, pop a transparent window up on top of whatever contentis on the screen, and then inside of that, you populate it with UI, like these bubble objects.
But don't do System Alert Window;instead, use the new bubbles API.
And you're already posting notificationswith this stuff anyway, especially if you wantto start integrating with the conversations.
Capability, a system UI.
So now, you just adda little bit more metadata to give it the bubbleinformation that it needs.
Users opt in to the bubble experienceif they would like to, and then you provide an activity, like this mini activityto go into from the bubble.
So the way the code looks is you createthis resizeableActivity because, again, it needs to bethis mini activity on top of the UI.
And then you create the intent for the activity you have for your bubble.
You populate that with shortcutInfo, which maybe you already created because you're doing thisfor conversations.
You populate that with bubble metadata, and then you createand you push notification with all of that metadata, and you're good to go.
Go check out the video, the talk called “What's New in System UI” for more details on all of this stuff.
Go check out this samplecalled BubblesKotlin in the Android samples.
And also go check outthe ADB Podcast episode that actually isn't posted yetwhen I'm recording this.
We've had a conversationwith the Bubbles team, and we had that before I recorded this, but it hasn't been posted yet.
I think it will be episode 140.
I think it will be called “Bubbles.
” I could be wrong, but it'll be something like that.
So check out all of those.
And now, let's talk about privacy.
Now, I'm not even surewhat I should say about this.
But let's talk about it anyway.
So we've made a lot of changes to privacy in the last few releasesbecause it is increasingly obvious, that it is increasingly importantfor users' data to be protected and for them to understandwhat's going on with that data.
So some of the thingsthat we've done in this release are both about protecting user dataas well as making it easier for developers to dealwith these changes over time.
One of those areasis data access auditing.
So if you're an individual developer, and you're working onyour own application, you've written all the code, you know it back and forth, maybe you don't have this issue where you are not surehow personal data is being accessed.
That's not a problem you have.
But now imaginebeing on a really large team, tons of developers, the code's been worked onfor years and years, and you see that the useris being requested for some permission for a feature– you don't even understandwhy we need that permission, or maybe the applicationis pulling in an external library that's asking for extra permissionsthat you don't think should be there.
And it can be hard in a reallylarge source base, especially using external libraries, to track that down.
So we created an API to handlethese situations specifically, going from the complexityof this huge application, what is going on where, to callbacks that give youthe information you need.
In particular, you registera callback like this, and then you get an informationwhen this information is requested, and then you can track downwhere that is happening in the code, and do the right thing about it.
So, in Android 10, we had a new concept of permissions that could be granted either when the applicationwas in the foreground, or for all time, even whenit was in the background.
We've extended that capabilityto include the idea of one-time permissions in Android 11.
This is the concept that maybe the user is okay with that application, let's say, having accessto your location right now, but if it's in the background, “No, that's enough.
” Right now, I understandwhy you need it now, but this is enough.
So we have this one-time permission.
So basically, when the applicationis being used in the current session, that permission is fine.
But then, the permissionis denied after that, and then needs to request it next time.
So the following questionfrom all developers is, “Okay, now what do I needto do to handle this?” And the answer is hopefully nothing.
So if you're using a best practicefor permissions anyway, where you have come into this new world where the user may deny youpermissions at any time, they may go into a settings dialog and actually turn off permissions that they granted you previously where your applicationhas to handle that reality.
If it can handle that reality, it can handle this one.
It just means that useris going to grant permission, and then system is goingto take permission away when you're no longer in the foreground.
So, hopefully, nothing to do here, but you should be aware of the situation.
Background Location is gettinga bit more restrictive.
This has been an ongoing trendin the last few releases.
In particular, you usedto be able to request foreground and background locationat the same time.
Now, those are separate operations.
Instead, you can requestthe foreground permission, and if that's granted, then you can take a separate step and ask for background permission.
And that takes the userto the settings dialog.
This is not a permissionthat's granted inline in the a
Hybrid IPTV
ReplyDeleteMany TV providers are now adopting a hybrid approach to IPTV to solve some of the issues with fully IP-enabled broadcasts. IPTV requires a great deal of bandwidth to transmit a ton of data at high speed.