2

A while back I asked this question and @fadden was gracious enough to give me an answer. So, now I have a VirtualDisplay which is using an intermediary Surface that I create and when the SurfaceTexture that backs the Surface receives an onFrameAvailable call, I make OpenGL calls to put draw that texture to an EGLSurface which is created from the Surface generated by the MediaCodec. Phew.

All of this is running in a Service (so it sticks around in the background). It all works, but I'm having some screen flickering occasionally on some devices. The flickering does not carry through to the data sent to the MediaCodec so it seems to be an issue with just the screen. The flickering also causes the "soft buttons" on Nexus devices to disappear/reappear on Nexus devices (but even when the buttons are gone on screen, the soft buttons appear in the output of the MediaCodec.

If I swap out my intermediary Surface so that the VirtualDisplay just outputs to the MediaCodec's input Surface then the flicker happens significantly less (happened one time in 50 or so minutes vs. flickering a few times a second periodically). The flickering also seems to happen in certain apps more so than other apps (Google Maps is a good culprit) or when certain UI appears/disappears in apps.

Anyone have have any ideas on what could cause the flickering in this scenario and only one some devices (that I've seen)? I can post some source code if that would be helpful.

EDIT: So, I've found that, on my Nexus 5x at least, if I go to "Developer Options" and enable "Disable HW Overlays" (the text says "Always use GPU for screen compositing") that the screen flicker goes away. Obviously this is a workaround, but I'd like to fix the issue programatically if at all possible.

Community
  • 1
  • 1
EncodedNybble
  • 265
  • 2
  • 11
  • Generally speaking, if "disable HW overlays" makes a problem go away, there's a good chance that the bug is related to the Hardware Composer. (Disabling HWC was one of the first things we always tried when looking at a display bug.) Since it's happening on a Nexus device you can file a bug at http://b.android.com/. – fadden Mar 31 '16 at 00:09

0 Answers0