frameworks/native: latest caf and ifdeffed

Change-Id: I526b372596ba8d8ab7b69002bc4169bcae46e510
GlES2: Add NULL check

Check for NULL before calling thread specific glGetString.

CRs-fixed: 569609

Change-Id: Ifee8257152ba7ca7a05df5d7b113171b71d16c82
surfaceflinger: Set max acquired buffer count

If triple framebuffers are enabled, the number of acquired
buffers isn't increased by default. Set the count to one less
than the max buffers to make sure all three buffers come into
play.

Change-Id: I65054ed4004607f5be68c893f6f621e821cfbf1c
frameworks/native: fix copy back dirty region

Copyback dirty region logic does copyback,
even when its not necessary causing 2ms delay.
Fix the logic to copy back only what is necessary.

Change-Id: I52de68258ac9f87d704ee5401f93417805fa6773
Merge branch 'kitkat' into HEAD

Conflicts:
	libs/gui/Surface.cpp
	services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp

Change-Id: Iaeeafc58e1b28d27bc12c79d4d269432ba961adb