Here’s a Quick Fix for the Nexus 6’s Recent YouTube App Lag Issue
Android, as we all know, is a general purpose mobile operating system. Even if you hop from one Nexus phone to another one, your software experience can differ in really subtle ways. On paper, you shouldn’t notice many software differences between the Nexus 6 and the Nexus 6P.
But on the Nexus 6, the YouTube app inexplicably lags when you simultaneously watch a video and scroll through comments. Many Nexus 6 users have reported that this issue began only after making the jump to Android 6.0 Marshmallow. So what’s going on, and how do you fix it?
Fixing it is quite simple. All you need to do is turn on the Disable HW Overlays option under the Developer Options*. Here is a before and after comparison of how changing the option affects performance within YouTube.
Why does this fix work? We’re not entirely sure how ourselves. Not even the Android Engineering team has gotten to the bottom of the YouTube jank yet:
We did notice some jank while scrolling comments that are being loaded for the very first time during Youtube video playback on Nexus 6 running Android M. The jank does seem to improve when forcing GPU composition. Youtube on Android 6.0 uses SurfaceViews for video playback because it consumes less power than using TextureViews. Forcing GPU composition improves comment scrolling smoothness at the cost of power. Stay tuned.
If you notice in the comment made during the AMA, the team does mention that forcing GPU composition improves performance in the YouTube app. Disabling hardware overlays essentially accomplishes this task: by enabling this option SurfaceFlinger will forego the use of a hardware overlay and instead always use the GPU for composition. Unfortunately, disabling HW overlays does result in an increase in power consumption and is really only supposed to be used for debugging certain kinds of media applications. One way to work around this issue is to use app such as Tasker with the Secure Settings plugin in order to automate toggling the ‘Disable HW Overlays’ option whenever you’re using the YouTube app.
*How do you get to Developer Options? Go to Settings, then go to About Device, then scroll down to Build Number and tap on the Build Number field 7 times. You are on XDA, you should know this!