sf: vds: Fixes and code cleanup for VirtualDisplaySurface

1. Remove unused variable declarations

   Remove static variable sForceHwcCopy that is not required since moving
   to an implementation that uses a local variable mForceHwcCopy.

2. Add a condition to reduce log spam from advanceFrame hook

   When mForceHwcCopy is true, we override the composition type to MIXED.
   Therefore, we need to check whether we are in this scenario and add
   checks to satisfy the state machine requirements and reduce log spam.
   In particular, by setting mForceHwcCopy we can now expect to get an
   advanceFrame when composition type is MIXED and our previous state was
   PREPARED or GLES_DONE.

Change-Id: I1f47d6d6f01deec17da9069dea32c382c8f39b02
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
Do not limit android EGL wrapper to RGB formats.

Implementation may support other color buffer type than RGB and luminance, in
that case allow client to choose implementation supported formats

Change-Id: Ibb187e8849a41b5e60e86a33ddfba77f6b47f848
sf : Fix vertices & texture coordinates computation.

Compute crop and display frame for GPU composition also
in the same way it's done for HWC and compute vertices
and texture coordinates for GPU composition. This avoids
pixel shifts in output of GPU composition & overlays.

Change-Id: Ia4c649ef236f5684fb76ff1b4b802a9d01c1da0c
sf: Fixes for resolution change in SurfaceFlinger

1. Use active config from HWC when querying display attributes

   When we query the display attributes we should use the active
   config as reported by HWC in cases where HWC version is 1.4.
   In all other cases we should revert to the default config,
   config 0, as the active config.

2. Set/update the display config if HWC config change was successful

   The new config should only be applied if HWC succeeded in changing
   the active config. This would otherwise cause failure or undefined
   behavior if the client sets an invalid/unsupported display config.

3. Set the active config at display creation time

   When a new display device is added update the active config by
   querying HWC.

Change-Id: If55b9b308750f17bb44eab555d17e31972bc3968
Add ifdefs for QC-specific dirtyRect feature

Change-Id: I784e76ead2f8b9eeb6d5e99bd2f83fb6a32db8d8
frameworks/native: Use project pathmap

Change-Id: I29498dbc72094e48c871768675708e96b2f10556
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
Add ifdefs for QC-specific custom buffer size feature

Change-Id: I317fa6fea1bb607858adbf4dd206d383ff9ca717
sensorservice: Register orientation sensor if HAL doesn't provide it

 * In KitKat and on most Samsung devices, the orientation sensor is
   not getting registered, and makes the compass non-working in a lot
   of apps. This patch enables the sensor for such devices.

Change-Id: I0ebba72ec4aa2cfa02c21a6daff0c356c6793fd0
(cherry picked from commit 98fa6f1152da759ef3eaf36cb16e0aaf2013376a)
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

sensorservice: Set the rate for pre-1.1 HALs _after_ activation

We want to be sure these are applied in the same sequence they
used to be...

Change-Id: Ied2ba08ed3c4bed3a80bac6ab5471fcea9ba2c09
frameworks/native: Use direct project pathmap

Change-Id: I0abbab64ca034944eec6878c5d0ad655e1aee38e
Revert "Add Digital Pen hovering cursor support"

This reverts commit 452395a7b0be15409f8f24631fc55baec3bf97e5.

Change-Id: I56044073a2be926355e6ffe273ad5c014e628d52
sf: Make sure HWC_BLENDING_NONE is set for opaque layer

Before configuring the layers to HWC, make sure
HWC_BLENDING_NONE is set if the layer is opaque.

Change-Id: Ie84aa9d93e98a244692a0cffc2de653a9079f8b4
inputflinger: Add gesture sensor support

Change-Id: Ieca4e54439c47a817aaa6a9b6fabcee750ffc0c2
Add GESTURE_SENSOR input source

Change-Id: If61a7e7bf2d8b2665db7ca57ed68a4462d0c1783
sf: Add a NULL check in getDisplayConfigs

Validate the display binder by adding a NULL check in getDisplayConfigs.
This will prevent a false match if the caller queries the display
configs for an inactive display (whose binder is NULL by default).

Without this change we might end up attempting to index the display
config array, which is unpopulated for inactive displays, and this will
result in a crash. (See getDisplayInfo in SurfaceComposerClient.cpp for
an example of this scenario)

Change-Id: I1a12f43b7c375b9c01998dadd5b658275c733fb2
sf: Add RGBA_4444 and RGBA_5551 format in getFormatStr function

Add RGBA_4444 and RGBA_5551 format in getFormatStr function to log
string name instead of format number in dumpsys Surfaceflinger log.

Change-Id: Ib8423f27ce6bc0fd1b99e7610a870b39ff6441c0
sf: Rename default app buffer count property

We are setting default app buffer count property from HAL,
and there we can't go with read only based property.
Hence renaming it.

Change-Id: I9fd4bdb50aca35647402c59b24d78ad5f878aab5
Bring back support for glReadPixels screenshot path

Squashed commit of the following:

commit 012d3fe41d1d6cd38a0858b59145e9a4447641fa
Author: Hashcode <hashcode0f@gmail.com>
Date:   Sun Dec 8 19:36:50 2013 +0000

    sf: Always use opengles for screen capture

    Go back to the usage of GRALLOC_USAGE_HW_TEXTURE and GRALLOC_USAGE_HW_RENDERER
    in captureScreenImplLocked regardless of useReadPixels value

    This fixes the EGL_NO_IMAGE_KHR error returned from
    eglCreateImageKHR (blank images returned from screenshot path)

    Change-Id: I62fe90a081607b9e89c67f3dcfd34c84efc89d35

commit 4866ddf98ac98d8e22a1cd6a21894bb17f274588
Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date:   Thu Oct 31 03:53:39 2013 +0000

    Revert "remove support for glReadPixels screenshot path"

    This reverts commit 3ca76f416bc8665a97636ca8a2d0128b9da9d92c.

    Conflicts:
    	include/gui/ISurfaceComposer.h
    	libs/gui/ISurfaceComposer.cpp
    	libs/gui/SurfaceComposerClient.cpp
    	services/surfaceflinger/SurfaceFlinger.cpp
    	services/surfaceflinger/SurfaceFlinger.h

    Change-Id: I8c239e533757af770e418dbb198f5a86c736961f

Change-Id: I8c239e533757af770e418dbb198f5a86c736961f