Search code examples
androidnexus-5surfaceflinger

NEXUS 5 lollipop 5.1 SurfaceFlinger error


Hello there? There is one question. nexus5 lollipop5.1's issue. surfaceflinger there is a code that comes in response to the device screen information in ScreenshotClient update by using. The code looks like the following.

unsigned int sw, sh, xsize, gsize, stride;
... ...
ScreenshotClient sc;

sp<IBinder> display = SurfaceComposerClient::getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain);

if( sc.update(display,Rect(), sw,sh, false) != NO_ERROR) {
    ... ...

    sc.release();

    return 0;
}
stride = sc.getStride();

mapbase = sc.getPixels();
... ...

The above code, in other lollipop version is operating normally. Of course, nexus7 the same version also operate normally. However, the change in nexus5. My code to reference, but continue to code loop is. And because you try to get to continue the screen. First I code in nexus5 is operating normally. However, when a certain count is, update is not came under the other screen to return the error. More ...! After complete finished my code, re-run, after it is another well, the same phenomenon occurs when it comes to a certain number. If you are ability who know about this?

I'm sorry it is not so good in English.


Solution

  • I had solve. ScreenshotClient sc and sp < IBinder > display should be declared as a global variable. If the class is declared error occurs several times. (example. It declared in the function to be repeated.)