[MUSIC PLAYING]
FLORINA MUNTENESCU: Hello, and welcome to I/O life.
I'm Florina Muntenescu, and I'm here
with Chet Haase, the Android Toolkit [INAUDIBLE]..
Hi, Chet.
CHET HAASE: Hello, Florina.
FLORINA MUNTENESCU: Tell me, Chet, what's new in Android B?
CHET HAASE: Are there new things?
Let me think.
Uh, yes.
In fact, there are.
So there's a few new things.
One of the important ones that we heard about in the keynote
too was about dynamic app bundles.
But I think there's another video on that.
So I'm going to leave people to do their own research on that.
Something else that was big was Slices and Actions.
So both of these are ways of propagating intents
that your application can take care of deeply
in other applications.
So you can propagate this information in a way
that maybe the Assistant or Search
can take advantage of that and perform that action via, like,
a button.
Right?
So it can say, oh.
I can handle this.
You put it in an actions.xml file.
And then Search or some application--
Assistant or whatever-- can propagate a button into the UI
so the user can click on that to perform that debatch.
And slices is kind of like that.
It allows you to perform these actions
but with a much richer UI.
Basically it's a way for an application
to propagate rich UI to perform all kinds of things
in another process.
FLORINA MUNTENESCU: How about the battery?
Is there anything else, finally, for battery?
CHET HAASE: How about that battery?
Well, we are all power users, unfortunately,
which means we need to keep working on things
that we can do at a platform level
to preserve battery for users to get longer battery life.
A couple of the things that are interesting that
are going on in this release includes App Standby Buckets.
So we determine the level of activity
that a user has with an application.
And based on that activity level,
we expose capabilities of the platform
to that application or not.
It may not be appropriate for an application
that the user hasn't actually run for a while
to be taking up CPU and battery doing
this thing in the background that, probably, the user didn't
want them to be doing.
So that's one thing.
Another is Background Restrictions.
So if we notice that applications have bad behavior
characteristics, things like holding wakelocks
for a very long period, which means the system can't
go to sleep, or waking up frequently or using services
when they're not on power that they shouldn't
be as frequently as they are, then
they'll be propagated into a list
that the user can see through Settings
and then disable background capabilities for that app
to make sure that the user has control with how much battery
is being used.
FLORINA MUNTENESCU: Cool.
So we have our Slices, Battery.
Anything else exciting in P?
CHET HAASE: Well, there's exciting and there's necessary.
One of the necessary things that's there is that
we're preventing applications from calling private API's.
It is possible now to call API's, which
are not in the public platform.
But through reflection or JNI you can get to these methods
anyway.
And we allow that because we didn't
have a way to really stop that.
You can sort of query this and go for it.
Well, now, in the arc runtime, we
can detect that you are calling these methods
from an application when they shouldn't be.
And we can prevent that.
So in the preview release, which we encourage everybody
to pick up and play with, we have these methods
in a light gray or dark gray list, which
means that you're going to get either a warning in the log
or a toast popping up on the screen.
So if your application is calling these and shouldn't be,
you're going to get a warning about it.
But when that release comes out, it will be on a black list,
and we'll simply stop it from being called.
So the call to action would be, go run
with the preview release for P, and make sure
that your application is safe from these.
And if it's not, then either fix your application.
Or if it is some facility that you absolutely need,
then maybe it's something that we can work on
and we can put it on a white list instead,
but you need to tell us that information which
is why we have the preview.
So give us that feedback.
FLORINA MUNTENESCU: All right.
There is this Android--
CHET HAASE: No, no, no.
That's a totally different object.
I think we need to talk about text.
FLORINA MUNTENESCU: Yeah.
What about text?
CHET HAASE: Text happened in my larger toolkit tape,
so I understand that.
In fact, you understand that.
I want to ask you about text.
So what happened in text?
FLORINA MUNTENESCU: So in text, we released a few new APIs.
Now, you can pre-measure text.
So this means you can move all of that measuring work
that takes quite a lot of time from rendering a character
to a background threat.
CHET HAASE: And why is that helpful?
FLORINA MUNTENESCU: Well, because then
the text is displayed faster, so faster rendering
means less frames skipped.
CHET HAASE: Sure.
So it's also good because, like, if it's
time for you to display the text and then you
have to measure it, it's not very helpful.
But a lot of times, you know ahead of time
when you're going to need that.
So you can actually, ahead of time,
shove it off to a background thread.
So that by the time you need it, then you
can display the text, which is awesome.
FLORINA MUNTENESCU: We added a new feature
for the user, the Magnifier, and we also added an API for that.
So we now have three methods.
Magnifier, Show Updates, and I think Dismiss.
And this means that, if you're developing your own custom
views that also display text, you
can also show that Magnifier in your cost view.
CHET HAASE: Also, it's not limited to text.
That's the cool thing.
We are using it for text, because we
wanted to make it easier for people
to manipulate the cursor.
But you can use it for whatever you want.
If you need a zoomed in view, that API is general purpose.
FLORINA MUNTENESCU: That's right.
And I think we also added some more
improvements on Smart Linkify.
Do you know more about that?
CHET HAASE: I do.
Smart Linkify is like Linkify, except it's smarter.
So we already had the ability to create links in a block of text
for you if we detect things like phone numbers and addresses.
That's been there forever.
But now, through machine learning
models that we have on the system--
which are used for things like smart text selection--
we can detect more complex entities there.
Like you may select a word which is
part of a larger phrase, which we detect because of the entity
detection in the model.
You can ask Linkify to detect those as entity links as well.
FLORINA MUNTENESCU: Can I now go back to this?
Because it feels like it's looking over our shoulder.
CHET HAASE: Ah!
Yes.
OK.
FLORINA MUNTENESCU: So what's with the Android
with the jetpack?
CHET HAASE: So Android Jetpack is a set of components
as well as architectural guidance
for helping developers build better Android applications.
Most-- I would say all Android developers--
are familiar with a lot of what is in Android Jetpack
already because we have taken all the goodness of Support
Library and put it under this banner.
And we are going to continue to add to that, specifically
with the intent of making Android development better
and easier.
So I'll give you some examples.
One of the big ones--
one of my favorite things about Support Library
is App Compact and the way that we
baked in the releases for certain APIs
into the package names.
So now we have package names like V4 and V9
with some of the APIs.
We don't even support those releases anymore.
So I think all of the existing developers
don't even think about it.
That's just noise at the top of their file.
Right?
It's one of those imports they never look at.
But I think if you're new to Android
or if you're looking at the documentation,
I think it's terribly confusing.
So we're doing a major refactor where
we turn all those package names into AndroidX dot whatever.
The other part of it is the existing Architecture
Components are a big piece of it.
Things like Lifecycle, Support, and Room, View Model.
All of that stuff is good.
Also, the new Paging Library, which went 1.0 this week--
Paging and Recycler View.
And we have two new things.
Actually there are two sides here at the demo table.
We have Navigation Controller, and we have Work Manager.
Navigation Controller makes it easier
to create the links of the flow of your application.
It makes things like up versus back easier.
And we also have a tool in Android Studio,
where you can visualize this and create those links.
So it's sort of an integration of the APIs
as well as the tool for making this complex application
flow a lot easier to develop.
And then Work Manager is about an easier way for creating
and executing background tasks.
So before, we would recommend--
well, JobScheduler is really good for scheduling things
in particular times.
You know, when Wi-Fi is there or when you're charging, whatever.
And that works really well if you're on Kit-kat and above.
What if you're on an earlier release?
Well we also have JobDispatcher, which
is in the Play Services APIs.
Well what if you're on a device that
doesn't have Play Services?
Well, then you're probably rolling your own solution.
So applications would need to do all three of these.
Work Manager is an attempt to have a simpler, more elegant,
fluent API for doing all this stuff
that handles all of that for you.
FLORINA MUNTENESCU: Right.
So lots of new things, both in Android but also with Jetpack.
So check out all the videos that we
have from Google I/O. And also check
out the documentation on Developer.Android.com.
Thank you, Chet.
CHET HAASE: Thank you, Florina.
FLORINA MUNTENESCU: This is Florina from I/O Live.
[MUSIC PLAYING]