Google I/O 2014 – What’s New in Android (Full Transcript)

In KitKat, we introduced a translucent status bar, which was great for wallpaper experiences and things that wanted to go full bleed. The problem that we struggled with was that gradient that we put in there to protect the status bar and navigation icons didn’t work great in every situation. It’s not a lot of space. We didn’t want to overlap the app window. We didn’t know what was going to be in the app window region.

So in the L Developer preview, you’ll be able to see that you can do a lot of things with the status bar that you couldn’t do before, particularly change the color to something that matches your application’s color branding, and so forth. You can use a solid color there, or you can use a completely transparent status bar, and then it’s up to you to make sure that all the status bar icons, all the navigation bar icons still look great.

But as you can see here in the screen shot, that gives us the opportunity in Google Now Launcher to create a nice, long gradient that both protects the icon so the user can see them and gives you a really nice transition into the content. Check it out.

You heard about power a bunch in the keynote. And we’ll talk a little bit about it here. There’s so much more to look into under the heading of Project Volta. The first thing you’ll see is that there’s a battery stat service that you can ask from ADB to give you all kinds of gory details about where the power is going on the system, what kind of power events there have been, and break it down by UID, as well as looking at the global story.

There’s a tool in the SDK called Battery Historian, which I believe Dave Burke mentioned, that gives you sort of a trace view like HTML graph output. You feed it a bug report, and it will tell you essentially what happened to all of the power in that device over that session. It’s incredibly, incredibly useful. Just a quick example of how to talk to these things, you can talk to batterystats and say, oh, you want to turn it on, you want to enable the full history, clear out all the stats, take a bug report, and then you stuff it into the historian, and you get out this great piece of graphics that you can use to understand where those coulombs went.

Another thing that helps with power, and this was also touched on a little bit in the keynote, is JobScheduler. We’re going to go a little bit deeper here. It’s pretty common that you’ve got an app that wants to do some work later — sometime in the background, sometime when it’s plugged in, sometime when you have access to an unmetered high speed network. So you can do all this today, right? You probably do in your app.

You wake up periodically, check the conditions, and then go back to sleep if the situation isn’t right. That’s not super efficient because you are waking up the device just to check to see if it’s a good time to wake up the device. JobScheduler is here to help. It wraps it all up into something that the system can do and essentially call back your job when certain conditions are met. And you see a little bit of code here.

The interesting part here is that you specify the capabilities you need, and then you just give it a component name, and you’ll get that component name called when the time is right. Very handy. Also in the framework, some improvements to the Storage Access Framework, which we introduced in KitKat in API 19. Previously if you wanted to pop up a file browser and ask for a directory, you couldn’t do it. Now you can.

Once an app receives a whole directory from the picker in this way, you can actually explore the entire subtree of documents and do whatever you need to do with that whole directory. Also in our framework are some new things around networking. A couple of different topics.

First one is multi-networking. We talked a little bit about JobScheduler being handy for doing some work later under a particular kind of condition. What if you need to do work now? Your service is running now, your app is running now, but you need to open a socket on a link that has some particular feature– some carrier future you need, needs to have SMS capability, it needs to be unmetered, and so forth. ConnectivityManager now supports the ability to handle these network requests. You say requestNetwork, and you give it a call back. Inside that call back, you will find out when a network meeting your criteria becomes available, and then you can use that network object to look up hosts and open sockets on that link specifically.

The other nice thing about the call back, and this is very cool, you get warnings, when possible, when the network is about to go down. This allows you to actually do a graceful handoff in your app from one link to another. Oh, you’re about to lose Wi-Fi because you’re leaving its range.

We’re just going to move this over, rebuild the stream on cellular with no interruption to the user. Also under the banner of networking is Bluetooth. We introduced in 4.3 Bluetooth Low Energy. In L, we are now adding peripheral device support to BLE. So you can provide services and scan for services pursuant to the way that Bluetooth LE peripheral devices do that sort of thing. Check out the Android Bluetooth LE package for more on that.

Finally, under networking, we have NFC changes. NFC has been a little hard to use for users, a little hard to use for developers. We’re trying to remove all those pain points. We’re now showing Android Beam in the Share menu to make it easier to go ahead and start an NFC transmission from the user standpoint.

From an app standpoint, I don’t know if you’ve ever had a situation where you’re trying to pop up a dialog saying now hold your phones closer together. Now you can actually specifically start a Beam operation anytime you want with NfcAdapter.invokeBeam.

4Another thing that has been a little harder than it needs to be is creating a very simple piece of text to push over NFC. Now there’s a method on NdefRecord to let you do that. And there’s a bunch of new CardEmulation stuff that I can’t begin to explain because, as Chet explained, we don’t know what it is. So you should check that out.

And now as a sub head of the frameworks, we’re going to talk about notifications. There’s a lot to talk about here.

Chet Haase: It’s a visual side of the non-visual side.

Dan Sandler: The visual side of the non — that’s right. It’s layers. There’s a lot to talk about here. It’s so key to what we’re doing with L for the user. There’s a lot to talk about with notifications. Also, it’s an area of my expertise, and I have the clicker, so we’re going to talk about it for a while.

I’m going to look at four different categories, how they look, how they work. We’re going to talk about how that interacts with the lock screen and some privacy features we’ve added to make that work for everyone, additional metadata that every app needs to start putting into its notifications to make sure you’re ready for L, and then finally we’ll touch on Wear just a little bit. They’ve got great talks later in the program, but I wanted to just mention some of those interactions.

So first, the new style notifications in L. We should take a quick look back. These are the different versions we’ve had just in the last five years. We’ve had a little bit of evolution. I don’t know if you can see the differences there.

Chet Haase: We’re getting blacker and blacker — how—

Dan Sandler: It’s a dark time for the rebellion right there at the end. Here we have notifications in L. We’ve moved to the material style. Let’s go through and take a look at the pieces here. So first I want to show you that we are in fact using the material theme. We are in line with the rest of the material design system that we’re introducing for Android with L. We’ve got these card-shaped backgrounds that cast shadows.

ALSO READ:   Guy Kawasaki Discusses The Art of Innovation at TEDxBerkeley (Transcript)

The foreground is now dark text, dark icons, and the background is this light color. I should point out at this point, if you’ve been following the icon guidelines, there are no new icon guidelines again, by the way.

Trying to keep that going. But if you’ve been following the icon guidelines, you should now have small icons for notifications and for actions that are effectively masks. And in L, we’re actually going to treat them as masks. We’re just going to use those to draw in the correct color. As Chet was alluding earlier, that’s something we’re trying to do more of in L.

So if you have any opacity baked into your icons right now, now is the time to get rid of it. Those should be full opacity, white on transparent icons everywhere.

The next thing I want to draw your attention to is this accent color. This really looks great and can really make a notification pop out and showcase, again, that sort of color story that you may be trying to tell with your app. It’s just one method on the builder, setColor, and it fills that nice circle right behind the small icon on the notification inside that layout. I should point out that if you have a large icon in the past, we’ve kicked that small icon, that important symbolic representation of what that notification’s about, we’ve kicked it over kind of to the side, where nobody notices it.

Now we’re going to keep that color circle, we’re going to keep that visual story,

24:28and we’re gonna shrink it down to a little badge that goes right in front of the large icon. So it’s always right where the user expects to see it. And then finally, it just bears mentioning that everything else you know and love about Android notifications is still alive and well and showcased great in the L developer preview. Expanded views, action buttons, and as always in Android, if what you need it extends beyond what we’ve been able to come up with in our templates, customer remote views are there for you and available.

Now, I will say that one of the things that people have said to us is, well, okay, that’s all fine and well, but I have to make a media player, and for media players, people expect transport controls, and then I have to go deal with custom remote views and all that pain. We’ve been suffering along with that basically since Honeycomb. No longer.

We have a new template for you, the first one since Jellybean– MediaStyle. Material design finally comes to media playback. If you use this template, you will opt into, essentially, the design created just for you by the Android UX team, designing something that will look great both on the lock screen and in the regular notification shade.

One other thing that you’ll notice about this is that the accent color fills the entire background of the card.

Chet Haase: It’s orange.

Dan Sandler: It is orange. I wanted to make sure they could see it from the cheap seats. What am I saying? This is Google I/O. There are no cheap seats. The accent color fills the entire card, and that helps it pop out when you’re looking at the lock screen. That’s where your media is coming from. For the first time, we’re going to let you actually use up to six action icons. In fact, you could always attach up to six, we just only show you the first three. If you’re using MediaStyle, you’ll get all six, and we draw them as little transport controls here, which is super handy. And in fact, we even let you use one or two of those in the compact form of the notification, again, to make sure that wherever you see that notification, it’s a great place to play and pause media.

There’s a custom ProgressBar that fits with the theme, but most importantly, you don’t need to use RemoteViews anymore just to do simple media playback. I mentioned a little bit earlier that there’s a MediaSession API.

There’s also a bit of the MediaStyle that allows you to attach your MediaSession token right into the notification, which is going to tell the system UI, hey, this thing is playing back media right now, which is going to be important as we start to do things like integrating more metadata from that track, more metadata from that ongoing playback, into the system UI.

So for example, if you take a look at the L Developer preview, you’ll see that album art is regrettably not showing on the lock screen right now. I was working on that on the plane. I couldn’t quite get it done in time. I’m sorry. But when we have it in L, it will use this connection to MediaSession to get that metadata right out of your ongoing play back in real time.

Very quickly I want to show you a wall of code, because everybody loves that. The important thing about this is just to note that most of these APIs here are the existing notification APIs that you know and love. They’re the five actions that are in the demonstration there. I’m setting the color, and then right there at the bottom we’re doing Notification.MediaStyle, which lets you attach the media token and then pick which of the actions to show in the compact form.

Something else you saw in the keynote, it kind of went by quickly, and I really should have put a video in here. So it went by so quickly, it disappeared from this slide. Heads-up notifications is something that we’ve added to L to make it easier for important things to get in front of the user without actually taking you out of context.

So in the past, if a phone call comes in, you’re in the middle of playing a game, that activity is paused, that activity goes away. If it was a multiplayer game, that’s a great way to cause somebody’s game to freeze so that you can tag them or what have you. No longer. Heads-up notifications are the new way for important things to get the user’s attention without stealing focus away from the app. When that pops up, you can look at it, you can decide to ignore it, you can decide to swipe it away, you can decide to just push it back into the notification shade without swiping it away, or you can act on it by clicking one of the action buttons. We’re using this for things that the user needs to deal with, the user needs to see.

So high priority notifications will show up there. Notifications that involve people, we’ll talk about that in the metadata section. Similarly about notifications that buzz, make noise, or that would use the full screen intent, which is the way, of course, that phone calls and alarms and things like that would take over your whole screen just from a notification.

Let’s take a little time and talk about the lock screen. So this is a big part of L. You saw this in the keynote. We heard you like notifications, so we put your notifications in your lock screen. It’s there any time you want to look at it. Why would we bother doing this? What is the point of this? Pre-L, the workflow of your phone going off, your phone buzzing in your pocket is you hear it buzz, you hear it ding, you reach in, you take it out of your pocket, you turn it on, unlock the screen, pull down the notification shade. By the time you’ve gotten through all those gauntlets, you’ve forgotten what you came there for, and there’s some– five other things– your email was sitting there before you pulled down your notifications, and you’re already distracted.

In L, you hear the phone buzz, you take it out and turn it on, and that’s it. It’s right there. It’s completely glanceable for everyone using an L device.

ALSO READ:   Why We Go: Leaving Our Beautiful Home and Exploring Outer Space by Will Pomerantz (Transcript)

But what about privacy? So for many users, the design that we showed in the keynote, the design I just described, is a perfect trade-off. It’s okay for you to allow your notification content to show up on your lock screen because that’s super useful to you. Unauthorized users are still not be able to get into your phone without authenticating, but that doesn’t work for everyone or every IT department, particularly in a bring your own device scenario.

So we’ve introduced something in L called notification visibility. This is a new privacy feature for notifications specifically about how they interact with the lock screen. It lets apps specify what is safe to show where. It lets users specify whether they care about this level of privacy, and device policy can be involved as well.

So to explain this, I have to dig into the spheres of visibility. I need an echo, like a reverb for that. Spheres of visibility. This is the public sphere. This is all the things anyone can do with your phone. You can do it, Chet can do it if he picks up your phone, the person who picks up the phone at the bar when you’ve left it on the bar stool. These are all the things that you can do from the lock screen without authenticating. The circle inside, these are the private things. These are the things that only you can do with your phone, because you know how to get into it. You can authenticate. You can get past the lock screen and get into your notifications, your email, your apps, your games, your data, your pictures, and so forth.

So in the notification visibility world, we call this central– this ring of the things that only you are supposed to be able to see — visibility private. A notification that is marked visibility private is very much like an Android notification up until now. That is to say we don’t leak anything about it on a lock screen where the user has said that they care about this sort of thing.

All you show is the icon, and in fact, in L we also show the application name to help fill the space. If you set a notification to be visibility public, you’re saying this notification has nothing sensitive. It’s completely unobjectionable. It’s the weather, right? It’s your device is low on battery. This is not information that is personally sensitive. It’s safe to show on any lock screen, no matter whether the user is concerned with that level of security. There’s a little ring here that I didn’t mention before, which is the things that are private that you can kind of see on the lock screen.

I told you that in L, we continue Android’s tradition of showing notification icons, even if you haven’t authenticated. So one of the things that you can do now in L, I’ll show you an example in a minute, is say, if you’ve got a private notification, where the user doesn’t want to see all that sensitive information on the lock screen, you can provide a substitute, a public version that lets you provide a redacted form of that same notification for a sensitive lock screen.

We’ll see an example on the next slide. I do want to mention also that now that we’ve created all these circles, all these pretty builds in the slide, there’s one little spot that’s left, which is things that only you know are even there. We didn’t have an opportunity to do this in Android before, so we’ve created the third and final visibility level, which is visibility secret.

 

If you post a notification that is visibility secret, it doesn’t appear on the lock screen at all. So if it’s particularly sensitive and you would like to get notifications for it but you don’t really want anybody else to know that it’s installed, visibility secret is for you. Okay, here’s that promised example. So let’s say the user has said, this is important to me. They’ve set up a pattern or PIN on their phone, and they’ve said, when the device is locked, I want to hide the sensitive notification content from the lock screen.

If you have a notification that is visibility public, this is what you see on the lock screen. I may or may not have overseen that on a lock screen somewhere. Anybody can see this notification whether they’ve authenticated or not, whether the user cares about security or not. This is safe for everyone.

Chet Haase: I don’t think so.

Dan Sandler: Well, so this is why you would say, maybe this is something that’s visibility private. A chat app is the sort of thing that maybe is supposed to be personal.

Chet Haase: Should have been.

Dan Sandler: Should have been. Really. You should think about that next time. So if you have a visibility private notification on a lock screen where the user has said hide sensitive notification content, this is the experience you’ll see by default under the L Developer preview — icon, app name, nothing else.

So if you as an app want to provide a better experience, you can provide that redacted version. You can create a public version of the notification, you say setPublicVersion, you construct a whole new notification object that is a substitute for that one to be shown only on the lock screen. And so in this case, we’ve corrected, we’ve changed the app name a little bit. We’ve added an exclamation mark because that makes people feel cool. And we’ve actually given the user some interesting information. You have a new message. It’s not simply something is happening from this app, which could be I have a sync problem, or you need to pay $5 or whatever, it’s actually giving you a little bit of information, but it’s not sensitive information. So it’s compatible with the user’s wishes.

And then finally there’s that visibility secret, and those things wouldn’t show up at all. Now of course, if the user goes and says, well, when my device is locked, I actually don’t mind seeing all my notifications there, then you see the same thing. It essentially is every notification is public. We talked a little bit about metadata, about adding people and things like that. We actually talked about metadata in KitKat. We’ve started to introduce some new features to be able to stick more information onto notifications for the benefit of the system UI and any notification listeners that the user may have enabled.

Well, we’ve got more for you in the L Developer preview. One of the reasons that we want to do sorting a lot better. There’s limited space to show notifications on the lock screen. In the past, sorting things chronologically, maybe with a little bit of priority, it’s good — it’s not great. We’re doing better in L. So one of the things that you can do in L to make sure that notifications get sorted in the right way so that users are seeing the most important stuff first is attach, first of all, a notification category.

We have a number of categories that are in the notification API. It’s a set of essentially a global partition of notification space. If what you have doesn’t fit, you don’t have to set a category. But if your thing is an incoming voice call, or an incoming video call, or you’ve got an alarm clock app, high timely team, then you can tag your notifications with that category and make sure that the system UI knows what kind of thing it is.

And as we improve L, we will be able to do more things to sort of mute things that are not relevant to the user’s current context. We’ll use that category to do it. There’s a new extra key for the notification extras called EXTRA_PEOPLE. This is for you to be able to say this notification relates to a person that the user might care about. What do you put in here? You put in a URI from the contacts provider, or you put in a telephone number if that’s all you have and you’re not integrating with Android contacts, or you put in an email address.

Leave a Reply