fix a possible deadlock when removing a layer and destroying a client

generally the last reference to a Layer is released in commitTransaction()
with mStateLock held. Layer itself only holds weak references to Client,
however, ~Layer() briefly promotes this weak reference -- during that time
the all other strong references to that Client go away, ~Layer is left with
the last one... then hell breaks loose as ~Client is called, which in turn
needs to acquire mStateLock.

We fix this by holding a temporary copy of the drawing state during
the transaction so that the side-effects of copying the current
state into the drawing state are seen only after mStateLock has
been released.

Bug: 9106453
Change-Id: Ic5348ac12283500ead87286a37565e8da35f1db2
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
fix a possible deadlock when removing a layer and destroying a client

generally the last reference to a Layer is released in commitTransaction()
with mStateLock held. Layer itself only holds weak references to Client,
however, ~Layer() briefly promotes this weak reference -- during that time
the all other strong references to that Client go away, ~Layer is left with
the last one... then hell breaks loose as ~Client is called, which in turn
needs to acquire mStateLock.

We fix this by holding a temporary copy of the drawing state during
the transaction so that the side-effects of copying the current
state into the drawing state are seen only after mStateLock has
been released.

Bug: 9106453
Change-Id: Ic5348ac12283500ead87286a37565e8da35f1db2
sf: virtual display clean up

  Since HAL allows Virtual devices, remove virtual display id
  check during setup of virtual display.

Change-Id: I6ec93c0f06842b69e6677f05ae8b45fb1f4225f6
Merge branch 'cm-10.2' of git://github.com/CyanogenMod/android_frameworks_native into cm-10.2
libgui: Fix building with QCOM_BSP + CAF display

Change-Id: Iaf0eb69fa7f409144a266ada683fceb835f62aff
Merge branch 'cm-10.2' of git://github.com/CyanogenMod/android_frameworks_native into cm-10.2
Add barometer support to handheld_core_hardware.xml
Merge "fix a possible deadlock when removing a layer and destroying a client" into cm-10.2
Merge branch 'cm-10.2' of git://github.com/CyanogenMod/android_frameworks_native into cm-10.2
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
Merge remote-tracking branch 'temasek/cm-10.2' into cm-10.2