surfaceflinger: Allow gpu to render widevine level3.

Allow gpu to render widevine level3 but keep
blocking screen shots.

CRs-fixed: 428647,424769,421767
Change-Id: I914232a062acbb7b17901dbf2b414973230e59d9

Conflicts:

	services/surfaceflinger/Layer.cpp
(cherry picked from commit f4c511eadf2450f1764617245205ffb940b710f8)
(cherry picked from commit 98d7ecf2a82fe6c2a82285b64ea9a8d8da443e9a)
(cherry picked from commit 2dcc6c014c7593d4d18667299718832a339905e3)
frameworks/native: Add support for custom layers in Surfaceflinger.

  - Check for the EXT_ONLY layer and add only that layer to external
    list and do not add that layer to the primary list
  - Check for INT_ONLY layer and remove that layer from external list
  - These are added to support EXTERNAL_ONLY & INTERNAL_ONLY feature

Change-Id: I8f84eeacebf97d44446f319f69b8a73e56f2cb6d

Conflicts:

	services/surfaceflinger/Layer.cpp
	services/surfaceflinger/Layer.h
	services/surfaceflinger/SurfaceFlinger.cpp
(cherry picked from commit 42cd6bd3bc9e8d1e1eaabaaa06d16803b45942bd)
(cherry picked from commit 62af24e70035866aa8e8741a6f058fa8309d0028)
(cherry picked from commit 97112b478210c2adebdc1c0b41b60444e9ce6767)
Add support for custom buffer sizes..

Add native window properties NATIVE_WINDOW_SET_BUFFERS_SIZE to the
perform function of Surface to set the user defined size
of graphic buffers. This is needed for adding support for
the playback of interlaced content.

Change-Id: I8354c29d2ffcc03178fae86dfa449cbefd24ae55

(cherry picked from commit 989265bbdcaeab8ae59e8615aebc3a20b2775436)
(cherry picked from commit 25c5de066d911c4720cc6570a8bb9e21e899e4fb)
(cherry picked from commit e9a8f7b1f1334d4a36eebde3b3f7ff141ae26bc7)
Surface: Fix gralloc flags conflicting values.

Due to some custom code, unwanted flags (HW) got added with SW flags.
Restrict the flags to custom ones.

Change-Id: I2ab1c75eef4d6d16f0dd7d43aff3c7377486801a
(cherry picked from commit d9b9e1510418e5babf54f34ed8a81cbc368f521e)
(cherry picked from commit 947e0802d55a70aef4c32875f4ddfd2c30576bce)
(cherry picked from commit 4d3419b9185e8f57ff811cf7b14782902c66172f)
sf: Override presentation layer with ext_only layer

Do not add presentation layer to the external list when external only
layer is present.

Change-Id: I46c8a85a572f88a2d4026c4026d99fd037b928be
(cherry picked from commit 9b39ac80890e77177427acec3f6e423085265491)
(cherry picked from commit d5be54b045571e0b9d139bd1022d922137c13bb9)
(cherry picked from commit a72ea507c0587031910e484d989ab32179a7ddfe)
SurfaceFlinger: Dont show Animation on External Display

- With this change the animation effect will not be shown on
  external display.
- It will change from portrait to landscape in one shot.
- Primary would still continue the animation effect
- set property sys.disable_ext_animation to disable animation

Change-Id: Ibd94bf166f08eeab1d504afe69230f7c6a617eb6
CRs-fixed: 453747
(cherry picked from commit 2435bb907b32a7931a2860b7fa984d2e705b5ed1)
(cherry picked from commit 04886a20e6547d12b20f45265fc6ae431b0f9efd)
(cherry picked from commit c6933cb180e67e159a01a75fd36dc8aaaf8b891f)
Surface: Initialize variable and add a defensive check

Initialize buf variable and make sure to check for return
value of dequeueBuffer() before sending to the client.

Change-Id: I0569f2d45825fab0e5d0f38fc91a07990f57c7ab
(cherry picked from commit a6bd7106a7305208f187fbf0a48f14139e33c9d6)
(cherry picked from commit e5d7662d68c5be2b282edd58d4feb68a4d476182)
(cherry picked from commit 885c146144480d4371a0a97df89b8e77f53d3d94)
Check fence is not NULL before dereferencing it

If the fence obtained in dequeueBuffer is NULL, don't dereference it.
This will avoid a crash in surfaceflinger.

CRs-fixed: 516300
Change-Id: I3054dc37087103f3addae7884bb03460484a1eec
(cherry picked from commit ddf4adb487dc76ccb75fe2432772d6fc575ed77c)
(cherry picked from commit c6ae5271f9ced9a747e1481c2ef875ba03674172)
(cherry picked from commit cdad709878601eb694acbce7d3ae9f7a74bf14f3)
SurfaceFlinger: Add support for virtual display.

- Creates a rendering surface when invoked via hybrid path
- Makes changes in HWC wrapper to handle virtual display via HWC

Change-Id: I86560b5009949b75c267249799a446b8279eff32
(cherry picked from commit 577c0753b7aef84b99252545dc256c66d4f9d028)
(cherry picked from commit 80062f383e7dc012a0ac5eb6f33b8b8edc21377a)
Fix for VirtualDisplay CTS issues.

Following CTS cases fails without the change
1. testEncodeVirtualDisplay
2. testMultipleVirtualDisplays
3. testSingleVirtualDisplay
4. testPrivatePresentationVirtualDisplay
5. testPrivateVirtualDisplay

Issue happens because displaySurface not being initialized
as its becoming local variable and loosing the context.

Change-Id: I54ce623f611faf7fc5d4d00b0d042f9943b57bbe
GraphicBuffer: exynos4: set FIMC1 usage bit on samsung specific formats

Change-Id: Ia8cde7e594f8be464ef15eaae453872ee5aa2768

Conflicts:
	libs/ui/GraphicBufferAllocator.cpp

Conflicts:
	libs/ui/GraphicBufferAllocator.cpp
libui: exynos4: apply FIMC usage flag on format HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED

Change-Id: I8a98e593cb60d0843e83a5e431142410e26d82e7
ui/sf: Add support for exynos HDMI

Change-Id: I27b34e95c04750e3dd321a2183b6cc1d89f29b5d

Conflicts:
	libs/ui/Android.mk
	services/surfaceflinger/Android.mk
	services/surfaceflinger/SurfaceFlinger.cpp
	services/surfaceflinger/SurfaceFlinger.h

Conflicts:
	libs/ui/Android.mk
	services/surfaceflinger/Android.mk
sensors: Add dummy light sensor

Some devices have a sysfs toggle for the lightsensor instead of
passing the LUX values for userspace processing; for those,
use BOARD_SYSFS_LIGHT_SENSOR:=<sysfs path>

This is necessary for the rest of userspace to recognize its existence
and toggle it for auto-brightness. It doesn't generate actual light
values, though; all backlight adjustments are made in-kernel.

Change-Id: I0e546b4740720bd34d1e1d85a96b295fcc697106

sensors: dummy ls: set unique handle

handles and types are usually the same, but it's not mandatory.
Sony DASH use custom handles, and the previous assumption broke
Proximity sensor on Sony devices.

Change-Id: I954e13765f42341e6b5393a12556f6a007c4e494

Conflicts:
	services/sensorservice/Android.mk
	services/sensorservice/SensorDevice.cpp
sensordevice: Dummy ALS: Solve fortified libc warning

convert sprint to snprintf, the size of the writes is always known

Change-Id: I53ee36b67544ac25de7e5c05ce90b6817c8a9c92
SurfaceFlinger: Removal of NO_RGBX_8888 flag for OMAP3

Removing this will allow color format of surface to be set for RGBX8888
that can improve performance for 32 bit framebuffer.

Tested on Nook Color with CM10
TI's commit can be found here:
review.omapzoom.org/#/c/21374/3

This will also remove the need to have BOARD_NO_RGBX_8888 := true
in the BoardConfig.mk

Change-Id: Ibc6e56c992a6433bc8688d88471d4feb9084278c
build/phone-xhdpi-1024-dalvik-heap.mk Revert AOSP heapgrowthlimit change from 64 to 96

This reverts part of AOSP change at

https://android.googlesource.com/platform/frameworks/native/+/c84e9844d621223d14178be521

Possible performance issues have arisen because of it. Discussion at

http://code.google.com/p/android/issues/detail?id=40961

Patch Set 2: Clean up commit message

Change-Id: Id7e3324607f92553a98e4d47da58a322e4fba657
frameworks/native: Fix toroplus radio with CFLAGS

This is a commit to fix the LTE radio on toroplus,
since the binaries contain a broken reference to
an old no longer existent object. This fixes that
with a CFLAGS to be enabled in the .mk files of the
toroplus device files (like BoardConfig.mk).

Credit for the original fix goes to
Sean McClenaghan (cyberkitsune09@gmail.com)
http://review.cyanogenmod.org/#/c/47134/

PS 2-3: forgot some stuff in the commit message

Change-Id: I2c0f05d1f70b96ad801971f23f6f9cf4e0fa7167

Conflicts:
	libs/gui/Android.mk
Unbreak libgui

Change I2c0f05d1f70b96ad801971f23f6f9cf4e0fa7167 broke libgui for a
bunch of pre-4.1 blobs by changing the surfaceclient API, so bring
it back

Change-Id: I1f6ce3b886539d0e972bbe41116192bf162be968
binder: add compat symbol

Required for older Samsung libtvout

Change-Id: Ib18d2513570382432d49f302ab041230650372f2