Enable the use of old HWComposer APi

Tegra 2 devices like TF101 need this to stop surfaceflinger from crashing, causing hotboots
Board flag is BOARD_NEEDS_OLD_HWC_API := true

Change-Id: I931be737b809427c6ce1c9f61200687450b14a8d

Conflicts:
	services/surfaceflinger/Android.mk
sf: Fix detection of 0.3 hwcomposer

The format was different, so look at the header bits too...

Change-Id: Ibc3d4c9f6bca74d6951041f92e2ecc6189e58c41
surfaceflinger: Consolidate display orientation compensation hooks

Dedupe rotation calculation code and make rotation a statically
available property in the DisplayDevice
Change-Id: Ic517ab0d2c05026cd6fa46d664aab7926be17b62

Conflicts:
	services/surfaceflinger/DisplayDevice.cpp
Surface: 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.

(cherry picked from commit 9dc653a0fe16e70469a1a55f55da1a47c30d4d95)

Change-Id: I52de68258ac9f87d704ee5401f93417805fa6773

Conflicts:
	libs/gui/Surface.cpp
sensorservice: Fix init sequence for pre-1.1 API sensor HALs

The sensors API introduced a new flush() method that older binaries
won't have. For those, replace the firstFlush invocation with a
setDelay call since a lot of implementations interpreted that as
the initialization step.
We also don't want any kind of call to flush() to happen when it
isn't there, since it'll either hit a random OEM extension or
a memory address we really don't want to execute.

Change-Id: I26ce923fe385751fed7d1c483a53c074249f0620
Add setOrientation back

	this is needed for some tegra ICS and JB_MR0 prebuilts

Change-Id: I7b534555253ede3d0061abd09e22330d5eaf3cd9
servicemanager: Allow tegra audio to register as a service

Change-Id: I6c792b6f5f586cf40d4a9b834e793a68c1e458a7

Conflicts:
	cmds/servicemanager/service_manager.c
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

Conflicts:
	services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
Graphics:Add error check when create GraphicBuffer

Change-Id: Ib0ca59bf1dfe4ae0266c29c91c1dbe3d02c0904e
Author: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Lingyun Zhu <lingyun.zhu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 50141
Fix boot animation rotation problem when ro.sf.hwrotation is set to 90 or 270

Change-Id: I7ad3c83e23ce38280818ec5283d173d50c889531

Conflicts:
	services/surfaceflinger/DisplayDevice.cpp
frameworks/native: Add support for Tegra3 based Devices by adding options
* BOARD_EGL_SKIP_FIRST_DEQUEUE to add back the legacy EGL workaround
* BOARD_USE_MHEAP_SCREENSHOT to support mHeap-based Screenshots
Those Changes are taken from
* CM (see https://github.com/CyanogenMod/android_frameworks_native/commit/c3b18f73fd7ff58794f39ad36a49c7bce996967c)
* CM (see http://review.cyanogenmod.org/#/c/53162/)

Change-Id: I41be2cedd54ed6f72d1a498b1d11e8768406fe0e

Conflicts:
	services/surfaceflinger/Android.mk