>>daniel sandler: hi, everybody. my name isdan sandler. i'm here to talk a little bit about daydream. oh, i recovered that slideso we're ahead of time. good. i'm on the system ui team, which is part ofthe android platform team, which is what exactly is -- it's typically made up of two piecesunderneath the hood -- and if you haven't built your own ram because you don't livein a cabin in the woods, you may not be familiar
Android daydream, with these. one of them is the launcher -- you'veprobably seen that -- and the other one is everything else.so system ui covers basically the launcher plus all the other pixels on the display thatdon't belong to the app, notifications, navigation, gestures.i see we have an obsolete screen shot here.
i'll put that away.and in android 4.2 we brought in something called daydream as part of the system ui.it's a screen saver essentially. so why did we bring this in android? to understand wherethis future comes from you have to go back -- set the way-back machine to 2009 and themotorola droid or milestone depending on your locale. a great little device, built likea tank. i remember when i thought this was a huge phone.and this was -- we're really excited to launch this with a number of really cool accessories.it was the first time we had done this with a google-involved android phone.we had the desk dock or the multimedia station. we had the car dock. we did not ship thatone.
[ laughter ]>>daniel sandler: but what all these have in common is that they invoked a dock modein the platform which is new to eclair. and what happens in dock mode is you launch dockapps. what is dock apps? well, in case you haven't seen it, here is a screen shot ofthe beautiful eclair dock experience which was built into the desktop application inandroid 2. and it's got all kinds of great features. look at all this stuff. it's gotyour next alarm. it shows the date. you can see your wallpaper through it. it shows thebattery right underneath the real battery. you can switch it to night mode so it doesn'tblind you or the person next to you while you're sleeping. it shows the weather andthen it has all this other stuff, these crazy
little buttons at the bottom. so you can goto the alarm because you need to change your alarm.there was a slide show button that did something weird in gallery. there was a music buttonthat did something else. and what is this doing here? why do we have another home keyagain not so far from the main home key? well, we decided that if your phone was ina dock that the most important button on the device should take you back to that dock appexperience so it's really convenient too, but then you needed a way to actually gethome so we added this whole rigmarole. what a mess.and i should mention we discovered when we were building this that if you show this greatglanceable information on a dock for hours
at a time, say while you're sleeping or whileyou're at work, it can actually burn into the lcd or the ota screen. how very 1990s,right? so we had to implement a screen saver into the dock application, and every otherdock application would have to do the same thing.we toned it down a little bit in honeycomb and ics, but dock apps has basically beenthe same since then. most of the code inside it is not dedicated to showing the time. it'snot all that hard. most of the code in there is to give you a way to get back to the launcher,to handle the screen saver timeout, to track the power status of the device. there's awhole bunch of fussy way clock things you have to do to be a well-behaved dock application,but the basic idea was kind of interesting.
dock apps are like bow ties. they're cool.you have this customized user experience for a particular situation. i've set my devicein this little box that is going to make it do something different. it's very easy forme to just drop it into that dock and get a cool experience, full of this glanceable,sort of ambient information that is otherwise not appropriate to show on your device becauseyou want to save power and it's not plugged in, so you turn the screen off.but dock apps were pretty annoying, too. we had to do this whole home key capture thing.we got a bunch of feedback from users that it was confusing, that they couldn't go homewhen the device was in a dock or that they had to figure out and learn whether to actuallysupport that. and it required you to shell
out 50 bucks for a special piece of hardwarejust to have the privilege of being able to use this dock application. or like my friendjeff in the cambridge office, you can build your own. this would be back to the cabinin the woods department. it had some nice features. he put in an nfc button so it wouldlaunch his favorite application when he put his nexus s in there. it sunk into the chargerat the bottom, went with any decor. it was very nice.but the developer experience for this was awful, too. not just confusing for users,but as a developer now you have decide, okay, am i going to take over the home key or not?and if i do -- if you don't take over the home key there's no way for the user to getback to your application so you've got to
do an ongoing notification, which is grossfor other reasons. by the way, i'm also the notifications guy,so i don't like those ongoings. and then if you do decide to take over thehome key then now you need to allocate space in the ui for a launcher button, which ifyou're trying to create a delightful experience, it is not the first thing you want to do.so as a developer you have to deal with the whole issue of way clocks. if you put yourdevice in the dock, it goes on the charger and if you want a nice dock app it's got tokeep the screen on. so you've got to hold a way clock, but now you have to watch andsee if the device is removed from the dock and remove the way clock and all this kindof stuff. and then you have to deal with the
whole screen saver thing so you have to implementyour own idle timer, which means you have to duplicate the idle time and functionalityin the system. it's a mess. we wanted to do something better for developers.we wanted to do something better for users. that's where daydream comes from. we kindof introduced it quietly along with android 4.2 last fall. there was a blog post aboutit later -- late in the winter to sort of describe it. we haven't really talked a lotabout it, but that's what i'm here to do today. features of the daydream -- the daydream apiis they should be really easy for developers to write. it should be a fun afternoon projectfor you to sit down, take existing pieces of your apps ui or build something completelyfrom scratch and have something running quickly.
they need to be launched automatically forthe user just like dock apps did so it's easy to get into this feature.we want to offer the full api available to android applications. any way you want todraw, any way you want to interact with the users, daydreams should allow you to do it.and we wanted to give you a whole bunch of other stuff from the platform to make writingthis whole thing a lot simpler. so daydream is a feature that the user willencounter when? well, while docked. if the user drops the device into one of these things,daydream will start automatically if this little button is ticked. the second optionallows you to daydream more like a screen saver, so any time it's plugged into somethingthat will charge it, your device will idle
out. instead of into a screen that is off,it will idle out into daydream. so daydream basically replaces the screen off when thedevice is charging if you have that second button ticked.and the third radio button will allow you to cover both cases.the default for android 4.2 is just while docked so that people aren't surprised bythis new behavior, but this is where you would go to inside settings and display to changethe way that daydream starts up. daydream will not, however, automaticallystart if something is holding a wake lock. so if something else, some other app is keepingthe screen on, daydream isn't going to automatically turn on after an idle timeout, which i toldyou daydream is supposed to replace screen
off so this sort of works. this follows thoserules. it also works really well because apps thathold the screen on like that are sending us a really strong signal. they do not want tobe obscured. the user is looking at this. even though the user is not touching it, theuser is not tickling that idle timeout, the app should continue to be visible by the user.so video playback is the canonical example. other dock or kiosk apps sort of bespoke experienceswhere the user might not be interacting with it for awhile, but it needs to keep that screenon and not obscured. again, they hold a way clock, daydream won't trigger.finally games. most games are interacting with, so it's not a problem, but if therewere some kind of game where you were going
to stare at it for a very long time -- maybeit's an eye-tracking game, i don't know -- if you hold a way clock, daydream isn't goingto start on top of it. so i said that daydream should be easy towrite. this is essentially the core of the implementation here. step 1, extend dreamserviceand step 2, go nuts. do whatever you want. we'll get back to lots more code examplesin a little bit, but right now i want to draw your attention to we've got a method on dreamingstarted and we want to override and set a content view just like we were in activityand then whatever you want to do, you're free to do that until the daydream ends.so you might ask okay, if this is so much like an activity why not make an activity?why make it a service?
we tried it internally or we thought internallyto build the whole daydream infrastructure just based on plain old activities.it didn't work so well in practice. there was a bunch of bookkeeping that you had todo just like a dock app. so we weren't saving the developer a whole lot of work. card managerhad a hard time keeping track of this so it could be automatically started and stoppedwhen you docked and undocked the device, things like that.and the most important thing is that you were running in the wrong window layer. if youimagine android, there's the wallpaper and there's a bunch of applications and a bunchof systems stuff like the status bar and dialogue boxes. those activities are running in themiddle. so if a dialogue box comes up it's
just going to sit there on top of an activityindefinitely. so if you have a great screen safer and anota dialogue comes up, that's going to be burned into the device by the next morning,so that's not going to work. getting back to the features of daydream,i said that once you had set up your content view and triggered on dreaming started youcan basically do whatever you want, and that includes this entire suite of layouts, widgets,however you want to interact with the user. like i said, it's basically the entire androidui toolkit is available to you in a daydream. and i want you to take a look at the way thiscontrasts with the other things that we've allowed you to do as sort of these kind ofcustomization tools.
so app widgets, for example. if you implementa widget for the launcher it's the same kind of glanceable information, right? it's therekind of when the user happens to be looking at the device, maybe is about to do somethingelse. you can show the weather, time, what have you, but you really only get those toptwo bullet points and even then it's a little weak. you get some of the standard layouts,you get some of the widgets, only those that have specially been marked to be viewed asremote views. you don't get the full ui toolkit and you really don't get the full suite oftouch interaction either. you get clicks, that's about it, because everything else isreserved for the app widget host, the launcher, the thing that needs to be able to move widgetsaround. so that's not all that rich and exciting.
we also have live wallpapers. we have livewallpapers that let you do kind of whatever kind of drawing you want to the canvas ofthe surface that you're handed, but you don't have access to the rest of the ui toolkit.you can't use views to lay things out. you can't interact with the user. you sort ofget touches, but if you've written a lot of wallpaper you know it's not all that satisfying.and you certainly can't do this other stuff like view animation or video playback. sodaydream lets you do all this. daydream has access to the complete ui toolkit so you canbuild really kind of whatever you want. there are some other freebies. i told youyou get free stuff from the platform when you implement a daydream. you are automaticallystarted and stopped. you don't have to worry
about that. you don't have to worry abouttracking user's idle time. you don't have to worry about dock events. that's all handledfor you. you just look for the dreaming started and stopped life cycle events.i mentioned you have access to the user's touch and interaction and so forth and thekeyboard, too. if you choose to be non-interactive, if you just want to make flying kitchen appliances,if that's your thing and you want it to dismiss as soon as you touch the screen, that's reallyeasy. you say set interactive false and again daydream takes care of the rest for you.and finally, you get that crucial special window on top of the device. i know, i know,there's that other way to get windows on top of the device. that's gross. don't do that,do this instead, please.
but i still haven't gotten to the why. whydo you actually want to go and implement this in your app? okay, it's fun and easy, butwhy should i take the time? i'm busy. i'm an android developer. i read reddit. i don'thave time for this kind of thing. so i argue that this is a chance for yourapp to be free, to finally be free of all of its features, all of its use cases, allof its menus and its settings, free to be experimental, free to be weird, free to delightthe user. in a daydream you don't need action bars,you don't need settings, you don't need fragments. you don't need all that serious business stuffin your application. this is an opportunity for you to make the art exhibit version ofyour app. it's fun.
so okay. this is a developer conference. whereis the code? here it comes. get ready. the first one we're going to do, we're goingto build a very simple daydream. and let me show this to you on the nexus 7 over here.i'm going to switch and see if i can do this. apparently the answer is no.there we go. so this is not the one i wanted to show you.so this is the first daydream that we're going to build here. it's really, really simple.it moves something around the screen. i know we talked about this as being very1990s. this is very 1980s, but it's an important building block. any time you build somethingeven more sophisticated, you probably are going to have some arrow state or some messagethat you need to move around the screen. you
can just pull this code directly in.so back over here on the slides, the implementation starts like this: this jumper class, i'm goingto extend frame layout. you could do some other view group or whatever. i like framelayout. it's easy, it's pretty simple, and allows you to put other stuff inside of it.so jumper is going to be a class, it's a subclass of frame layout that moves itself around insideof its parent, and whatever you want to put inside of it, like a picture of dianne's cator an error message or fortune cookie or whatever, it doesn't care.here is a runnable. basically what's happening here is it's looking at the bounds of itsparents, looking at its own bounds, picking a new random spot and then doing it againin two seconds. this is very simple view kind
of stuff.and then when it's attached to window it's going to fire off that runnable for the firsttime. so as soon as you put this view into a window it will start bouncing around.it's important to note -- on the next slide. on this slide i'll show you the xml for thisis really simple. the frame layout for the whole screen is on the outside and the jumperis in the middle and it will move itself around. so what is important to note is that thereis really nothing daydream specific so far. this is like straight up view programming.if you went to implementing your own custom views earlier today you saw even more sophisticatedexamples than this. this is pretty straight ahead. where is the daydream aspect of this?here's dreamservice again. i showed you a
little snippet of code earlier that lookedlike this. ondreaming started. i'm going to set content view to that layout that i justdescribed and that's it. and in fact, i mentioned the very simple activitylike life cycle of a daydream before. this is how it goes: attached to window, dreamingstarted, dreaming stopped, detached from window. so you can override these things. most ofthe time all you need to do is override ondreaming started, set up a layout and run with it.it's very, very easy. the last thing you need to do is declare thatthis is a daydream, so you can see it in settings. you do that through the android manifest likeeverything else. inside your application you have a service mentioning your daydream, andthe important bit here is the action, the
intent filter. android service dreams dreamservice.that's how settings knows how to find you. that's how the dreamservice knows how to startyou. okay. all right. so this is boring. let'sget a little fancier. so remember i told you that daydreams could do anything, includingview style animations, right? so we're going to go ahead and go in here,and this is our old code. you see it does set x, set y. we'll replace those with thefluent interface. now it's animate x, animate y. and hey, let's just throw in rotation justfor fun. so let's see what that looks like, and i have that running over here as well.there we go. all right. now, this feels high octane. i'm excited about that. i'm not suredianne's cat likes that so much. we'll have
to see.should we keep going and make this more interesting? let's see here. i'm going to show you thisthird jumper example here. so this is the same kind of thing, just moving itself aroundwith a slightly different kind of rotation pattern.but remember that i told you that the way we implemented this is that you drop a jumperview into anything and it will move itself around in its parent. what that means is wecan go and throw more of these in. like you want this to be more sophisticated, let'ssee if we can tempt the demo gods here. maybe they've had their fill.and oh, you're not seeing this on the other monitor. all right. move. move our code overthere. you can't see that. i can't see that
either.what we're going to do here is i'm going to add some extra stuff here. so let's see. wow,i really need a larger font to do this on the monitors down there.we're going to add some extra views here. i'm going to copy this one, make another one,add a whole bunch. doesn't matter. let's see here. and then i'm going to getsome more of these, too. so again, the nice thing about implementingthis all as basic view stuff is that anything that works in an activity will work in a daydream.so we're going to go ahead and see if we can run this. did i get any compilers? no, believeit or not. i shouldn't have tempted them. let's go backto the wolf.
all right. let's go back to the wolf.there we go. oh, there we go. much better. so just adding more and more views to theparent. again, daydream doesn't care. daydream will let you do whatever you want. we couldship this. this is pretty good. all right. let's go back, go back to the slideshere. okay. so, again, you can pull this sourcecode and maybe with less spinning and use it as the error message in your own implementation.so that's, you know, a couple of canned animations in a row. now let's move on to continuousanimations. so often instead of doing something periodically, you often want something movingall the time in your daydream. there's lots of ways to do this. i'm going to show youone such.
and this story starts over winter break. thisis a little art project i did with my son. there he is dressed as a pirate. there heis. awesome. i had him sit down and draw some snow flakes and a snowman for me because wewere vacationing in texas where there is no snow. we took a picture of it. we pulled itinto a bunch of sprites and then dropped it into something very similar to the code you'vealready seen. so i'm going to go ahead and switch back over here and show you what thatlooked like. here was his snow storm that we can enjoy anytime.so this was nice; right? it turned out really well and it was really easy to do, again,with daydream and the view animation stuff. i'll show you who this work right now.so rather than implementing a view that moved
itself around in its parent, now we're goingto implement this as a layout that animates all its children. you can throw whatever youwant into this container and it's going to start falling like snow flakes.and the way we're going to do is using this class called item animator. again, there arelots of other ways to do continuous animation. time animator is one of my favorites because,again, it feels like the rest of the view animation api. it's very easy to use. youstart it and stop it whenever you want and then you implement this time listener interface,and you're good to go. so snowy day, attach to windows starts the animator, detach fromwindow stops the animator. pretty straightforward stuff. so what happens in the animator.but first i have to show you what happens
when you add a view.so i told you anything you throw in here gets turned into a snow flake.now, if you were doing this for real, you might have a very sophisticated physics enginegoing on here. i didn't have that, so instead, i created a little struct that holds somebasic velocity information and i stuffed it into the view tags. you see right that there,the v.set tag. this saves me the trouble of having to create a separate model of all theobjects. as soon as the view comes in, stick some stuffin the view tag and we can animate it later. here it is. on-time update. this is the thingthat gets called back from time animator every time choreographer wants an animation frame.so basically a v-synced, buttery smooth animation
call-back loop.so here essentially i'm going through every single of the children, pulling the tag backout, getting the velocities out, incrementing the view, nudging it along in its simulation,and then putting it back where it belongs. there's a little bit of code here that istaken out in the slide that allows the snow flakes to wrap around from the bottom to thetop and the sides. and then finally, there's always that daydreampart at the end because everything else that we've seen before, you can put in any application.here's the dream service bit. load a bunch of snow flakes. set the content view. again,this is what you do to set up a daydream. and then there's one last trick i'm goingto show you here, kind of unrelated to daydream
but it's a great little trick. remember wehad all those sprites drawn as white snow flakes on a black background. i don't actuallywant those black rectangles floating on top of each other. i want to be able to see thesnow flakes through one another. are we going to work out the hdmi switcherhere? here we go. how are we going to do that? we're going todo that with an extra mode on the paint assigned to a hardware layer. here's how it works.we create the ported up extra mode screen which will create that exact compositing appearancethat we want, and then for each one of these views, as we add it, we give it a hardwarelayer, use that paint and then put it into the parent. voila, you get snow flakes.okay. so what else can you do with daydream?
so the first thing is we talked a little bitearlier about whether it's interactive or not. so if you decide you want the user actuallyto be able to interact with the daydream, because the default is you touch it, it goesaway. again, flying kitchen appliances. if you want it to be interactive, you run thisone method call and suddenly you have again full touch input to your daydream. this allowsyou to do all kinds of great things like the default daydream photo table that's part ofandroid 4.2. hopefully you've seen this. this is a great way to show off, you know, a bunchof vacation photos, your recent google+ photos, and so forth. it throws them all out as ifthey were photographs scattered on a table but there's this great ability that if yousee one that you want to look at, you don't
have to suffer with it being obscured by otherthings. you can move them out of the way and pull them forward. this is a great thing tohave on a screen savior. it's something that can do a great thing when you're not payingattention. but if you're interested, you want to drill in and pay attention to what's goingon there, you can touch and, in fact, more than one person can be interacting with itat a time; right? you get the full multi-touch api of android. so this is a great thing tohave in the api. something else you want to do is give thatdaydream a setting. daydreams love settings. this is what binds an activity to this littlesettings button inside the daydream portion of the settings app. and the way you do thatis, in your manifest again, you add this little
bit of metadata. it's very much like metadatafor live wallpaper if you've done that, that points to an xml file where you can pointto that activity. not every daydream will need it, some are just art projects, but ifyou have configurable settings, if you want to make the hours bold or not bold, if you'reinto that kind of thing, this might be a great opportunity to do that.another pro tip for developing daydreams is to actually use activity. since the api isso similar, since the life cycle is so similar, it's very easy to share code between a daydreamand an activity that allows you to hook it up to your ide for testing.so again, we'll look at the same block of code we've seen over and over in this talk.you should be able to write it by heart now.
there is the activity version. so these arepretty close; right? dreaming started on start. dream service, activity.and again, you can wire that up to run in your favorite ide so that it's very easy togo straight to testing, and then debugging and so forth. if you factor out your code,you can keep your activity and dream service subclasses short and then all of the stuffrelated to your animation, your experience just goes in one place.another thing to do is port your live wallpaper, if you have one. there's no reason not togo and apply it to the daydream api, especially if you're just drawing into a canvas. if you'redoing fancy opengl stuff, it's a little more complicated and we'll come to that in a second.i can quickly show you right now -- well,
that's an early implementation. thank you,baron. this is the actual implementation. by now we have an old screen saver from bos,if you remember that. it's very simple and the first implementation was live wallpaper,because that's all we had, but implementing it as a daydream was really trivial.again, on dreaming started. we set up everything. and, in fact, this view you notice i justsay new view. the view doesn't do anything. it's not even a very special view, but allof the logic was built into a drawable. so the by now drawable is the background drawableof the view, and then we have a call back to make sure the background drawable is invalidatedevery now and again. it's really easy. i mentioned a little bit about opengl. ifyou want to use open gl in a daydream, you
want to move to technical view. if you areusing gl surface view, you may have noticed it it's pretty janky getting that set up,particularly with window transitions. technically, romain has told me the tech reviewis the way to go. please do not argue with romain on this. you have to assume he's righton it. if you go to afp you can get the source codeto the colors daydream, which is a great example of tech review but opengles2 in a daydream.the last thing i want to share with you is you can prevent your daydream -- prevent daydreamsfrom running on top of your apps. so i mentioned at the top of the talk video players, games,kiosks things might not want daydreams to run on top of them, and the way you do thatis you keep the screen on. and there are lots
of ways to keep the screen on, all the wayup to managing your own wake lock which i only recommend -- for no one.so last i want to show you a little magic trick.i want to give you a clock daydream in zero lines of code.almost zero lines of code. for very large values of zero. but the only code we're goingto need is the same block of code again that we've seen over and over in this talk.i added a couple extra bits here. set full screen, set screen bright. those are justwrappers around basic calls on view. those are put on the dream service for your convenience.you don't need to use them. and then in this implementation i'm going to set content viewto my full screen clock, and that's it. i'm
done.so what is this clock xml, this magic clock? are you ready for it? here it is. i'm justgoing to use the widget that already exists. so it's part of the android widget toolkit.it shows a clock. it updates on its own. i don't have to do anything. zero lines of code,and it works. it looks just like that. hang on. the colon needs to blink. i knowit's scope creep. this is what happens. i'm sure you all know. and i said no code, sohow are we going to do it? any guesses? no?what is that? i showed this to romain and he face-palmed.he said, "you're going to show those guys that?" so there's this little undocumentedtask available in the system called blink,
which makes anything inside of it blink onand off once a second. and it works. no code. so....[ applause ] >>daniel sandler: he's going to love thatthat's what got applause. [ laughter ]>>daniel sandler: okay. all right. the code is done, but i did want to show you some moreexamples of other daydreams in the wild. first, there's google currents, which was-- we worked with the currents team to build this out based on their ui, and we're reallyhappy with how this came out. it was very currency, very rich, lots of great stuff tolook at. a few things i want to draw your attention to.one, it's interesting and not distracting.
so it's always moving but it's always movingslowly so there's constantly something new to be interested in and to look at if youhappen to be looking but it's never going to, like, draw your eye out of the cornerof the room. it's coming direct from currents, their freshdatabase of new content so it's never stale, and it's always interactive. so if you tapon the story and would like to bring up a full screen view -- again, it's still withinthe daydream -- a full screen view of that story where you can read a little more aboutit, and from there you can either go back to the river of news or you can drill in allthe way, exit daydream, and go straight into currents. we'll see another example of thatin a minute. it's super powerful.
(saying name) sent me some screen shots fromsome information about beautiful widgets. i actually have been using this for a whileas my personal charging daydream on my phone. so i go to bed, i set the phone on the wirelesscharger and this comes up, which is perfect because it tells me everything i need to knowfirst thing in the morning, or, you know, at 3:00 in the morning, including the time,the weather, things like that. it's all live data coming directly from beautiful widgets.they've got these great visual effects that would not be possible in widgets, like launcherwidgets for the weather, cloud moving past, twinkling stars at night. it's very futurebeautiful. in fact the ui is one that wouldn't really work with as a front door for an app.it's much more artistic, much more free form.
it's perfect for daydream. it feels just rightin this context. they also give you some system status informationin the bottom. i will point out if you are interested in that, you can also show thesystem you want in what we call lights-out mode or view.systemui flag low profile whichis a way of causing the navigation icons to dim out and your notification stuff to dimout showing only the battery and the clock in a lower profile way in the corner. so theuser still has access to that battery information and you don't have to do it yourself, butyou can if you want to. finally, flipboard was kind enough to sendalong a screen shot. flipboard always looks great, gently moving full color photographsand stories. and they sent this statistic
that i really wanted to share with you andthey were kind enough to let me share with you. nearly 50% of daydream sessions, almosthalf the time that people are running flipboard in a daydream, ended with a launch of flipboardthe app. people see the daydream, see a story they're interested in and go and read moreabout it. this is a massive, massive way to drive engagement with your app. if you havea great daydream it is going to drive people into your full app experience. this is outstanding,outstanding news. i get chills on the back of my neck thinking about it. it's awesome.so let's wrap this up because i do want to take some questions.daydream is supposed to be really easy for you to write. very simple, similar to activity,very simple to get off the ground. you get
lots of great stuff for free so you don'thave to think about all that stuff, and you can use any drawing api, any ui toolkit onandroid that you like. it's supposed to provide this delightful glanceableinformation to draw the user into your app or just to sort of look great on a bedsidetable or on a coffee table or on your desk at work. and it's a chance for your app tohave fun. it's a chance for you to break out of the serious business of all of your actionbars and your listviews and more listviews, listviews and more listviews. and finally,daydream is there for any user, whether you have a fancy dock or a fancy charger or justone of these, every user with android 4.2 can use daydream.i want to briefly thank a ton of people who
have been involved in this feature, and particularlyhelping out with daydream. in particular, jeff, rachel, tom, john, and chris who didthe implementation and the design for this feature. thanks to those guys.flipboard and levelup, thank you so much for all of your feedback and thank you for yourscreen shots. reto, the android developer people and the whole google i/o team for puttingon a great show. thank you to those guys. and people who had cameos, you can invoiceme later. dianne matias and baron, thank you for your likenesses.questions can be asked at the microphone right up here at the front. if you have them, nowis the time. if you don't have questions now, immediately after this talk i will be overin the android office hours pen elsewhere
on the third floor here. you can ask me aboutdaydream or anything else related to system ui, notifications, navigation, full screenstuff, launcher, floating windows, things like that.[ applause ] >>daniel sandler: go ahead.>>> hi. is there any support for loaders for fragments in daydream?>>daniel sandler: thank you for asking fragments up front. no, we haven't worked out a reallygood way to integrate fragments yet because the life cycle of fragments is so peculiar.it was really opposed to the simplicity for a daydream. so a daydream had to be, like,one method override it and you're ready to go. putting fragments into that hasn't workedfor us so far. quality patches accepted to
the aosp crowd.>>> and loaders? cursive loaders? >>daniel sandler: i don't know, if you havespecific problems. we don't have any of the stuff that's in activity to help you managethat stuff automatically so you'll have to do it yourself. if there are specific thingsyou'd like to see, again, that feedback is welcome.>>> thank you. >>daniel sandler: thank you.>>> hi. a question about the placer. there is a section for widgets and for wallpaper.is it planned to have a section for daydream? >>daniel sandler: i can't comment on plansbut that's a nice idea. >>> okay. thank you.>>> i missed the beginning so maybe you already
answered this but basically i'm wondering,like, let's say there are more apps that have daydream, like how do they get chosen? theuser picks which one is the dreamer or -- >>daniel sandler: let's go back over to thetablet. so this is actually in system settings. sogo up here, quick settings. oh, that's so convenient. go into display. underneath daydream,you get a choice here of all the daydreams available on the system, and you can selectone. you can either run it there to test it out, or you can set it up, choose when youdaydream and things like that and then just let it turn on automatically.currently there's no other way for anything else to change which daydream you have rightnow. that's a secure setting. that choice
belongs to the user, not to the app, but youcan always direct users to this activity. >>> thank you.>>> will daydreams running in the daydream service, the apps running in the daydreamservice have access to some of the voice recognition and voice commands that we saw earlier todayso you can talk to your device while its in daydream?>>daniel sandler: i have no idea. that's a great idea. i don't know. i'd have to checkon that. >>> okay. thanks.>>> i think i just had a follow-up on the discovery questions that have been asked.do you have guidance on how developers should encourage or make users aware that there'sa daydream feature for their app?
>>daniel sandler: i don't right now. so we'restill kind of working on that. having a different organization in play store would certainlyhelp but it's not necessary. i think right now daydream is definitely beingdriven by people who already know about the feature and want to find apps that supportit. in terms of somebody who already likes your app and you want to encourage them totry out daydream, our current sort of guidance on this is if you already have settings, tohave a row there where you say set up daydream and it will actually take you to this screenright out in settings. and there's an activity -- there's an intent named for this particularactivity that i can dig up. i don't have it memorized, and so you can direct people thatway.
>>> okay. thanks.>>> hi. >>daniel sandler: yes.>>> one question. so can you use the external monitor in daydream, like can you connectto an hdmi monitor or -- >>daniel sandler: right. so the secondarymonitor api. yes, you can do that and then you can draw something different there, oryou can draw the same thing. if you don't do anything in particular, ifyou're just mirroring the device you will see the daydream in both places. but again,you can do whatever you want. so, yes, you should be able to run the displayapi and draw something different on the hdmi monitor if that were important.>>> okay. thank you.
>>daniel sandler: mm-hmm.>>> hi. i was wondering, can you take voice input from daydream state?>>daniel sandler: i mean, yes. well, it was asked earlier if some of the specific newvoice recognition stuff would be enabled, and i see no reason why not. i honestly haven'ttried a lot of those apis with daydream yet. i'll check into it. maybe we'll have a blogpost about it. one more.>>> i was just curious on performance issues. like related to battery charging, if the screenis always on or something like that. >>daniel sandler: absolutely, yes.>>> you leave your phone overnight charging, so how long does it take to actually charge?>>daniel sandler: it dilates the charge time.
it doesn't make it so that you can't chargeyour phone overnight, and it varies based on what's going on. this is like dock apps;right? so not only are you keeping the screen on, you're keeping the cpu on. you may bedoing more or less depending on the complexity of your animation. that's going to be somethinga developer -- each developer has to sit down and work our with their implementation. somebodydoing a blinking colon clock animation is probably not going to have to worry aboutit, but basically just keeping the screen on. that's the lion's share of the computation.but if you have a full 3d live wallpaper, it might be a little different.now daydream has some additional safeguards in there to make sure you don't crater yourdevice overnight. so if the battery gets too
low daydream will shut off and the screenwill go dark and the device will be allowed to charge fully. and daydream won't automaticallystart if you put the device into a dock if the charge is too low.so in that way we won't ever -- daydream won't cause your device to wake up with zero chargebut it will cause charging to take longer and that's -- just like any performance issue,each developer is going to have to sit down and look at that.>>>is there any consideration to make -- to sort of link daydream with your alarm settime? so say as you're close to waking up,
the app that you're using to daydream couldchange its actions when it knows you're about to wake up.>>daniel sandler: that's a great idea. go
monetize that. thank you all very much. i'llsee you all outside. [ applause ]