Reset the FrameNumber for dropped frame in async mode

In Async, reset the framenumber of frames dropped by the BufferQueue.
This allows the client to dequeue and use this frame before the other
queued frames which may be with the MDP.

CRs-fixed: 448606

Change-Id: Icaabf77b55a7275dc98ba1fdfba89508feb92145
Check fence is not NULL before dereferencing it

If the fence obtained in dequeueBuffer is NULL, don't dereference it.
This will avoid a crash in surfaceflinger.

CRs-fixed: 516300
Change-Id: I3054dc37087103f3addae7884bb03460484a1eec
Surface: Initialize variable and add a defensive check.

Initialize buf variable and make sure to check for return
value of dequeueBuffer() before sending to the client.

Change-Id: I0569f2d45825fab0e5d0f38fc91a07990f57c7ab
Merge "Check fence is not NULL before dereferencing it" into cm-10.2
Merge "Surface: Initialize variable and add a defensive check." into cm-10.2
Merge branch 'cm-10.2' of https://github.com/CyanogenMod/android_frameworks_native into HEAD
merge with http://sourceforge.net/p/me722-cm/code/

Change-Id: I098531be08e2c3e7212b8b66c66ca41f6c253da0