[3-4/4] TRDS 3.0 Native theme engine preparation

[3/4] Port from: https://github.com/SlimRoms/frameworks_native/commit/78c3e04e00b47d6d4c215211d1c02d201815276e

 NEEDS BE ADDED MANUALLY ???
[4/4] Port from: https://github.com/SlimRoms/android_development/commit/756ab1219f22331399da5c900ba90e4b570db945
I placed two commits because I got error trying pac-review in development foler in my source... idk why? anyone can explain me?

Change-Id: I09aec2065769fd51de53a35af07a332356cdc7d4
surfaceflinger: don't handle EVENT_ORIENTATION when !HWC_DEVICE_API_VERSION_1_0

a184463 causes segfault on boot for the enrc2b (and probably others), this fixes it.

Change-Id: Ic4a7a05b44c8cc44a0d25c56def4acdf5b0939df
surfaceflinger: Apply bugfixes to the correct hwc code paths

Changes I2deaf2ed101e8ea76708862a6bb67751b6078794 and
I1cb44389a05c9ec049d7f0d39c288feccb11a91c, both meant to deal
with corner-case layer states, were mistakenly merged into
the pre-1.0-hwc code paths. Move them to their intended locations

Change-Id: Idd6b3513cc36dda21b552eee97f9ea91793df18f
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Add sessionId metadata with every buffer queued through Surface

Add sessionId metadata to identify the buffers to be belonging to a
single video session

Change-Id: Ic26cf1d7fdead1c38c0f43e562b7878663d7291c
Display: Add swaprect feature for MDP composition.

Add swaprect feature for MDP composition.
SwapRect is a SurfaceFlinger feature for selective composition
of only thedirty region.
* Existing SF does copying of the complete layer for every
 layer (in effect the full screen) whether or not the layer's
 information has changed (dirty region).
This is very inefficient use of compositing hardware (MDP/GPU).
* At the app level, we're doing dirty region rendering (App only
renders what is changed) using the feature "Dirty Region Rendering".
So, at the app level we know what has changed (dirty region) per
 layer. But SurfaceFlinger doesn't know this info and hence it's
 not able to use dirty region for selective composition and ends up
 compositing full screen.
* For SurfaceFlinger to composite only the dirty region
   1. It needs to know the dirty region (This needs to be passed
      down from the app)
   2. It needs to pass this info to the actual compositing hardware
     (MDP / GPU) so that the hw can do selective composition
* SWAPRECT feature needs to implement 1 & 2.
* 1 is common for all composition types whereas 2 is different
 for each composition type
This change implements 2 for MDP composition
* We've also added strong checks in the feature to make sure the
 feature kicks in only for the UX scenario's where performance
 improvement is expected and no functionality issue would arise.
To enable MDP Swaprect, setprop debug.sf.swaprect 1 and restart
framework.

Change-Id: Iac67acffcd4de1413cdbe0f15a278cc2cd54206f
sf: Enable swaprect optimization by default only on QCOMs

 * This is confirmed to cause problems at least on i9500.
 * Only enable it by default on QCOMs, other devices can opt
   in using the system property.

Change-Id: Ic00137201f4a5383877f4033473c1ea5ac32a3a7
SF: Add flag for swaprect status in HAL

We need to check in HAL whether swap rect
is enable or disable to calculate wormhole region.

Change-Id: I4fbff4119856e41694e2065141b40fdd7a15f375
SurfaceFlinger: Change to support framebuffer flip for 2D blitters

- Surfaceflinger does not flip framebuffers when there are
  no layers marked for HWC_FRAMEBUFFER
- This change checks for the HWC_BLIT flag and will request a flip
  to a new FB_TARGET buffer even if there are no FRAMEBUFFER layers

Change-Id: I1cb44389a05c9ec049d7f0d39c288feccb11a91c
Display: Define new composition type for blit composition

This change defines a new flag 'hasBlitComp' to identify
blit composition. This flag is used to enable the swap rect
feature for blit composition cases.

Change-Id: Ic523e19796a893efbfc3bff300d1f982cba5ddfa
Revert "Add sessionId metadata with every buffer queued through Surface"

This reverts commit 85743373ed7d4eb6cb58412bda6c74f9ee29f06f.
This change is no longer needed

Change-Id: Ia5612b42f081236db65ac8eef9d359dfd23f4117
surfaceflinger: Conditional compilation for swaprect feature

 * Since this now calls into the HAL, we can only support it on
   devices which use the new version.

Change-Id: I231d70ac3d17fd2198f3929057c1edb0f158c099
Do not just silently fail if surface creation fails

Some apps do not check if they actually got a surface (e.g. bootanimation)
So this helps the track crashes down to the cause.

Change-Id: I6e74bdb52ad7ebe260b0ec1777c585781f6bbd42
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'