frameworks/native: Modify dirtyRect only on GPU pre-rotation.

Modify layer dirtyRect only when the buffers are pre-rotated by
GPU, not when the buffers are scheduled to be rotated during
composition.

Change-Id: I6dd3c0a9c62fd2b48e58ecd872b37b0655a02958
sf: Fix incorrect state reporting in dumpsys

Dumpsys utility access layer compositionType variable
with out proper protection. These variables are modified
during hwc_prepare call. Existing HAL lock protection is not
sufficient to address this issue. Failure to do this will
result in incorrect state reporting in dumpsys.

A new drawLock mutex in HWComposer that will be used in both
dumpsys and draw calls to ensure correct state is accessed.

Change-Id: I6289e0a3d1f5bbf35a18ddcd0538c9cda3e96c27
sf: Enable GPU Tiled DR optimization for overlap and mixed mode use cases

Extend the GPU Tiled DR optimization to Overlapping layers use cases
and mixed mode composition.

Change-Id: Iaba496be21d5c4ceeedfe3405cf26b36677cd14b
MemoryHeapBase: ifdef for gingerbread/froyo compatibility

Allow to "revert" by a board config flag the offset member addon
see commit f24c4cd0f20 (aosp change id Ie618fb5c0718e)

This change is required to use overlay based proprietary camera libs
coming from gingerbread and froyo builds.

This change also requires a global cflag named BINDER_COMPAT
because a lot of modules use the MemoryHeap includes

Add this in your BoardConfig.mk :
COMMON_GLOBAL_CFLAGS += -DBINDER_COMPAT

Backported from /#/c/13317/

Change-Id: Ic8e18bc60a7310b0fa90ad251381e9f7d9e58d5e
Overlay support for legacy camera libs

Move http://review.cyanogenmod.com/#/c/13285/ to proper place for jellybean.

1. Rename OverlayHtc to Overlay in file names
2. Use BOARD_USES_LEGACY_OVERLAY to enable

Signed-off-by: Evan McClain <aeroevan@gmail.com>
Change-Id: Ib6afd1b610b1d3e263fcaa38585e7a1116baaf58

Conflicts:
	libs/ui/Android.mk
sensorservice: Add legacy sensors fusion.

This change allows devices with accelerometer & magnetometer but
without gyroscope to still get virtual sensors such as Gravity,
Linear Acceleration and Rotation Vector.

Ported from: http://review.cyanogenmod.org/#/c/31329/

Change-Id: Ifa702cb0383ea1fd84511539fb67ec69ce9a558a
native: add flag to disable legacy sensors fusion
Causes problems on all p31xx devices.
http://pastebin.com/PabjFVWP

Change-Id: I12df77c5bca2c67447ced1e3d32b405009d9e3aa