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)

Conflicts:
	libs/gui/Surface.cpp
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)

Conflicts:
	services/surfaceflinger/SurfaceFlinger.cpp