hax: Add back the SURFACE_SKIP_FIRST_DEQUEUE legacy EGL workaround

Set BOARD_EGL_SKIP_FIRST_DEQUEUE to use

Change-Id: I46257a7e9e6b6e093a5cb92eaaaef4bdd0435a12
native: Add dock battery support

Dock battery patchset chain:
base: http://review.cyanogenmod.org/#/c/55349/
native: http://review.cyanogenmod.org/#/c/55028/
healthd: http://review.cyanogenmod.org/#/c/55029/
settings: http://review.cyanogenmod.org/#/c/55212/
tf700t: http://review.cyanogenmod.org/#/c/55030/

Video (battery styles): https://www.dropbox.com/s/a7dp3glb7lv1zcg/dock_sdcard01.mp4
Screenshots:
 * No dock: https://www.dropbox.com/s/2yvngdaqok32xiz/dock_sdcard01.png?m=
 * No charging: https://www.dropbox.com/s/ezghtgoedei17oj/dock_sdcard02.png?m=
 * Docked no charging: https://www.dropbox.com/s/7fasc05fw5ylfxi/dock_sdcard03.png?m=
 * Docked charging: https://www.dropbox.com/s/x37vrhxzd075f7p/dock_sdcard04.png?m=

Change-Id: I5f1431736cd6d6d2f6c593881323d3efb5db6b3f
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Forward-port surface dithering from CM10.2

This allows the use of 16-bit color displays without excessive color
banding;

Change-Id: Icb469b9cb4beb686516c60bb576dbd0a73f505e0
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
Revert "SensorEventQueue: Allow setRate on sensor enable"

This reverts commit 320fd662a3cf98c920fb9b2ae05e34c7ee3e623d. It's the wrong fix for the wrong problem. The main issue on 
devices like the JF is the presence of a new method (flush) in the 1.1
sensor API, which can't be invoked in older blobs and should
be addressed in the sensorservice itself.

Change-Id: I2f5fff41db7a11ed2e0f6650d1f1cecb5e2a03fb
Merge "Revert "SensorEventQueue: Allow setRate on sensor enable"" into cm-11.0
BatteryService: Restore the original parcel order

Append the dock extensions to the end of the parcel to preserve
compatibility with the original parcel format.

Change-Id: Ib4fa8473fcab9882d41bd9f9617af163154290ab
Merge "Forward-port surface dithering from CM10.2" into cm-11.0
Merge "hax: Add back the SURFACE_SKIP_FIRST_DEQUEUE legacy EGL workaround" into cm-11.0
installd: Invert the default for dexopt-on-cache

The growth of /system apps and total /data space are making this
device-breaking (insufficient space to dexopt everything to
/cache), pointless (/data has more than enough room to hold
the cache), and in some cases, both.
The default behavior is now the same as mainline Android's: dexopt
everything to /data. Set dalvik.vm.dexopt-data-only=0 to change
that and dexopt /system apps to /cache. If you do that, make sure
your /cache can accomodate double the size of the dex classes in
system, since in some extreme cases that has been observed during
dex2oat

Change-Id: I8c793784af1fa804ccf84b442613d1000c9b7ce4
Merge "installd: Invert the default for dexopt-on-cache" into cm-11.0
libgui: Bring back support for mHeap-based screenshots

Older graphics libraries throw a hissy fit when trying to lock
buffers for Surface-based screenshots, on at least Tegra2/3 and
Exynos4 hardware.

This patch depends on the BOARD_USE_MHEAP_SCREENSHOT board flag
and requires the ro.bq.gpu_to_cpu_unsupported property set to 1
in order to work.

Change-Id: I7db955e2cdd120018e349c14290e975788e70ed3
libs/ui: Fix crash issue because of null pointer access

- handle NULL check is required while flatten GraphicsBuffer

CRs-fixed: 579102

Change-Id: I292b4b25dc1f5320378cc9e4affbad326e1fdaed
frameworks/native: Add support for Secure Display

- Add secure UI layers to primary and remove other layers from
  internal and external list for Secure Display usecase.
- Dont let secure UI layers to be captured on screen

Change-Id: Iebdad5c56247308604ee90928f6d6460a1f69279
SurfaceFlinger: Add NULL check for buffer handling

Add buffer handling NULL check in dequeueBuffer and
verify whether the output data from binder is not NULL
in queueBuffer and connect api's to avoid SF crash

CRs-Fixed: 573088
CRs-Fixed: 572315

Change-Id: I41cebbc0cbcbbb0fd5ecb38db7ec7b0c91cdffe9
SurfaceFlinger: Enable Vsync trace for SF Composition

Enable traces to show s/w vsync which is used for composition
by surfaceflinger, this helps in identifying the start of
composition cycle in systrace

Change-Id: Id892ca03bacd9f0cfe5ca2c3f8bb5aa892b37231
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
Merge "libgui: Bring back support for mHeap-based screenshots" into cm-11.0
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