Learn about Android 4.1, third: butter project--operating mechanism and fresh stuff

Source: Internet
Author: User
<span id="Label3"></p> <blockquote> <blockquote> Welcome back to gtka, everyone's favorite investigative series where we learn all about the newest version of Androi D (with a heavy emphasis on "all"). The previous-episodes, if you didn ' t catch them, is here and Here. </blockquote> </blockquote><p><p>Welcome back to the "learn android" series of people you Love. From this series, we will learn all about the new version of Android (note that it is all oh!). Content If you have not read the previous two articles, they are here and Here.</p></p> <blockquote> <blockquote> Today we ' ll be doing something a little different and looking at something near and dear to everyone ' s HEARTS:PERFO Rmance. Jelly Bean is crazy Fast. Slap it on a Galaxy Nexus and it's ' ll feel like a brand new Phone. Scrolling is faster and smoother, and the touch response is Hyper-sensitive. The smoothness work, there is new transitions all over the Addition. </blockquote> </blockquote><p><p>today, we want to focus on something different from what we used to be, closer to what we need: performance! Jelly Bean It's Going crazy! Get it into a galaxy Nexus and you'll feel like You're getting a new Phone. The scrolling is so quick and smooth, and the touch response is so Sensitive. In addition, there are many more animated effects!</p></p> <blockquote> <blockquote> I ' m sure you ' ve all seen a sweeping overview of this, but those is boring. What exactly are new, and how does they do it? That's what we're here for Figure Out. so, Grab your popcorn, kids;     It ' s time to learn all about Project Butter. How they did It </blockquote> </blockquote><p><p>I know you've read a few notes about this, but they're all Weak. What are the new ones and how do they work? We'll be able to figure this out right away. okay, Grab your popcorn, kid. Let's get to know the legendary butter Project. How did they do that?</p></p> <blockquote> So how does the do <blockquote> a 8 month old Galaxy Nexus run like a galaxy S III? Lots of Hard Work. Hard work is thoughtfully detailed to us at Google I/O by the My favorite I/O presenters, Chet Haase and Romain G Uy. An hour long PowerPoint presentation geared towards developers are not the most accessible thing in the world, so I ' m going Steal some slides and try to cover the more interesting parts, and (hopefully) condense it down to a few minutes.     Doesn ' t that sound? VSync Turns Frame Drawing into A well-oiled </blockquote> machine </blockquote><p><p>How do you make a eight-month old Galaxy Nexus run like the Galaxy S iii? well, It takes a lot of effort. On Google i/o, my favorite two I/O Speakers--chet Haase and Romain Guy gave us a detailed explanation of these Efforts. The One-hour PowerPoint presentation looks at how developers are a bunch of non-worldly beings, so I simply stole some pages containing interesting content and compressed them into a few minutes (hopefully), sounds great? Vertical synchronization for frame drawing refueling</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> <blockquote> PC Gamers is probably familiar with the term "VSync." It's that graphics option checkbox, that'll stop your screen from tearing in a video Game. </blockquote> </blockquote><p><p>PC gamers are probably familiar with the word vertical synchronization. A check box with this word can help your game avoid tearing problems.</p></p> <blockquote> <blockquote> to understand what exactly VSync are, we ' re going to need a quick display primer:video (ie a phone display doing Stu Ff) is made of individual pictures called "frames." Smooth animation is usually frames per second. Frames is made of pixels, and, when the display draws a frame, the pixels is filled in row by row. Got it? Good. </blockquote> </blockquote><p><p>To understand what vertical synchronization is, We need to do a beginner's teaching of the display system: the visual (for example, what the phone screen shows) is made up of a series of separate images called "frames". Smooth animations typically require 60 frames per second. Frames are composed of pixel Points. When the screen draws a frame, the pixel points are filled in one line. Got it? Very good.</p></p> <blockquote> the <blockquote> display (LCD, AMOLED, whatever) gets each frame from the graphics chip, and starts drawing it on LINE. ideally, want the display to get a new frame from the graphics chip after it is finished drawing the previous Frame. Tearing occurs when the graphics chip loads a new frame on the middle of the LCD draw, so you get half of one frame and ha LF of Another. </blockquote> </blockquote><p><p>The display (lcd,amoled or Something) gets the data for each frame from the graphics chip and then draws it one line at a Line. ideally, you expect the display to be finished after a frame has been drawn, and the graphics chip will be able to provide new frames of Data. The image tearing occurs when the graphics chip is in half the image, loading a new frame of data, so that you finally get the data frame is half a frame of new data and half a frame of old Data.</p></p> <blockquote> <blockquote> VSync, well, synchronizes things. It tells the GPU to wait for the screens to finish their line by line drawing before loading the next Frame. </blockquote> </blockquote><p><p>and vertical synchronization, as the name implies, is used to Synchronize. It tells the GPU to wait for the screen drawing to finish before loading a new Frame.</p></p> <blockquote> <blockquote> Android has always used VSync to stop screen tearing, but Jelly Bean takes things a step further. The VSync pulse is now used to start all the processing for the next Frame. </blockquote> </blockquote><p><p>Android always uses vertical sync to avoid screen tearing. and jelly beans went a step further. The vertical sync pulses now run through all the graphics operations.</p></p> <blockquote> most <blockquote> Android displays run at or around for frames per second (or hz, in display jargon). In order to has a smooth animation, you had to actually is able to process the frames per second-that means you ' ve got 16ms to process each Frame. If you take longer than 16ms, the animation would stutter, and that buttery smooth feeling we ' re aiming for melts away. </blockquote> </blockquote><p><p>Most Android display systems work at a frequency of 60 frames per second (professionally speaking, called 60Hz). To get smoother animations, you must have the ability to process 60 frames per second-meaning that only 16 milliseconds per frame can be spent. If the process is more than 16 milliseconds, The animation shows a sense of stagnation, and the silky smooth experience we expect will disappear.</p></p> <blockquote> <blockquote> milliseconds isn ' t a lot of time, so your ' re going to want and make the most it. In Ice Cream Sandwich, processing for the next frame would just kind-of lazily start whenever the system got around to it. In Jelly beans, the whole process of making the next frame starts as soon as the last frame was finished, at the beginning of the VSync Pulse. In other words, they ' re using as much of the 16ms as they can. </blockquote>here's an Example: </blockquote><p><p>16 milliseconds is not a long time, so you will want to make the most of it. In ics, the System's handling of the next frame is a bit lazy to load, and it needs to be processed. In the jelly bean, the process of the next frame starts immediately at the end of the previous frame, at the beginning of the vertical sync Pulse. In other words, the system will make the best use of that 16 milliseconds. As an example,</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> This is <blockquote> -is-like without running everything off of VSync. In these slides, the numbers is Frames. First the frame is processed by the CPU and GPU, and, when it's finished, it's handed to the display at the beginning of T He next VSync. </blockquote> </blockquote><p><p>This is the state when there is no full vertical synchronization. In the picture, the number represents the Frame. first, The frames are processed by the CPU and gpu, and when processing is complete, the display is delivered at the beginning of the next vertical Synchronization.</p></p> <blockquote> So in this picture <blockquote> , Frame 0 is displayed, and, during the 16ms of display time, the CPU and GPU prepare the next FRA Me. The calculations get done in time, and at the next VSync pulse, they hand over the next frame, "frame 1." Great. </blockquote> </blockquote><p><p>In the example diagram, the No. 0 frame is shown first, and the CPU and GPU are ready for the next frame within 16 milliseconds of display Time. The operation is completed on time, and when the next vertical sync pulse arrives, They deliver the next frame: frame 1th. Very good.</p></p> <blockquote> <blockquote> We ' re now showing frame 1, and it's time to start working on Frame 2. Something slows the system down, though, and processing for the next frame doesn ' t start until we ' re well to our 16ms Ti Me limit. The system now has a about 4ms to figure out frame 2, so the processing for it doesn ' t get finished in Time. With no frame 2, the display was forced to show frame 1 again, for another 16ms. Team Android has dubbed this "jank," and it basically means a animations happening during this time won ' t is fluid; The user would see Stuttering. </blockquote> </blockquote><p><p>After the first frame is displayed, it is time to complete the second Frame. But some factors cause the system to slow down, so the next Frame's processing is only just beginning until the 16 milliseconds are about to pass. At this point, only 4 milliseconds are left to draw the second Frame. There was no accident that the work was not finished in Time. At this point, the display can only display the first frame again within 16 milliseconds after the second frame is not completed. The Android team called this a "scrap frame", indicating that all of the Screen's dynamic effects were not delivered in time, and the user experienced a sense of stagnation.</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> Here's the <blockquote> New to doing things in Jelly Bean. All the Processing-the next frame starts at the VSync pulse, so you ' re now making the most of the your 16ms of render time . </blockquote> </blockquote><p><p>This picture shows how things work in the jelly Bean. All operations on the next frame begin when the vertical sync pulse arrives. This makes the 16-millisecond rendering time fully utilized.</p></p> <blockquote> <blockquote> Frame processing have moved from "Yeah whenever we get around to it," to a rigidly scheduled, highly organized affair . The Sort of like the difference between a car mechanic and a NASCAR pit CREW. In this example, all the processing happens within the 16ms time limit, all the frames get delivered on time, and you get     A smooth, buttery experience. Triple buffering Stops Jank from snowballing </blockquote> </blockquote><p><p>Frame processing by "no matter 3,721, anyway i finished", became a highly organized, strictly according to the timetable of Implementation. A little bit like the difference between a street repair car and a Winston racing Depot. In this example, all the processing takes place within the 16 millisecond limit, all frames are delivered on time, and the user gets a smooth, fluid experience. Three Times-fold buffer solves the picture tearing problem</p></p> <blockquote> <blockquote> VSync isn ' t the only thing it helps out animation smoothness, Android are also able to recover from a slowdown more Smoothly. </blockquote> </blockquote><p><p>In addition to vertical synchronization, Android uses other ways to make it smoother.</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> So what's <blockquote> the heck is a "buffer"? Put simply, A buffer is the container the frame is built and stored in. We ' ve been referring to frames by number, but really, those frames sit in one of the the and the both Buffers. Android is double buffered, a pretty typical setup, meaning it can display 1 frame while working on Another.  In this picture the buffers is labeled "A" and "B." While displaying buffer a, The system starts building a new frame in buffer B. When That's ready, they swap Buffers. B gets displayed, and a gets cleared and a new frame is worked On. </blockquote> </blockquote><p><p>so, What exactly is a "cushion"? Simply put, buffering is the container for frame construction and Preservation. We used to refer to frames in front of each other, but in fact, these frames are actually in two Buffers. Following the convention, the anroid uses a double-buffering mechanism, which means that it can handle another frame while displaying a frame. In the diagram, buffers A and B. When buffer A is displayed, the system constructs a new frame in buffer B. When you are finished, swap the Buffers. The buffer B is displayed, and a is emptied to continue the drawing of the next Frame.</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> the <blockquote> problem with double buffer arises if you take longer than 16ms to draw your Frame. Here the processing in buffer B runs over, which means a stutter (jank!) happens. Stuttering is bad and all, but the real problem are all of the white space in the CPU and GPU graphs, That's wasted Time. In the first frame, buffer B runs through, so, buffer was in use until it can be displayed, buffer A was also in use, Beca Use it was being displayed for 2 frames in a row, and remember, you can only switch frames (and hence, buffers) at the Vsyn C Pulse. The CPU and GPU is out of usable buffers, so they just sit there. One slowdown puts the system behind, which causes more slowdowns. This is how Ice Cream Sandwich worked. </blockquote> </blockquote><p><p>When a frame is drawn for more than 16 milliseconds, the double-buffering problem is Exposed. When buffer B timed out, a Dayton took Place. The lag is always bad, but the more serious problem is the white space between the picture of the CPU and the gpu, which is a waste of time. In the first frame, buffer B times out, It is in use until it is displayed, and buffer A is in use because it is still displayed in order to fill the blanks. We know that frame (buffer) switching occurs only when a vertical sync pulse is Received. The CPU and GPU are limited by the number of buffers that can be used and have to Slack. Step slowly slow, This is the flaw of Ics.</p></p> <blockquote> <blockquote></blockquote> </blockquote><p align="center"><p align="center"></p></p><p><p></p></p> <blockquote> <blockquote> in Jelly beans, we ' ve got a solution for 2 full buffers, a third one! Same situation as before, buffer B takes too long, and A is in use displaying the current Frame. This time though, instead of wasting processing time during the repeated buffer, the systems creates a C buffer, and gets On the next Frame. Triple Buffering stops the stutter fest, and after the initial skip, the user sees a smooth Animation. It's all about presenting a stiff upper lips to the user even though things aren ' t going so smoothly under the Hood. </blockquote> </blockquote><p><p>In the jelly bean, we have a solution to the double buffering problem: add a third buffer! In the foregoing scenario, the B buffer times out, and a buffer is used in the display of the current Frame. At this point, no time wasted due to the foregoing reasons, the system will create a new buffer c, and continue the next frame of Work. Three times times the buffering end of the frequent lag generation, after the initialization of the jump, the user gets a smooth animation effect. Even if some problems occur, the system will try to give users satisfactory results.</p></p> <blockquote> So why <blockquote> don ' t they just does triple buffering all the time? well, as can see from the diagram, triple Buffering introduces a bit of input lag into the PROCESS. look, for instance, at the distance between the rendering of buffer C (the Blue/green part), and the displaying of it. so, when things is misbehaving, you get a choice of 2 evils:input lags (your touches taking longer to having an Effect) or Choppy Animation. </blockquote> </blockquote><p><p>So why not just keep using the three times-fold buffer? As you can see in the figure, the three Times-fold buffer introduces some input delays throughout the PROCESS. For example, in the buffer C (dark Green part) The rendering process is displayed with it. so, when something goes wrong, you have two options: the input delay (your touch operation will take Effect) or the screen is Stuck.</p></p> <blockquote> <blockquote> to address this, Jelly Bean doesn ' t does triple buffering all the Time. It normally runs a double buffer, but this third one is around whenever you need it.     This is the "get less input" lag, and when things go wrong, you ' ve got a third buffer at the ready to help you recover. The Results </blockquote> </blockquote><p><p>To solve this problem, the Jelly bean does not always use a three times-fold buffer. In general, it only uses double buffering, but when needed, it is enhanced with a three times-fold buffer. This reduces the input latency to a minimum and keeps the picture flowing in the event of an Accident. Results</p></p> <blockquote> The result of all this hard work is <blockquote> buttery smooth Animation. The team is so impressed with their new animation aptitude that they spruced up many of the transition animations, which I'LL now present to your in excruciating detail.     Check out ICS vs Jelly beans, in Super Slow-mo. New Animations </blockquote> </blockquote><p><p>The result of these efforts is to get a smooth Animation. We're all shocked by the brand-animated animations, and later i'll show you the details of the Animations. ICS are just like the old bull in the cart, relative to the jelly Bean. New animations</p></p> <blockquote> <blockquote> Icon Launch Transitions-left:ics ' s no-frills app Launch Transition. RIGHT:JB zooms </blockquote> in from the location of the icon </blockquote><p><p></p></p> <blockquote> <blockquote> there isn ' t much to say on these videos, but I'll try my Best. Ice Cream Sandwich (left) have an absolutely boring icon launch Transition. It's just a simple stretch and fade to the center of the Screens. In Jelly beans (right), applications Zoom out from the icon Position. This manages to being both neater looking and more communicative: "your pressed this icon, and this is the opening from it." I like it. </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> Uninstalling-left:ics just uses the standard screen Transition. Right:jelly Bean ' s fun ' toilet flush ' animation </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> Uninstall gets a cool transition too. It ' s a slide/fade/shrink animation to the bottom of the Screens. It sort of reminds me of a toilet flush. The previous screen also gracefully slides to view when the app is Gone. </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> launching from within an app-left:ics does a simple fade. RIGHT:JB slides things all over the place. </blockquote> </blockquote><p><p></p></p> <blockquote> this <blockquote> transition was pretty much the uninstall animation in reverse, and it was used all over the Place. I think it ' s triggered whenever an app opens another app. So here, the "play store launching an" app, and you'll see it when something like Google Reader launches a web brows er, it ' s all over the Place. </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> Update:googler clarification! </blockquote> </blockquote><p><p></p></p> <blockquote> the <blockquote> always-helpful Dianne hackborn, an Android Framework Engineer, stopped by our Google + page (you are following us On g+ right?) With some insight in this animation: </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> "one thing I ' d like to clarify-the" uninstall "and" launch "animations is actually the same thing. The animation set for a "task switch". that's, moving in the UI from one task to Another. A task is the thing your see in recent tasks, so this effectively tells you it's moving between tasks that would be Seen in the recent tasks UI. " </blockquote> </blockquote><p><p></p></p> <blockquote> so <blockquote> there ' s even more communication through Animation. Thanks dianne! </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> recent Apps-left:ics oddly fades to a blank desktop. RIGHT:JB ' s awesome transition </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> recent apps probably have the coolest animation out of the Bunch. The app grows out of the thumbnail, which are, again, neat looking and communicative-the perfect use of an animation Syst Em like This. </blockquote> </blockquote><p><p></p></p> <blockquote> <blockquote> and finally, The new Jelly Bean camera Animation. Snapping a picture sends your still flying off to the right, and a swipe would bring it back. I didn ' t bother showing you the ICS version because, well, nothing happens. </blockquote> </blockquote><p><p></p></p> <blockquote> That's about <blockquote> it for Project Butter. You really has to experience it to get the full effect. Everything is smooth and fast. It really is impressive what much more power they ' ve managed to squeeze out of my old Nexus. </blockquote> </blockquote><p><p>Learn about Android 4.1, third: butter project--operating mechanism and fresh stuff</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.