问题
I have install Droid VNC Server on my tablet. I also checkout it's source at http://github.com/oNaiPs/droid-VNC-server but i don't find any line of codes where it capture the screen and upload to Viewer. So, How does it work? How can it capture the Droid's screen?
回答1:
Look in the jni/vnc/ folder. Sure looks like a VNC server to me.
回答2:
It has 3 modes to try and read your screen:
- Framebuffer
- SurfaceFlinger
- Gralloc
I've only tried it on Android x86 and only got the framebuffer mode working. Supposedly 2. and 3. work better if you're on ARM. Basically what that does is directly read the framebuffer device (/dev/graphics/fb0 like on Linux). By read I mean it takes a series of "snapshots" of the screen and sends them to the VNC client as it requests screen updates. The framebuffer device is the layer between where Android writes its screen contents which is then in turn passed through the graphics pipeline to the hardware (graphics display chip -> screen). Think of a framebuffer just being like a frame in a video, a series of frames makes a video, as does a buffer of frames represent the actual dynamically changing contents of the screen.
With regards to input Droid VNC server receives pointer and key events over the network, processes them and then sends them to the /dev/input devices which Android then handles as if they were local keyboard or mouse inputs.
来源:https://stackoverflow.com/questions/12210748/how-droid-vnc-works