Add LegacyUsbDeviceManager::setCurrentFunction method.

Method implementation is the same as UsbDeviceManager::setCurrentFunction.
The override is required to use LegacyUsbDeviceManager's mHandler, as
UsbDeviceManager's mHandler is an uninitialized private field.

Change-Id: I9ffece5247c17de77fa799e1f6c9b439ebd074db
binder: add support for Ion

Add classes to allocate from the Ion memory manager.
binder: Get rid of old flag

MAP_LOCKED_MAP_POPULATE is an outdated flag that is not used
anymore. Get rid of this flag in MemoryHeapIon
SurfaceFlinger: Fix surfaceflinger crash when showing screen update

With selecting 'show screen update' option under Setting/Developer
options, there's crash in getYUVBufferCount() in Hwcomposer.cpp.
This occurs because the handles of hwc_layer_list have invalid
values that are passed from HWComposer:createWorkList().
Initialized hwc_layer_list after it is allocated.
Surfaceflinger: Compose UI in S3D format

The new member of LayerBase takes care of identifying layer for 3d
composition. When 3D composition is required the Layer takes care
of drawing in 3D format

Change-Id: I55c99a3cb612c6dd7a22d346a5b9a88c056c835d
SurfaceFlinger: Return error on invalid buffer creation

When a buffer is re-allocated on reconfiguration, return NULL
if there is an error in re-allocation.

Also, remove warnings during compilation.

Change-Id: Ie01bfcfbb469a106ef99bf1725376e2753206708
CRs-Fixed: 337660
SurfaceFlinger: Skip composition when rotation is not completed

When rotating, each layer's buffer is already changed to
new orientation before SurfaceFlinger gets the signal from
Window Manager. If the orientations of all the buffers are
changed to new orientation, then that's fine. But, sometimes,
only one buffer is changed and others remain the same.
In this case, skip composition.

Change-Id: I850fe8ee6d806e21833e6811f95878fcfb6f7c40
CRs-fixed: 338034
SurfaceFlinger: Prevent screencap command from failure

For secure windows, screen capture fails, and the screencap command
falls back to reading from the framebuffer directly.

Instead, draw a black screen on the framebuffer object if there is a
secure session, so that secure layers cannot be captured.

Change-Id: Ic14ee3f119f622b41f1af3861237204805fb3ca2
CRs-Fixed: 338570
SurfaceFlinger: notify HWC when layer is in asynchronous mode

When the layer is in asynchronous mode the HWC may choose a
different composition method.

CRs-Fixed: 335498
Change-Id: Ifa4658338e98e80e9a673bdf10ae388f0ad3ae9f
SurfaceTextureClient: Add support for external only usage flags.

Add support for GRALLOC_USAGE_EXTERNAL_ONLY and
GRALLOC_USAGE_EXTERNAL_BLOCK to be set as a part of usage flags.
These flags if present will be cached by SurfaceTextureClient.
Incoming usage flags will be ORed with these, if present.

(cherry picked from commit dcbd475319bae2f5d0613bf62d8324169e6ab79d)

Change-Id: I366f6a664805e8944663600dc3b1f82530275873
Surfaceflinger: Modify setFormat() API to set 3D format.

setFormat() API is modified to accept 3D formats from applications.
This change is required for 3D game usecase so each layer can be
marked as 3D and can be sent to overlay for rendering.

Change-Id: I9266d9ab367c5eccb8fb182f3f517234415a9897