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

Conflicts:

	include/gui/BufferQueue.h
	include/ui/GraphicBuffer.h
	libs/gui/IGraphicBufferProducer.cpp
	libs/ui/GraphicBuffer.cpp
(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)
GC triggering performance optimizations.

Copy the correct starting heap size at process init.
Interfaces to set GC/managed heap parameters.

Change-Id: Ia2b158aa28254d88f68c9534a0eef580aa811b10
(cherry picked from commit 60c25a585aaa81496e83fb134502594caa0dceb6)
(cherry picked from commit 8873acb0ffc224388eeadc7204ddb6bff4819c7f)
(cherry picked from commit 6ca5469d1fbfb432a945df49e276fc4edc1eff87)
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)
Telephony(MSIM): Add support for MultiSim

Add below services to service_manager to support MultiSim.
  phone_msim
  simphonebook_msim
  iphonesubinfo_msim
  isms_msim

Change-Id: Icbb8163a7b9a3d5c36764ebd5a2272e2bb6cc387
(cherry picked from commit 459e79cb0deedcae04f1779c2f79e68d6dc4c3cc)
(cherry picked from commit 8749fe5b55743fccf1aaed9e400447890e8dda82)
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
servicemanager: Add listen service to the service table

listen service provides interface to applications to register
notification for voice detection events.

Change-Id: I3575be8eeab6487f6f7c252ac68ceb3f78304aa4
Merge "servicemanager: Add listen service to the service table"
libgui: Add native window attributes to query usage

This is required to enable GL libraries to query usage
native window attributes to enable/disable tile rendering.

Change-Id: If752fa26ac3d8ffd7776cc5a16fe162af0742df5
GlES2: Add NULL check

Check for NULL before calling thread specific glGetString.

CRs-fixed: 569609

Change-Id: Ifee8257152ba7ca7a05df5d7b113171b71d16c82
Merge "GlES2: Add NULL check"
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.

Change-Id: I52de68258ac9f87d704ee5401f93417805fa6773
Init display orientation according to panel orientation

   - Initialize the display default orientation to panel orientation.
   - honor the panel orientation only after the end of boot animation
     or the new orientation is as same as panel orientation.

Change-Id: Ieece097ff7c3710e379f47028900aed59a96c8d5
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