add a layerStack attribute to Layers.

this attribute can be set through a regular transaction using
SurfaceComposerClient (just like any other attribute, eg: position or size)

Change-Id: I701a47c677ea6442ca713728a93335328cd2b172
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 8aa0c55..4930e33 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -124,6 +124,8 @@
     status_t setOrientation(int orientation);
     status_t setCrop(const sp<SurfaceComposerClient>& client, SurfaceID id,
             const Rect& crop);
+    status_t setLayerStack(const sp<SurfaceComposerClient>& client,
+            SurfaceID id, uint32_t layerStack);
 
     static void closeGlobalTransaction(bool synchronous) {
         Composer::getInstance().closeGlobalTransactionImpl(synchronous);
@@ -255,6 +257,17 @@
     return NO_ERROR;
 }
 
+status_t Composer::setLayerStack(const sp<SurfaceComposerClient>& client,
+        SurfaceID id, uint32_t layerStack) {
+    Mutex::Autolock _l(mLock);
+    layer_state_t* s = getLayerStateLocked(client, id);
+    if (!s)
+        return BAD_INDEX;
+    s->what |= ISurfaceComposer::eLayerStackChanged;
+    s->layerStack = layerStack;
+    return NO_ERROR;
+}
+
 status_t Composer::setMatrix(const sp<SurfaceComposerClient>& client,
         SurfaceID id, float dsdx, float dtdx,
         float dsdy, float dtdy) {
@@ -443,6 +456,10 @@
     return getComposer().setAlpha(this, id, alpha);
 }
 
+status_t SurfaceComposerClient::setLayerStack(SurfaceID id, uint32_t layerStack) {
+    return getComposer().setLayerStack(this, id, layerStack);
+}
+
 status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx,
         float dsdy, float dtdy) {
     return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy);