2

I am running a native process that is capturing the screen in a loop using ScreenshotClient. randomly after several runs when I close the process I get "service 'SurfaceFlinger' died" and the screen restarts. This does not happen in android 4.2.

this is the backtrace:

I/DEBUG   (  111): backtrace:
I/DEBUG   (  111):     #00  pc 0002a61e  /system/lib/libgui.so
I/DEBUG   (  111):     #01  pc 0002f205  /system/lib/libgui.so (android::Surface::queueBuffer(ANativeWindowBuffer*, int)+220)
I/DEBUG   (  111):     #02  pc 0002e2cd  /system/lib/libgui.so (android::Surface::hook_queueBuffer(ANativeWindow*, ANativeWindowBuffer*, int)+10)
I/DEBUG   (  111):     #03  pc 00017fb9  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #04  pc 0001b6f1  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #05  pc 00015e6f  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #06  pc 00010767  /system/lib/libutils.so (android::Looper::pollInner(int)+394)
I/DEBUG   (  111):     #07  pc 00010869  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
I/DEBUG   (  111):     #08  pc 00016089  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #09  pc 00016f7b  /system/lib/libsurfaceflinger.so (android::SurfaceFlinger::run()+6)
I/DEBUG   (  111):     #10  pc 000008fd  /system/bin/surfaceflinger
I/DEBUG   (  111):     #11  pc 0000e403  /system/lib/libc.so (__libc_init+50)
I/DEBUG   (  111):     #12  pc 000007dc  /system/bin/surfaceflinger
jacob
  • 1,397
  • 1
  • 26
  • 53
  • Please also include the top part of the native crash (where it shows the build fingerprint and fault address). Also include any suspicious log messages that appear immediately before it, especially if they're logged at "error" level. – fadden May 05 '14 at 14:39

2 Answers2

0

I've seen 3 SurfaceFlinger crashes myself during the last days. It seems there's a bug in the implementation. As I'm using an S5 I cannot say wheter it's a Samsung specific or a general Android 4.4.2 issue. Which device are you working with?

To recover from this issue, you can simply do a reboot of the device. Sometimes I managed to execute a "kill -9 " (I got the pid using "ps | grep ") and bring everything back to live without rebooting the device. I used to kill the remaining/hanging surfaceflinger or mediaserver service. As it does an auto-restart after being killed, everything is fine again afterwards.

As these are binaries delivered with the device, it might be impossible to fix this issue. But there's a small chance: If the binaries are the same as those in AOSP (Android Opensource Project http://source.android.com/) you could try to compile those and replace the ones on your phone (please do a backup of the original ones first).

If the binaries are device specific, you might find them on the opensource pages of your device vendor. Like http://opensource.samsung.com/ for Samsung devices. These sources are usually easy to compile and can replace binaries on your phone.

Apart from that, I think there's not much more left than reporting the issue.

user3387542
  • 611
  • 1
  • 8
  • 28
0

when I cleanly close the process instead of killing it, SurfaceFlinger doesn't die anymore.

jacob
  • 1,397
  • 1
  • 26
  • 53
  • 1
    Can you share how you "cleanly close the process" please. That would make this answer more helpful. I am specifically interested in how to cleanly close Android VideoView. – Farrukh Najmi Jul 23 '19 at 17:58